Add autofix to `no-negated-condition`
See original GitHub issueSorry for ignoring the template but nothing applied as this doesn’t actually change the behavior.
Can no-negated-condition
be autofixable? It seems “relatively easy” to swap the blocks:
if (!foo) {
alert('❌')
} else {
alert('✅')
}
if (foo) {
alert('✅')
} else {
alert('❌')
}
Keywords: autofixed auto fix fixed fixable
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (7 by maintainers)
Top Results From Across the Web
no-negated-condition - Pluggable JavaScript Linter - ESLint
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >ESLint v1.6.0 released - ESLint中文文档
ESLint v1.6.0 introduces several more autofixing rules to use with the --fix command line ... New: no-negated-condition rule (fixes #3740) (alberto) ...
Read more >tslint-eslint-rules - npm Package Health Analysis | Snyk
{ "extends": [ "tslint-eslint-rules" ], "rules": { "no-constant-condition": true } }. You can also extend other tslint config packages to combine this ...
Read more >Basic Usage — Credo v1.6.7 - HexDocs
Refactoring opportunities ┃ ┃ [F] ↗ Avoid negated conditions in ... To find out more about the issue, just append its location to...
Read more >Ask Question - Stack Overflow
Well according to this page, this rule is discouraged as modern TypeScript does not use it and is slow to compute.
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’d support a suggestion for this. Perhaps suggestions should be exempt from the stylistic rule freeze:
I think it makes sense to provide this fix as a suggestion, but given that stylistic rules are frozen, I’m not in favor of adding any new features to
no-negated-condition
since it is a stylistic rule.