Rule change: no-extra-boolean-cast should catch more cases
See original GitHub issueWhat rule do you want to change?
Does this change cause the rule to produce more or fewer warnings?
More
How will the change be implemented? (New option, new default behavior, etc.)?
New default behavior
Please provide some example code that this change will affect:
if (foo && !!bar) {}
if (!!foo && bar) {}
while (foo && bar && !!baz) {}
if (foo && Boolean(bar) {}
What does the rule currently do for this code?
No errors
What will the rule do after it’s changed?
Throw a Redundant double negation
error.
Are you willing to submit a pull request to implement this change?
Possibly, depends what time I get.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:9 (9 by maintainers)
Top Results From Across the Web
no-extra-boolean-cast - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >No extra Boolean cast in JavaScript - Stack Overflow
In the code snippets above I can't omit non inverted boolean because the functions given as examples are expecting a boolean. And false...
Read more >no-extra-boolean-cast - ESLint Config
This rule disallows unnecessary boolean casts. What ESLint should do when it catches the rule break. Show a warning ...
Read more >ESLint Code Checks | SAP Help Portal
The following tables show the ESLint rules that should be enabled for the SAPUI5 ... no-extra-boolean-cast, error, warning ... default-case, off, warning.
Read more >17.7.0 API Reference - joi.dev
Note that joi schema objects are immutable which means every additional rule added (e.g. .min(5) ) will return a new schema object.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👍 from me for the enhancement in general.
If accepted, this should probably be an option rather than default behavior, until the next major release.
The same could apply to
||
as well?If @Standard8 doesn’t have the time to work on this, I would be happy to!