Skip to main content


@typescript-eslint/eslint-plugin includes over 100 rules that detect best practice violations, bugs, and/or stylistic issues specifically for TypeScript code. See Configs for how to enable recommended rules using configs.

Supported Rules

Config Group
Require that function overload signatures be consecutive
Require consistently using either T[] or Array<T> for arrays
Disallow awaiting a value that is not a Thenable
Disallow @ts-<directive> comments or require descriptions after directives
Disallow // tslint:<rule-flag> comments
Disallow certain types
🔧 💡
Enforce that literals on classes are exposed in a consistent style
🎨 💡
Enforce specifying generic type arguments on type annotation or constructor name of a constructor call
Require or disallow the Record type
Enforce consistent usage of type assertions
🎨🔧 💡
Enforce type definitions to consistently use either interface or type
Enforce consistent usage of type exports
🔧 💭
Enforce consistent usage of type imports
Require explicit return types on functions and class methods
Require explicit accessibility modifiers on class properties and methods
🔧 💡
Require explicit return and argument types on exported functions' and classes' public class methods
Require a specific member delimiter style for interfaces and type literals
Require a consistent member declaration order
Enforce using a particular method signature syntax
Enforce naming conventions for everything across a codebase
Require .toString() to only be called on objects which provide useful information when stringified
Disallow non-null assertion in locations that may be confusing
🎨🔧 💡
Require expressions of type void to appear in statement position
🔒🔧 💡💭
Disallow duplicate enum member values
Disallow duplicate constituents of union or intersection types
🔧 💭
Disallow using the delete operator on computed key expressions
Disallow the declaration of empty interfaces
🎨🔧 💡
Disallow the any type
🔧 💡
Disallow extra non-null assertions
Disallow classes used as namespaces
Require Promise-like statements to be handled appropriately
Disallow iterating over an array with a for-in loop
Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean
Disallow void type outside of generic or return types
Disallow the void operator except when used to discard a value
🔒🔧 💡💭
Enforce valid definition of new and constructor
Disallow Promises in places not designed to handle them
Disallow enums from having both number and string members
🔒 💭
Disallow TypeScript namespaces
Disallow non-null assertions in the left operand of a nullish coalescing operator
🔒 💡
Disallow non-null assertions after an optional chain expression
Disallow non-null assertions using the ! postfix operator
🔒 💡
Disallow members of unions and intersections that do nothing or override type information
Disallow invocation of require()
Disallow aliasing this
Disallow type aliases
Disallow unnecessary equality comparisons against boolean literals
🔒🔧 💭
Disallow conditionals where the type is always truthy or always falsy
🔒🔧 💭
Disallow unnecessary namespace qualifiers
🔧 💭
Disallow type arguments that are equal to the default
🔒🔧 💭
Disallow type assertions that do not change the type of an expression
🔧 💭
Disallow unnecessary constraints on generic types
Disallow calling a function with a value with type any
Disallow assigning a value with type any to variables and properties
Disallow calling a value with type any
Disallow unsafe declaration merging
Disallow comparing an enum value with a non-enum value
Disallow member access on a value with type any
Disallow returning a value with type any from a function
Disallow empty exports that don't change anything in a module file
Disallow require statements except in import statements
Enforce non-null assertions over explicit type casts
🎨🔧 💭
Require or disallow parameter properties in class constructors
Enforce the use of as const over literal type
🔧 💡
Require each enum member value to be explicitly initialized
Enforce the use of for-of loop over the standard for loop where possible
Enforce using function types instead of interfaces with call signatures
Enforce includes method over indexOf method
🔒🔧 💭
Require all enum members to be literal values
Require using namespace keyword over module keyword to declare custom TypeScript modules
Enforce using the nullish coalescing operator instead of logical assignments or chaining
🎨 💡💭
Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects
🎨🔧 💡💭
Require private members to be marked as readonly if they're never modified outside of the constructor
🔧 💭
Require function parameters to be typed as readonly to prevent accidental mutation of inputs
Enforce using type parameter when calling Array#reduce instead of casting
🔒🔧 💭
Enforce RegExp#exec over String#match if no global flag is provided
🔧 💭
Enforce that this is used when only this type is returned
🔒🔧 💭
Enforce using String#startsWith and String#endsWith over other equivalent methods of checking substrings
🎨🔧 💭
Enforce using @ts-expect-error over @ts-ignore
Require any function or method that returns a Promise to be marked async
🔧 💭
Require Array#sort calls to always provide a compareFunction
Require both operands of addition to be the same type and be bigint, number, or string
Enforce template literal expressions to be of string type
Enforce constituents of a type union/intersection to be sorted alphabetically
🔧 💡
Disallow certain types in boolean expressions
🔧 💡💭
Require switch-case statements to be exhaustive with union type
Disallow certain triple slash directives in favor of ES6-style import declarations
Require consistent spacing around type annotations
Require type annotations in certain places
Enforce unbound methods are called with their expected scope
Disallow two overloads that could be unified into one with a union or an optional/rest parameter

Extension Rules

In some cases, ESLint provides a rule itself, but it doesn't support TypeScript syntax; either it crashes, or it ignores the syntax, or it falsely reports against it. In these cases, we create what we call an extension rule; a rule within our plugin that has the same functionality, but also supports TypeScript.

Config Group
Disallow or enforce spaces inside of blocks after opening block and before closing block
Enforce consistent brace style for blocks
Require or disallow trailing commas
Enforce consistent spacing before and after commas
Enforce default parameters to be last
Enforce dot notation whenever possible
🎨🔧 💭
Require or disallow spacing between function identifiers and their invocations
Enforce consistent indentation
Require or disallow initialization in variable declarations
Enforce consistent spacing between property names and type annotations in types and interfaces
Enforce consistent spacing before and after keywords
Require empty lines around comments
Require or disallow an empty line between class members
Disallow generic Array constructors
Disallow duplicate class members
Disallow empty functions
Disallow unnecessary parentheses
Disallow unnecessary semicolons
Disallow the use of eval()-like methods
Disallow this keywords outside of classes or class-like objects
Disallow function declarations that contain unsafe references inside loop statements
Disallow literal numbers that lose precision
Disallow magic numbers
Disallow variable redeclaration
Disallow specified modules when loaded by import
Disallow variable declarations from shadowing variables declared in the outer scope
Disallow throwing literals as exceptions
🔒 💭
Disallow unused expressions
Disallow unused variables
Disallow the use of variables before they are defined
Disallow unnecessary constructors
Enforce consistent spacing inside braces
Require or disallow padding lines between statements
Enforce the consistent use of either backticks, double, or single quotes
Disallow async functions which have no await expression
Enforce consistent returning of awaited values
🔧 💡💭
Require or disallow semicolons instead of ASI
Enforce consistent spacing before blocks
Enforce consistent spacing before function parenthesis
Require spacing around infix operators