-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
fix: user errorissue was fixed by correcting the configuration / correcting the codeissue was fixed by correcting the configuration / correcting the codepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
My proposal is suitable for this project
- My proposal specifically checks TypeScript syntax, or it proposes a check that requires type information to be accurate.
- My proposal is not a "formatting rule"; meaning it does not just enforce how code is formatted (whitespace, brace placement, etc).
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
Please close if this is considered a formatting rule or if this has to much overlap with no-unnecessary-condition.
Fail Cases
if (foo == true) {}
if (foo != false) {}
if (!!foo) {}
declare const foo: boolean; if (foo === true) {}
declare const foo: []; if (foo.length !== 0) {}
declare const foo: true | 'bar' | undefined; if (foo !== undefined) {}
/* --- */
if (foo != true) {}
if (foo == false) {}
if (!!!foo) {}
declare const foo: boolean; if (foo === false) {}
declare const foo: []; if (foo.length === 0) {}
declare const foo: true | 'bar' | undefined; if (foo == undefined) {}
/* --- */
const x = foo == true
const x = foo == false
const x = !!!foo
// …Pass Cases
if (foo) {}
if (foo) {}
if (foo) {}
declare const foo: boolean; if (foo) {}
declare const foo: []; if (foo.length) {}
declare const foo: true | 'bar' | undefined; if (foo) {}
/* --- */
if (!foo) {}
if (!foo) {}
if (!foo) {}
declare const foo: boolean; if (!foo) {}
declare const foo: []; if (!foo.length) {}
declare const foo: true | 'bar' | undefined; if (!foo) {}
/* --- */
const x = !!foo
const x = !foo
const x = !fooAdditional Info
No response
Metadata
Metadata
Assignees
Labels
fix: user errorissue was fixed by correcting the configuration / correcting the codeissue was fixed by correcting the configuration / correcting the codepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin