Overview
@typescript-eslint/eslint-plugin includes over 100 rules that detect best practice violations, bugs, and/or stylistic issues specifically for TypeScript code. All of our rules are listed below.
tip
Instead of enabling rules one by one, we recommend using one of our pre-defined configs to enable a large set of recommended rules.
Rulesβ
The rules are listed in alphabetical order. You can optionally filter them based on these categories:
Config Group (βοΈ)
Metadata
(These categories are explained in more detail below.)
| Rule | βοΈ | π§ | π | π§± | π | 
|---|---|---|---|---|---|
| Require that function overload signatures be consecutive | π¨ | ||||
| Require consistently using either T[]orArray<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 | π¨ | π§ | |||
| Enforce that literals on classes are exposed in a consistent style | π¨ | π‘ | |||
| Enforce that class methods utilize this | π§± | ||||
| Enforce specifying generic type arguments on type annotation or constructor name of a constructor call | π¨ | π§ | |||
| Require or disallow the Recordtype | π¨ | π§ π‘ | |||
| Require returnstatements to either always or never specify values | π | π§± | |||
| Enforce consistent usage of type assertions | π¨ | π§ π‘ | |||
| Enforce type definitions to consistently use either interfaceortype | π¨ | π§ | |||
| Enforce consistent usage of type exports | π§ | π | |||
| Enforce consistent usage of type imports | π§ | ||||
| Enforce default parameters to be last | π§± | ||||
| Enforce dot notation whenever possible | π¨ | π§ | π | π§± | |
| 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 or disallow initialization in variable declarations | π§± | ||||
| Enforce a maximum number of parameters in function definitions | π§± | ||||
| Require a consistent member declaration order | |||||
| Enforce using a particular method signature syntax | π§ | ||||
| Enforce naming conventions for everything across a codebase | π | ||||
| Disallow generic Arrayconstructors | β | π§ | π§± | ||
| Disallow using the deleteoperator on array values | β | π‘ | π | ||
| Require .toString()and.toLocaleString()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 using code marked as @deprecated | π | π | |||
| Disallow duplicate class members | π§± | ||||
| Disallow duplicate enum member values | β | ||||
| Disallow duplicate constituents of union or intersection types | β | π§ | π | ||
| Disallow using the deleteoperator on computed key expressions | π | π§ | |||
| Disallow empty functions | π¨ | π‘ | π§± | ||
| Disallow the declaration of empty interfaces | π§ π‘ | π | |||
| Disallow accidentally using the "empty object" type | β | π‘ | |||
| Disallow the anytype | β | π§ π‘ | |||
| Disallow extra non-null assertions | β |