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.
const a = x === 2 ? true : false;
const b = x ? true : false;const a = x === 2 ? "Yes" : "No";
const b = x !== false;
const c = x ? "Yes" : "No";
const d = x ? y : x;
f(x ? x : 1); // default assignment - would be disallowed if defaultAssignment option set to false. See option details below.Popular · 1 of 50
Disallow ternary operators when simpler alternatives exist
const a = x === 2 ? true : false;
const b = x ? true : false;const a = x === 2 ? "Yes" : "No";
const b = x !== false;
const c = x ? "Yes" : "No";
const d = x ? y : x;
f(x ? x : 1); // default assignment - would be disallowed if defaultAssignment option set to false. See option details below.