question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule change: no-extra-boolean-cast should catch more cases

See original GitHub issue

What rule do you want to change?

no-extra-boolean-cast

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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
mdjermanoviccommented, Aug 21, 2019

👍 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?

1reaction
jmoore914commented, Dec 29, 2019

If @Standard8 doesn’t have the time to work on this, I would be happy to!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found