Tangany ESLint Config
Shareable config that is designed to work with the extends feature of .eslintrc files. Install the package via:
npm i -D @tangany/eslint-config@latest eslint-plugin-simple-import-sort eslint-plugin-import eslint-plugin-unused-imports
or
yarn add eslint @tangany/eslint-config@latest eslint-plugin-simple-import-sort eslint-plugin-import eslint-plugin-unused-imports -D
and add it as a dependency to your .eslintrc:
{
"extends": ["@tangany"]
}
Your file should look something like this:
.eslintrc.js
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.json",
sourceType: "module",
},
plugins: ["@typescript-eslint/eslint-plugin"],
extends: [
"plugin:@typescript-eslint/recommended",
"@tangany/eslint-config"
],
env: {
node: true,
jest: true,
},
rules: {}
};
Package scripts
You can add a script to your package.json
to run the linter, including between the curly braces the folders you want to be linted (or remove the curly braces if it's only one folder):
"lint": "eslint \"{src,apps,libs,tests}/**/*.ts\" --fix",
Changelog
V.0.3.18
- camelcase: off: We don't need this base rule since we have in place the typescript naming conventions rule.
V.0.3.17
- no-magic-numbers: Now it doesn't consider the values -1 and 2 as magic numbers.
- no-type-aliases: off: With graphql auto generated types, sometimes it's necessary to add an alias for easier access.