- contains all rules
- almost all rules enabled
- this config is highly opinionated
- anywhere
- for tests better to add
env:"node"
and disablenewline-per-chained-call
rule
- install latest
npm
$(sudo) npm install -g npm@latest
- add task
eslint
topackage.json
script
section"eslint": "./node_modules/.bin/eslint --ignore-path .gitignore --ext js --fix . .config",
- add linting to tests step
scripts
package.json
section"test": "npm run eslint && ..."
- create
.eslintrc.json
near to youpackage.json
with the following content{ "extends": "./node_modules/eslint-config-valorsoft/.eslintrc.json", "env": { "node": true } }
- run
npm t
to check that all is working correctly
no-eq-null
- duplicateseqeqeq:smart
no-restricted-imports
,no-restricted-modules
,no-restricted-globals
- dependant on project requirementsid-match
- not found any particular use of this rule,camelCase
is enoughjsx-quotes
- I don't use jsx so I don't careno-plusplus
- why not++
? It's nice to use when you know what you are doingno-restricted-syntax
- duplicatesno-with
and disabled functional expressionsno-ternary
- why not? but not nested ternary pleaserequire-jsdoc
- nice thing, but hard to followspaced-comment
- nice for meaningful comments, bad for quick code commentingwrap-regex
- no needprefer-reflect
- compatibility is to low to usenewline-before-return
- TBD
indent
- 2 spaces rulezzz!max-len
- extended to 120 charsnewline-per-chained-call
- extendedignoreChainWithDepth
to 3eqeqeq
-smart
mode enableddot-location
-property
mode enabledno-implicit-coercion
- boolean implicit coercion enabledfunc-style
-declaration
only pleaseno-use-before-define
- usage offunction
before declarations are allowedno-mixed-requires
-grouping
andallowCall
checks enabledlinebreak-style
- unix onlyone-var
-never
use onevar|let|const
per blockpadded-blocks
-never
add useless paddingquote-props
- quote properties onlyas-needed
andkeywords
no-magic-numbers
-ignore
-1,0,1
as most often used numbers andignoreArrayIndexes
,enforceConst
are enabled
- what I really appreciate is configs for IDEs
- to change any rule you should have strong arguments and not only opinion