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 | ⚙️ | 🔧 | 💭 | 🧱 | 💀 |
|---|---|---|---|---|---|
@typescript-eslint/adjacent-overload-signaturesRequire that function overload signatures be consecutive | 🎨 | ||||
@typescript-eslint/array-typeRequire consistently using either T[] or Array<T> for arrays | 🎨 | 🔧 | |||
@typescript-eslint/await-thenableDisallow awaiting a value that is not a Thenable | ✅ | 💡 | 💭 | ||
@typescript-eslint/ban-ts-commentDisallow @ts-<directive> comments or require descriptions after directives | ✅ | 💡 | |||
@typescript-eslint/ban-tslint-commentDisallow // tslint:<rule-flag> comments | 🎨 | 🔧 | |||
@typescript-eslint/ban-typesDisallow certain types | ✅ | 🔧 💡 | |||
@typescript-eslint/class-literal-property-styleEnforce that literals on classes are exposed in a consistent style | 🎨 | 💡 | |||
@typescript-eslint/class-methods-use-thisEnforce that class methods utilize this | 🧱 | ||||
@typescript-eslint/consistent-generic-constructorsEnforce specifying generic type arguments on type annotation or constructor name of a constructor call | 🎨 | 🔧 | |||
@typescript-eslint/consistent-indexed-object-styleRequire or disallow the Record type | 🎨 | 🔧 | |||
@typescript-eslint/consistent-returnRequire return statements to either always or never specify values | 💭 | 🧱 | |||
@typescript-eslint/consistent-type-assertionsEnforce consistent usage of type assertions | 🎨 | 🔧 💡 | |||
@typescript-eslint/consistent-type-definitionsEnforce type definitions to consistently use either interface or type | 🎨 | 🔧 | |||
@typescript-eslint/consistent-type-exportsEnforce consistent usage of type exports | 🔧 | 💭 | |||
@typescript-eslint/consistent-type-importsEnforce consistent usage of type imports | 🔧 | ||||
@typescript-eslint/default-param-lastEnforce default parameters to be last | 🧱 | ||||
@typescript-eslint/dot-notationEnforce dot notation whenever possible | 🎨 | 🔧 | 💭 | 🧱 | |
@typescript-eslint/explicit-function-return-typeRequire explicit return types on functions and class methods | |||||
@typescript-eslint/explicit-member-accessibilityRequire explicit accessibility modifiers on class properties and methods | 🔧 💡 | ||||
@typescript-eslint/explicit-module-boundary-typesRequire explicit return and argument types on exported functions' and classes' public class methods | |||||
@typescript-eslint/init-declarationsRequire or disallow initialization in variable declarations | 🧱 | ||||
@typescript-eslint/max-paramsEnforce a maximum number of parameters in function definitions |