Comments (7)
Sounds like a great enhancement. It should be behind an option (perhaps the option disables this behavior so that the default is friendlier?). It should only kick in when the AST has type info and it knows for sure itβs not a number or string or bigint.
from eslint-plugin-react.
It should only kick in when the AST has type info and it knows for sure itβs not a number or string or bigint.
Does the plugin use TS type parsing at the moment?
from eslint-plugin-react.
If the TS parser is used, and attaches type info to the AST, we can (and often do) use it.
from eslint-plugin-react.
I think this issue means making the rule recognize all 3 variables below are essentially boolean
values.
I guess similar to how VSCode tells the type of a variable when hovered?
I would love to help improving this rule, but pretty new to this repository. Do we have any examples of similar TS type parsing?
from eslint-plugin-react.
@yusufkinatas we don't typically have type-specific stuff, so off the top of my head i'm not sure where to look. however, you could always do the brute force approach and add some test cases and some console.logs, and see what type info is available on the AST nodes :-)
from eslint-plugin-react.
Related Issues (20)
- [Bug]: react/boolean-prop-naming - Cannot read properties of undefined (reading 'properties') HOT 1
- [Bug]: peer dependency error with eslint@9 HOT 1
- [Bug]: An incomprehensible mistake HOT 3
- [help wanted] The functions option (defaultArguments) in the react/require-default-props rule does not work as expected. HOT 1
- [Bug]: HOT 3
- Add "line-aligned" to react/jsx-closing-tag-location HOT 9
- [Bug]: Properties faulty identified as not declared for types in react-hook-form HOT 1
- [Bug]: checkKeyMustBeforeSpread of react/jsx-key doesn't work when generating array dynamically
- [Bug]: Endless listing cycle HOT 4
- [Bug]: The endless linting cycle HOT 1
- [Bug]: Rule "react/no-direct-mutation-state" failing in a stateless component HOT 1
- Remove `react/prop-types` from the recommended config HOT 1
- Quick question: does `settings.version` default to "detect" yet? HOT 3
- [Bug]: Unable to use with eslint 9.x HOT 1
- `jsx-no-leaked-render` can work better if it checks the TS type of the left-side value HOT 1
- [Bug]: react/boolean-prop-naming not working with TS & declaration HOT 2
- with redux there is not necessary error HOT 10
- [Bug]: Key "plugins": Cannot redefine plugin "react" HOT 10
- [Bug]: `react/no-object-type-as-default-prop` is disabled when using a `ref` prop HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-react.