@mels/eslint-config-typescript
v1.0.1
Published
Shareable TypeScript ESLint config.
Downloads
12
Readme
✨ 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
- Monorepo configuration help
- @typescript-eslint/parser config options
- eslint-import-resolver-typescript config options
Credits
- Toolkit logo by Creatype from www.flaticon.com
License
MIT