@tdcerhverv/linting-rules
v2.0.0
Published
Linting setup to unify coding, without nitpicking ♥ prettier
Downloads
243
Readme
Linting rules
Linting setup to unify coding, without nitpicking ♥ prettier.
Features
- Eslint
- Stylelint
- Prettier
Setup
First install the package as a dependency:
npm install --save-dev @tdcerhverv/linting-rules
To keep things simple, add the following configs to package.json
:
"eslintConfig": {
"extends": "./node_modules/@tdcerhverv/linting-rules/eslint.js"
},
"prettier": "@tdcerhverv/linting-rules/prettier.js",
"stylelint": {
"extends": "./node_modules/@tdcerhverv/linting-rules/stylelint.js"
},
It's also possible to create individual config files, but for simplicity and to avoid clutter, we recommend adding the config in the package.json
file.
See the individual packages for instructions if you need individual config files.
Config
You will probably need to customize the configuration for your needs, e.g. setting up files that eslint should ignore, here's an example:
"eslintIgnore": [
"/.cache",
"/.vscode",
"/dist",
"/build",
"/deploy",
"/docker",
"/coverage",
"static",
"Dockerfile",
"package-lock.json",
"*.scss.d.ts",
"*.svg.d.ts",
"*.module.scss.d.ts"
],
... or adding special rules for eslint:
"eslintConfig": {
"extends": "./node_modules/@tdcerhverv/linting-rules/eslint.js",
"rules": {
"react-hooks/rules-of-hooks": "error",
}
},
Prettier config
The shared prettier config has the following settings:
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2