@futagoza/eslint-config-typescript
v16.1.0
Published
Futago-za Ryuu's ESLint configurations for TypeScript projects.
Downloads
2,105
Maintainers
Readme
This package contains configuration files for ESLint v7.15+
This is a configuration file for ESLint that is used to lint my TypeScript projects.
NOTE 1: This configuration will only check for @typescript-eslint/* rules, therefore it is recommended to also use @futagoza/eslint-config-javascript or something similar alongside this configuration.
NOTE 2: This configuration require's TypeScript, but the peerDependencies
field is set as "typescript": "*"
so that any version of TypeScript supported by the Typescript-ESLint project can be used.
installation
$ npm i --save-dev @futagoza/eslint-config-typescript
usage
Put the following into your configuration (.eslintrc.*
file or the "eslintConfig" field in package.json
):
{
"extends": "@futagoza/typescript"
}
configurations
A list of usable configurations as well the configurations they use:
@futagoza/typescript
(default, extends extension-rules)@futagoza/typescript/extension-rules
(extends eslint-overrides)@futagoza/typescript/eslint-overrides
The eslint-overrides configuration is tailored either to switch off or alter core ESLint rules so that @typescript-eslint/eslint-plugin can do it's job and no unnecessary checks are made. It is not recommended to use this directly!
tsconfig.json
@typescript-eslint/eslint-plugin requires a tsconfig.json
in the current working directory to function correctly, but I believe in zero-config, so what this configuration does is the following in order:
- Try to load
tsconfig.eslint.json
from the current working directory - Try to load
tsconfig.json
from the current working directory - Create and load a temporary
tsconfig.json
for the current working directory
If the third choice is reached, this configuration will create a temporary tsconfig.json
(based on the built-in tsconfig.default.json
) in the user's temporary directory with path's linked to the current working directory so that it functions like a normal tsconfig.json
(albeit slightly opinionated). This is a great alternative to the createDeafultProgram
option provided by @typescript-eslint/eslint-plugin as it can have performance issues (e.g. I've had VS Code slow down).
license
Copyright © 2019+ Futago-za Ryuu Released under the MIT License, http://opensource.org/licenses/MIT