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.
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"
]
}
]
[...]
}
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.