$ npm install eslint @neogeek/eslint-config-standards --save-dev
Then create a .eslintrc
file in the root of your project with the following contents:
{
"extends": ["@neogeek/eslint-config-standards"]
}
See http://eslint.org/docs/rules/ for more information.
This package enables errors on all of the available flags except the following:
No changes
Flag | Description | Value |
---|---|---|
no-unused-vars | Disallow unused variables | "no-unused-vars": ["warn", {"ignoreRestSiblings": true}] |
Flag | Description | Value |
---|---|---|
id-length | Enforce minimum and maximum identifier lengths | off |
max-lines | Enforce a maximum number of lines per file | off |
max-statements | Enforce a maximum number of statements allowed in function blocks | off |
no-magic-number | Disallow magic numbers | ["error", {"ignore": [-1, 0, 1]}] |
no-shadow | Disallow variable declarations from shadowing variables declared in the outer scope | ["error", {"allow": ["err"]}] |
one-var | Enforce variables to be declared either together or separately in functions | off |
{
"extends": [
"@neogeek/eslint-config-standards/.eslintrc-layout-formatting",
"@neogeek/eslint-config-standards/.eslintrc-possible-problems",
"@neogeek/eslint-config-standards/.eslintrc-suggestions"
],
"rules": {
"quotes": [2, "double"]
}
}
Create a .prettierrc
file with the following contents:
{
"printWidth": 80,
"tabWidth": 4
}
Install the prettier-eslint-cli.
$ npm install prettier-eslint-cli --save-dev
Add NPM script for automation.
{
"scripts": {
"prettier": "prettier-eslint --write \"src/**/*.js\""
}
}