eslint-config-standard-with-typescript
An ESLint shareable config for TypeScript that is based on eslint-config-standard and has TypeScript specific rules from @typescript-eslint/eslint-plugin.
Usage
npm install --save-dev eslint@7 eslint-plugin-standard@4 eslint-plugin-promise@4 eslint-plugin-import@2 eslint-plugin-node@11 @typescript-eslint/eslint-plugin@2 eslint-config-standard-with-typescript
Yes, this is a large number of packages. This is due to a known limitation in ESLint.
This long list of dependencies includes:
- ESLint
- Peer dependencies of eslint-config-standard
- @typescript-eslint/eslint-plugin; ESLint rules for TypeScript.
Here is an example .eslintrc.js
:
module.exports = {
extends: 'standard-with-typescript',
parserOptions: {
project: './tsconfig.json'
}
}
Note: Please read some important instructions regarding the project
option here.
There are some more parserOptions
you may care about.
If you're using ESLint v6 make sure you read about the --ext
command line option.
Example command line usage for ESLint v6:
$ npx eslint --ext .js,.ts .
Example command line usage for ESLint v7:
$ npx eslint .