Core
Generic ESLint-compatible rules that apply to both JavaScript and TypeScript source. Every rule listed here corresponds 1-to-1 with an ESLint core rule of the same kebab-case id, so projects migrating from ESLint can paste their rule severities into lint.config.ts without renaming anything. TypeScript-only rules and @typescript-eslint extensions live under typescript/* in TypeScript.
Source: ESLint core rules (MIT).
camelcase: Reject identifier declarations that aren’t camelCase or PascalCase, snake_case bindings are flagged.complexity: Reject function bodies whose cyclomatic complexity exceeds twenty (default ESLint threshold).curly: Require block statements for everyif,else,while,for, anddobody. Reject the single-statement shorthand.default-case: Requireswitchstatements to include adefaultclause so unhandled discriminants surface explicitly instead of silently falling through.default-case-last: Require thedefaultclause of aswitchstatement to appear last, so the fall-through path matches the visual order of the labels.consistent-return: Reject functions where somereturnstatements return a value and others fall through without one. Pick one shape so callers can rely on the return type.default-param-last: Reject(req, opt = 1, req2)and similar parameter lists where a required parameter follows an optional or default-valued one.dot-notation: Prefer dot access (obj.value) over bracket access (obj["value"]) when the string key is a valid JavaScript identifier.eqeqeq: Require strict equality operators===/!==over==/!=.for-direction: Rejectforstatements whose update clause moves the counter away from the termination condition, such asfor (let i = 0; i < 10; i--).getter-return: Require agetaccessor’s body to return a value on every reachable exit.grouped-accessor-pairs: Require thegetandsetaccessors of a single property to be declared adjacent in the class body so readers see the read/write pair together.guard-for-in: Requirefor (key in obj)bodies to immediately guard against inherited keys withObject.hasOwn(obj, key)orObject.prototype.hasOwnProperty.call(obj, key), so the loop body never silently processes a prototype-chain entry.id-length: Reject identifier names shorter than two characters.init-declarations: Require everyvar/letdeclaration to be initialized at its declaration site.max-classes-per-file: Reject a source file that declares more than one class.max-depth: Reject block-statement nesting deeper than four levels inside a function.max-lines: Reject a source file whose total line count exceeds three hundred.max-lines-per-function: Reject a function whose body spans more than fifty lines.max-nested-callbacks: Reject callback nesting deeper than ten inside a single function.max-params: Reject function declarations whose parameter list grows beyond three, since long parameter lists usually want to be folded into an options object.max-statements: Reject function bodies whose statement count exceeds ten.no-alert: Reject calls toalert,confirm, andprompt.no-array-constructor: RejectArray(...)andnew Array(...)constructor calls in favor of array literals.no-async-promise-executor: Rejectnew Promise(async (resolve, reject) => { ... }).no-await-in-loop: Rejectawaitexpressions evaluated inside a loop body.no-bitwise: Reject bitwise operators (&,|,^,~,<<,>>,>>>).no-caller: Rejectarguments.callerandarguments.callee, both deprecated properties forbidden in strict mode.no-case-declarations: Reject lexical declarations (let,const,class,function) insidecaseordefaultclauses without their own block, since the declaration shares the wholeswitchscope and leaks into sibling clauses.no-class-assign: Reject reassigning a class binding (class C {}; C = ...).no-compare-neg-zero: Reject comparisons against-0(x === -0,x < -0, etc.).no-cond-assign: Reject assignment expressions inside conditions, such asif (x = y), almost always a typo for==/===.no-console: Reject calls toconsole.*.no-constant-condition: Reject conditions whose value can be determined statically, such aswhile (true)orif (false), inif,while,do/while,for, and ternary expressions.no-constructor-return: Rejectreturn X;(with a value) inside a class constructor.no-continue: Rejectcontinuestatements.no-control-regex: Reject ASCII control characters (\x00–\x1F) inside regular expression literals andRegExpstrings.no-debugger: Rejectdebuggerstatements.no-delete-var: Rejectdeleteapplied to plain variable bindings (delete x).no-dupe-args: Rejectfunction f(a, a)and similar parameter lists that declare the same name twice.no-dupe-class-members: Reject two declarations of the same member on a single class.no-dupe-else-if: Rejectif (a) {} else if (a) {}. The second branch is unreachable because the first condition already handled it.no-dupe-keys: Reject{ a: 1, a: 2 }, duplicate property keys in an object literal silently overwrite earlier values.no-duplicate-case: Reject the samecaselabel appearing twice in aswitch, later duplicates are unreachable.no-duplicate-imports: Reject two import declarations that resolve to the same module specifier.no-else-return: Reject anelseblock whose precedingifbranch already terminates control flow withreturn/throw/break/continue.no-empty: Reject empty blocks (if (x) {},while (x) {},try {} catch (e) {}etc.) that almost always indicate forgotten code.no-empty-character-class: Reject empty regex character classes ([]).no-empty-function: Reject empty function and method bodies (function f() {},() => {}).no-empty-named-blocks: Reject empty named import/export clauses (import {} from "x",import name, {} from "x",export {}), which bind nothing and either dead-load the module or restate module-ness redundantly.no-empty-pattern: Reject empty destructuring patterns (const {} = obj,function f([]) {}), which bind nothing and are usually mid-edit typos.no-empty-static-block: Reject emptystatic {}class initialization blocks.no-eq-null: Reject loose null comparisons (x == null).no-eval: Rejecteval(...)and indirectevalcalls, almost always a security or correctness bug.no-ex-assign: Reject reassigning the parameter of acatchclause (catch (e) { e = ... }), which loses the original error reference.no-extend-native: reject assignments to a built-in prototype such asArray.prototype.foo = bar.no-extra-bind: Reject unnecessaryFunction.prototype.bind()calls, for example, binding without arguments or binding an arrow function (which ignoresthis).no-extra-boolean-cast: Reject redundant boolean casts such as!!Boolean(x),if (Boolean(x)), orBoolean(!!x).no-fallthrough: Rejectswitchcase fall-through unless preceded by an explicit// falls throughcomment.no-func-assign: Reject reassignment of function declarations (function f() {}; f = 0;).no-implicit-coercion: Reject common implicit-coercion idioms (!!x,+x,"" + x) in favor of the explicitBoolean(x)/Number(x)/String(x)conversions.no-import-assign: Reject writes to a binding introduced by animportdeclaration, assignment, compound assignment, or++/--of an imported name, plus property mutations of a namespace import (ns.foo = ...).no-inner-declarations: Rejectfunctionandvardeclarations nested in non-function blocks (loops,if, etc.). They hoist in surprising ways.no-invalid-this: Rejectthisreferences outside any function-like, class method, or class-static-block context.no-irregular-whitespace: Reject irregular whitespace characters (zero-width space, non-breaking space, etc.) in source, typically copy-paste artifacts from rich-text editors.no-iterator: Reject the legacy__iterator__property, a SpiderMonkey-only extension predating ES2015 iterators.no-labels: Reject labeled statements (outer: for (...) { break outer; }).no-lone-blocks: Reject standalone{ ... }blocks that introduce no lexical scope distinct from the surrounding block.no-lonely-if: Rejectif (cond) { if (...) { ... } }where the innerifis the only statement in anelse. Preferelse if.no-loop-func: reject function declarations defined inside the body of a loop.no-loss-of-precision: Reject numeric literals whose source text cannot round-trip throughNumberwithout losing digits, including overflow.no-magic-numbers: Reject inline numeric literals outsideconstinitializer position.0,1,-1, array indices, and enum values are exempt.no-misleading-character-class: Reject regex character classes that contain combined Unicode sequences (e.g. Surrogate pairs) which most readers will not realize represent multiple code units.no-mixed-operators: Reject mixing operators of different precedence families (a && b || c,a | b && c) without explicit parentheses around the inner sub-expression.no-multi-assign: Reject chained assignment such asa = b = 0, which obscures intent and surprises readers who expect comparison.no-multi-str: Reject backslash-newline multiline string literals; use template literals instead.no-negated-condition: Rejectif (!cond) { ... } else { ... }. Flip the branches so the positive condition reads first.no-nested-ternary: Reject ternary expressions nested in other ternaries (a ? b : c ? d : e), which are hard to read at a glance.no-new: Rejectnewexpressions whose return value is not assigned or used. The object is created only for its constructor side effects.no-new-func: Rejectnew Function(...)andFunction(...)calls, which effectively evaluate a string and have the same risks aseval.no-new-symbol: Rejectnew Symbol(...).no-new-wrappers: Reject primitive wrapper constructorsnew String(...),new Number(...),new Boolean(...).no-obj-calls: Reject calling global non-callable objects as functions, such asMath()orJSON().no-object-constructor: Rejectnew Object()andObject()constructor calls; use an object literal{}instead.no-octal: Reject legacy octal literals (0123).no-octal-escape: Reject octal escape sequences in string literals ("\251","\07").no-param-reassign: reject reassigning a function parameter inside the body of the function it belongs to.no-plusplus: Reject++and--operators.no-promise-executor-return: Rejectreturninside the Promise executor function. The value is ignored.no-proto: Reject access toobj.__proto__; useObject.getPrototypeOf/Object.setPrototypeOf.no-prototype-builtins: Rejectobj.hasOwnProperty(key)and other directObject.prototypebuiltins on user objects, since the property may be shadowed.no-redeclare: reject declaring the same binding more than once in the same scope (var x = 1; var x = 2;, twofunction foo()declarations side by side, or a parameter rebound by a latervarin the body).no-regex-spaces: Reject more than one consecutive literal space in a regex; use{N}quantifiers for clarity.no-restricted-imports: Rejectimportdeclarations targeting any module specifier in the project denylist.no-restricted-syntax: Reject AST node kinds listed in the project denylist.no-return-assign: Reject assignment expressions used as the operand ofreturn(return x = 1), almost always a typo for===.no-script-url: Rejectjavascript:URLs in string literals, they execute their body as code on browser navigation, and security scanners treat them as anevalequivalent.no-self-assign: Rejectx = xand destructuring forms that copy a value to itself, almost always a typo.no-self-compare: Reject comparing a value to itself (x === x).no-sequences: Reject comma expressions (a, b) outside the heads offorstatements.no-setter-return: Reject explicitreturnfrom a setter, setters’ return values are ignored.no-shadow: Reject a nested scope binding (let,const,function, parameter) that shadows a same-name binding from an outer scope, so the reader can rely on a single identifier referring to a single declaration.no-shadow-restricted-names: Reject redeclaring restricted globals (NaN,Infinity,undefined, etc.).no-sparse-arrays: Reject array literals with elision ([, 1, , 3]), which read surprisingly and rarely express intent.no-template-curly-in-string: Reject${expr}inside ordinary single- or double-quoted strings, almost always a missing template-literal backtick.no-this-before-super: Rejectthis(orsuper.x) references that precede the firstsuper()call in a derived constructor.no-throw-literal: Reject throwing non-Error operands (throw "boom",throw 1).no-undef-init: Reject initializing a variable to the literalundefined(let x = undefined), declaring without an initializer has the same effect.no-undefined: Reject use of the globalundefinedidentifier; use thevoid 0expression or omit the value.no-unneeded-ternary: Rejectcond ? true : falseand similar ternaries that can be simplified to a boolean coercion or the condition itself.no-unreachable: reject statements that follow an unconditionalreturn,throw,break, orcontinuein the same block, control flow has already left the block, so any later statement is dead code.no-unsafe-finally: Rejectreturnandthrowinside afinallyblock, which override any earlierreturn/throwfrom the correspondingtry/catch.no-unsafe-negation: Reject!key in objand!a instanceof Bwhere the!binds tighter than the relational operator and silently coerces the left operand to a boolean.no-unsafe-optional-chaining: Reject member access or call expressions that chain off an optional chain without continuing the chain.no-unused-expressions: Reject expression statements with no observable effect, like a barex;or'use strict' && f();.no-unused-labels: Reject labels that nobreakorcontinuestatement references.no-useless-assignment: reject an assignment whose value is immediately overwritten by the very next statement without an intervening read of the same identifier.no-useless-call: Reject unnecessary.call()/.apply()calls (such asf.call(undefined, x)).no-useless-catch: Rejectcatch (e) { throw e }patterns that only rethrow the caught error without adding context or handling.no-useless-computed-key: Reject computed property keys whose expression is a literal identifier ({ ["foo"]: 1 }).no-useless-concat: Reject"a" + "b"and similar concatenations where every operand is a literal string.no-useless-constructor: Reject empty constructor bodies (class X { constructor() {} }) that add nothing over the implicit constructor.no-useless-escape: Reject unnecessary escape sequences in strings and regex literals, such as"\."or/\,/.no-useless-rename: Reject{ x: x }destructuring renames that bind back to the same name.no-useless-return: reject a barereturn;whose only effect is to end a function body that would have returned anyway.no-var: Rejectvardeclarations.no-with: Rejectwith (...)statements.object-shorthand: Reject{ foo: foo }and similar object-literal shorthand candidates in favor of{ foo }.operator-assignment: Prefer compound assignment (x += y) over the long form (x = x + y) where the two are equivalent.prefer-arrow-callback: Rejectfunction() { ... }expressions passed as callback arguments. Prefer the arrow form.prefer-const: Requireconstfor variables that are never reassigned after declaration.prefer-destructuring: Reject single-property and single-index variable declarations (const a = obj.a) that destructuring would replace verbatim.prefer-exponentiation-operator: Prefer the**operator overMath.pow(base, exp).prefer-for-of: Preferfor..ofover a traditionalfor (let i = 0; i < arr.length; i++)loop when the index is never used inside the body.prefer-named-capture-group: Reject regex literals with unnamed capturing groups(...). Prefer named groups(?<name>...).prefer-numeric-literals: Prefer ES2015+ numeric literal forms (0b…,0o…,0x…) overparseInt(string, 2 | 8 | 16).prefer-object-has-own: PreferObject.hasOwn(obj, key)overObject.prototype.hasOwnProperty.call(obj, key).prefer-object-spread: Prefer object-spread{ ...a, ...b }overObject.assign({}, a, b).prefer-rest-params: Reject reading fromargumentsin a non-arrow function body. Prefer the rest-parameter form(...args).prefer-spread: Prefer spread argumentsf(...args)overf.apply(null, args).prefer-template: Prefer template literals over string concatenation when any operand is non-literal.radix: Require an explicit radix argument forparseInt(str, radix).require-yield: Require generator functions to contain at least oneyield.sort-imports: Reject import specifiers within a singleimportdeclaration that aren’t alphabetically sorted.sort-keys: Reject object-literal property keys that aren’t alphabetically sorted.use-isnan: RequireNumber.isNaN/isNaNforNaNchecks; restricttypeofcomparisons to the documented strings.valid-typeof: Restrict the right-hand operand oftypeofto the documented strings ("number","object", …) sotypeof x === "undefiend"typos are caught.vars-on-top: Requirevardeclarations to be hoisted to the top of their scope by hand, mirroring how the engine treats them.yoda: Reject Yoda-style comparisons (if (42 === x)); useif (x === 42)so the variable comes first.
Last updated on