Rules
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
declare const a: string | null;
declare const b: string | null;
const c = a || b;
declare let foo: { a: string } | null;
declare function makeFoo(): { a: string };
function lazyInitializeFooByTruthiness() {
if (!foo) {
foo = makeFoo();
}
}
function lazyInitializeFooByNullCheck() {
if (foo == null) {
foo = makeFoo();
}
}declare const a: string | null;
declare const b: string | null;
const c = a ?? b;
declare let foo: { a: string } | null;
declare function makeFoo(): { a: string };
function lazyInitializeFoo() {
foo ??= makeFoo();
}Popular · 1 of 15
Enforce using the nullish coalescing operator instead of logical assignments or chaining
declare const a: string | null;
declare const b: string | null;
const c = a || b;
declare let foo: { a: string } | null;
declare function makeFoo(): { a: string };
function lazyInitializeFooByTruthiness() {
if (!foo) {
foo = makeFoo();
}
}
function lazyInitializeFooByNullCheck() {
if (foo == null) {
foo = makeFoo();
}
}declare const a: string | null;
declare const b: string | null;
const c = a ?? b;
declare let foo: { a: string } | null;
declare function makeFoo(): { a: string };
function lazyInitializeFoo() {
foo ??= makeFoo();
}