Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.3.2&fileType=.tsx&code=GYVwdgxgLglg9mABHATjA5jMBDANgCmwC5EAjOOXAU2zABoyTzKb7EImLraBKRAbwBQidggDOLAHS446fIUQAfRWT4BeDYigoQVRADJ97HoIC%2BgwaEiwEiYDAAeVACaFOLWg1LvubDmS5WPiERCHEpGTlsJRVSAyMIE1MgA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tiacTJTIAhtEK0ARhw5IhTWo3yJoQ%2BLTIcAtsRGJ0UAO4imkcGAC%2BIM0A&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eFYDAruuGAL4g9A&tokens=false
Repro Code
function original(a: boolean, b: boolean, c: boolean) {
console.log((a || b) === true && c)
}
function fixed(a: boolean, b: boolean, c: boolean) {
console.log(a || b && c)
}
ESLint Config
module.exports = {
"rules": {
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn"
}
}
tsconfig
Expected Result
I expect that the code should fix to (a || b) && c
Actual Result
The code fixed to a || b && c
Additional Info
Related to #3783
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.3.2&fileType=.tsx&code=GYVwdgxgLglg9mABHATjA5jMBDANgCmwC5EAjOOXAU2zABoyTzKb7EImLraBKRAbwBQidggDOLAHS446fIUQAfRWT4BeDYigoQVRADJ97HoIC%2BgwaEiwEiYDAAeVACaFOLWg1LvubDmS5WPiERCHEpGTlsJRVSAyMIE1MgA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tiacTJTIAhtEK0ARhw5IhTWo3yJoQ%2BLTIcAtsRGJ0UAO4imkcGAC%2BIM0A&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eFYDAruuGAL4g9A&tokens=false
Repro Code
ESLint Config
tsconfig
{ "compilerOptions": { "strict": true } }Expected Result
I expect that the code should fix to
(a || b) && cActual Result
The code fixed to
a || b && cAdditional Info
Related to #3783