Include more operators in `no-mixed-operators`’s default config (by ESLint 8?)
See original GitHub issueWhat rule do you want to change?
no-mixed-operators
:
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
Please provide some example code that this change will affect:
a || b === c
a ?? b === c
What does the rule currently do for this code?
No error, unless configured.
What will the rule do after it’s changed?
Suggest a fix:
a || (b === c)
a ?? (b === c)
Are you willing to submit a pull request to implement this change?
Possibly
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Configuration Files - 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 >Configuring ESLint - 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 >Rules - ESLint - Pluggable JavaScript Linter
The "extends": "eslint:recommended" property in a configuration file ... Disallow assignment operators in conditional expressions ... default-param-last.
Read more >Configuration Files (New) - ESLint - Pluggable JavaScript Linter
You can put your ESLint project configuration in a configuration file. You can include built-in rules, how you want them enforced, plugins with...
Read more >ESLint's new config system, Part 2: Introduction to flat config
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
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
I can’t say I understand why the operators are grouped the way they are, but it does seem intentional and your config does seem to be the correct way to override the default.
I didn’t say it’s a bug, it just said it would be helpful to enable more warnings. Since it’s a new operator, it’s not clear what the result of
a ?? b === c
would be.Intentional how? It just allows more operators being mixed. 🤷♂️ It’s as “intentional” as the lack of a rule. The operator did not exist when the rule was written.
That’s unfortunate, it would be a simple change to bring in v8, hence the issue title.