This configuration focuses specifically on code quality based rules for TypeScript, rather than formatting rules. We utilize Prettier for code formatting (see prettier-config-fueled-node).
Note: this is intended to be used with TypeScript strict mode enabled, and Prettier installed.
TBD
TBD
ESLint rules extend upon @typescript-eslint/recommended, as well as Prettier ESLint config to turn off rules that may conflict with Prettier. Overriding rules are listed below.
-
@typescript-eslint/array-type Enforce T[] syntax for arrays over Array.
-
@typescript-eslint/explicit-function-return-type Enforce explicit function return types.
-
@typescript-eslint/explicit-module-boundary-types Enforce explicit return & argument types on exported functions & public class methods.
-
@typescript-eslint/no-explicit-any Disallow explicit
any
types. Useunknown
instead. -
@typescript-eslint/no-floating-promises Require Promise-like statements to be handled appropriately.
-
@typescript-eslint/no-non-null-assertion Disable using non-null assertions as they cancel the benefits of strict null-checking mode. Prefer explicit null checks for safety.
-
no-restricted-syntax Restrict use of labels and with statements.
-
@typescript-eslint/no-unnecessary-condition Avoid unnecessary conditionals.
-
@typescript-eslint/no-unnecessary-type-assertion Warn against unnecessary type assertions.
-
@typescript-eslint/no-unused-vars Enforce no unused variables.
-
@typescript-eslint/no-useless-constructor Warn against useless class constructors.
-
@typescript-eslint/prefer-nullish-coalescing Prefer nullish coalescing operator.
-
@typescript-eslint/prefer-optional-chain Prefer optional chaining operator.
-
@typescript-eslint/restrict-template-expressions Restrict template expressions to allow for string & number types only. Other types must be checked explicitly.
-
@typescript-eslint/require-await Disallow async functions which have no await expression and do not return a promise.
-
@typescript-eslint/switch-exhaustiveness-check Enforce covering all cases in a switch statement.