Rule proposal: Simplifying booleanish checks
Author: abrahamguoCreated Sep 9, 2026Updated Sep 14, 2026
Labelspackage: eslint-pluginenhancement: new plugin ruleevaluating community engagement
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.
- If I used AI assistance to prepare this issue, I have reviewed and followed the AI Contribution Policy.
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
I have a local ESLint rule that flags and simplifies all of the following things, and has been useful for me. I'm curious whether you guys would be interested in accepting any parts of this as one, or multiple, rules!
<string/number/bigint> == <literal falsy of that primitive><nonprimitive | nullish> == null/undefined<literalUnion> == <single falsy, or single truthy of literal union>===when using==would not cause any coercion<array>.length == 0!!in the return value of afind/filter/etc.
Fail Cases
declare const str: string;
declare const num: number;
declare const arr: { complete: boolean; valid: boolean }[] | null;
declare const type: 'major' | 'minor' | undefined;
str == '';
num != 0;
type != undefined;
str === 'Alice';
if (arr != null) {
arr.length > 0 ? 'filled' : 'empty';
arr.find(x => x.complete && !!x.valid);
}Pass Cases
declare const str: string;
declare const num: number;
declare const arr: { complete: boolean; valid: boolean }[] | null;
declare const type: 'major' | 'minor' | undefined;
!str; // 1
!!num; // 1
!!type; // 3
str == 'Alice'; // 4
if (!!arr /* 2 */) {
!!arr.length ? 'filled' : 'empty'; // 5
arr.find(x => x.complete && x.valid); // 6
}Additional Info
No response
Source: typescript-eslint/typescript-eslint