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