-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
declare const a: string | true | undefined;
declare const b: string | boolean | undefined;
const x = Boolean(a ? a : b);ESLint Config
module.exports = {
"rules": {
"@typescript-eslint/prefer-nullish-coalescing": [
"warn",
{
"ignoreBooleanCoercion": true
}
]
}
}tsconfig
Expected Result
ternary should be reported
Actual Result
ternary is not reported
Additional Info
The motivation for ignoreBooleanCoercion was that it's helpful sometimes to write Boolean(a || b || c || d) rather than being forced into Boolean(a) || Boolean(b) || Boolean(c) || Boolean(d) (see #9080). I don't think that that is true of Boolean(a ? a : b ? b : c ? c : d)
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
{ "compilerOptions": { "strictNullChecks": true } }