Skip to content

typescript-eslint

103 rules typescript-eslint@8.70.1

Complete effective rule inventory.

Docs

Rules

23 rules on this page · 103 total

  • @typescript-eslint/prefer-includes

    Enforce includes method over indexOf method

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    Autofix available
  • @typescript-eslint/prefer-literal-enum-member

    Require all enum members to be literal values

    : error in All typescript-eslint contexts
    No autofix
  • @typescript-eslint/prefer-namespace-keyword

    Require using namespace keyword over module keyword to declare custom TypeScript modules

    : error in All typescript-eslint contexts
    Autofix available
  • @typescript-eslint/prefer-nullish-coalescing

    Enforce using the nullish coalescing operator instead of logical assignments or chaining

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix; suggestions available
  • @typescript-eslint/prefer-optional-chain

    Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    Autofix available; suggestions available
  • @typescript-eslint/prefer-promise-reject-errors

    Require using Error objects as Promise rejection reasons

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix
  • @typescript-eslint/prefer-readonly

    Require private members to be marked as readonly if they're never modified outside of the constructor

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    Autofix available
  • @typescript-eslint/prefer-reduce-type-parameter

    Enforce using type parameter when calling Array#reduce instead of using a type assertion

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    Autofix available
  • @typescript-eslint/prefer-regexp-exec

    Enforce RegExp#exec over String#match if no global flag is provided

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    Autofix available
  • @typescript-eslint/prefer-return-this-type

    Enforce that this is used when only this type is returned

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    Autofix available
  • @typescript-eslint/prefer-string-starts-ends-with

    Enforce using String#startsWith and String#endsWith over other equivalent methods of checking substrings

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    Autofix available
  • @typescript-eslint/related-getter-setter-pairs

    Enforce that get() types should be assignable to their equivalent set() type

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix
  • @typescript-eslint/require-array-sort-compare

    Require Array#sort and Array#toSorted calls to always provide a compareFunction

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix
  • @typescript-eslint/require-await

    Disallow async functions which do not return promises and have no await expression

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, Design-system React source
    No autofix; suggestions available
  • @typescript-eslint/restrict-plus-operands

    Require both operands of addition to be the same type and be bigint, number, or string

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix
  • @typescript-eslint/restrict-template-expressions

    Enforce template literal expressions to be of string type

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix
  • @typescript-eslint/return-await

    Enforce consistent awaiting of returned promises

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    Autofix available; suggestions available
  • @typescript-eslint/strict-void-return

    Disallow passing a value-returning function in a position accepting a void function

    : warning in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix; suggestions available
  • @typescript-eslint/switch-exhaustiveness-check

    Require switch-case statements to be exhaustive

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix; suggestions available
  • @typescript-eslint/triple-slash-reference

    Disallow certain triple slash directives in favor of ES6-style import declarations

    : error in All typescript-eslint contexts
    No autofix
  • @typescript-eslint/unbound-method

    Enforce unbound methods are called with their expected scope

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix
  • @typescript-eslint/unified-signatures

    Disallow two overloads that could be unified into one with a union or an optional/rest parameter

    : error in All typescript-eslint contexts
    No autofix
  • @typescript-eslint/use-unknown-in-catch-callback-variable

    Enforce typing arguments in Promise rejection callbacks as unknown

    : error in TypeScript source, React source, JavaScript source, React JavaScript source, TypeScript tests, Bun tests, Playwright end-to-end tests, Design-system React source
    No autofix; suggestions available