Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 1.66 KB

File metadata and controls

55 lines (42 loc) · 1.66 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.

Peer dependencies

This preset requires typescript itself and typescript-eslint to generate type information, in addition to eslint and the base preset peer dependencies.

npm install --save-dev typescript typescript-eslint
yarn add --dev typescript typescript-eslint
pnpm add --save-dev typescript typescript-eslint

Usage

Import the preset in your eslint.config.js file and extend it, after the base preset:

import * as base from '@masterworks/eslint-config-masterworks/base/index.js'
import * as typescript from '@masterworks/eslint-config-masterworks/typescript/index.js'

export default [
  {
    ignores: [
      // Files to ignore globally.
    ],
  },
  base.apply({
    // ...
  }),
  typescript.apply({
    // By default it includes all TypeScript files. You rarely need to update it.
    // The following are the defaults.
    // files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.tsx'],

    // This setting is required to resolve the correct tsconfig.json file.
    // In this case we are assuming it is right next to the ESLint configuration file.
    tsconfigRootDir: import.meta.url,
    rules: {
      // Here you can customize or disable rules.
    },
  }),
]