@mels/eslint-config-typescript

1.0.1 • Public • Published


Toolkit
@mels/eslint-config-typescript

Shareable ESLint config for TypeScript projects.

npm (scoped) Twitter Follow

InstallHow To UseHelpful LinksCreditsLicense

Features

This package contains all my TypeScript rules as an extensible shared ESLint config. It also disables ESLint rules which are already handled by TypeScript.

Install

With npm:

npm install @mels/eslint-config-typescript --save-dev

With yarn:

yarn add @mels/eslint-config-typescript --dev

How To Use

The only config option that is required is parserOptions.project, because this config uses rules which require type information.

// .eslintrc.js
module.exports = {
  extends: ['@mels/base', '@mels/typescript'],
  parserOptions: {
    project: './tsconfig.json', // Set the path to the project tsconfig. This is required.
  },
};

Additional config options for @typescript-eslint/parser and eslint-import-resolver-typescript should be structured like so:

// .eslintrc.js
module.exports = {
  extends: ['@mels/base', '@mels/typescript'],

  // Config options for `@typescript-eslint/parser` should go under `parserOptions`
  // Please see: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#configuration
  parserOptions: {
    project: './tsconfig.json',
    tsconfigRootDir: __dirname, // root directory for relative tsconfig paths specified in the project option above
    // ...etc
  },

  settings: {
    'import/resolver': {
      // Config options for `eslint-import-resolver-typescript`
      // Please see: https://github.com/import-js/eslint-import-resolver-typescript#configuration
      typescript: {
        project: './tsconfig.eslint.json', // if different from default <root>/tsconfig.json
      },
    },
  },
};

Helpful Links

Credits

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @mels/eslint-config-typescript

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

17.8 kB

Total Files

6

Last publish

Collaborators

  • melanieseltzer