@pascaliske/eslint-config
v3.0.1
Published
Shared ESLint config for TypeScript projects.
Downloads
244
Maintainers
Readme
Shared ESLint config
Installation
To install the config use the following command:
yarn add @pascaliske/eslint-config --dev
For TypeScript projects you will also need the following peer dependencies:
yarn add eslint @typescript-eslint/{parser,eslint-plugin} --dev
For Angular projects you will also need the following peer dependencies:
yarn add eslint @typescript-eslint/{parser,eslint-plugin} @angular-eslint/{template-parser,eslint-plugin,eslint-plugin-template} --dev
Usage
There are three possible types of configurations available: base
(only JS), typescript
(JS + TS) and angular
(JS + TS + Angular specifics). You can reference those by adding a suffix to the extends value in your config file (e.g. @pascaliske/eslint-config/angular
). The base
configuration will be used as default when the suffix is missing.
.eslintrc
{
"root": true,
"extends": "@pascaliske/eslint-config/base", // or typescript / angular
"env": {
"browser": true
}
}
For usage in Node.js projects you can also enable the Node.js environment instead:
.eslintrc
{
"root": true,
"extends": "@pascaliske/eslint-config/base", // or typescript / angular
"env": {
"node": true
}
}
For usage in TypeScript and Angular projects you have to use a JS based config file and explicitly set parser options with a tsconfig.json
-file:
.eslintrc.js
module.exports = {
root: true,
extends: "@pascaliske/eslint-config/typescript", // or angular
parserOptions: {
project: `${__dirname}/tsconfig.json`,
createDefaultProgram: true,
},
env: {
node: true,
},
}
For more information on environments visit the ESLint documentation.
License
MIT © 2022 Pascal Iske