Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.62 KB

File metadata and controls

47 lines (34 loc) · 1.62 KB

@masterworks/eslint-config-masterworks/typescript

Base TypeScript rules. Replaces some of @masterworks/eslint-config-masterworks/base rules that are incompatible with TypeScript.

It also enables some check that are not possible without TypeScript but are unrelated to the type system itself.

Use @masterworks/eslint-config-masterworks/typescript-strict to expand TypeScript's checks.

Selectively targeting TypeScript files

Ideally, TypeScript-specific presets should be enabled only for TypeScript files; use ESLint overrides feature to achieve it:

{
  [...]
  "overrides": [
    {
      "files": ["*.ts", "*.tsx", "*.d.ts"],
      "extends": [
        "@masterworks/eslint-config-masterworks/typescript",
        "@masterworks/eslint-config-masterworks/typescript-strict",
        "@masterworks/eslint-config-masterworks/typescript-stylish"
      ]
    }
  ]
  [...]
}

Peer dependencies

This present requires typescript itself and the @typescript-eslint/parser to generate type information.

npm install --save-dev eslint typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser
yarn add --dev eslint typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser
pnpm install --save-dev eslint typescript @typescript-eslint/eslint-plugin @typescript-eslint/parser

This preset also assumes @masterworks/eslint-config-masterworks/base has been extended already and its peer dependencies are installed as well.