Pluggable eslint config for Node.js that you can import, extend and override
npm install eslint-config-nodeshell
npm install --save-dev eslint-config-node
`
And in your .eslintrc.yaml:
`yaml
extends:
- node
`
Alternatively, in your .eslintrc.js or .eslintrc.json:
`json
{
"extends": ["node"]
}
`
To add a git-hook to your commits, consider using husky
`shell
npm install --save-dev husky
`
And in your package.json:
`json
"scripts": {
"precommit": "eslint ."
}
`
---
#### Config
This config is biased and opinionated, and errs on the side of too many rules instead of too few. Think of this as a superset of your repo's lint config, and discard what you don't like in it. It's easy to override and disable the rules you find inconvenient.
`yaml
env:
node: true
`
enables Node.js features and global variables
`yaml
extends: esnext
`
includes config and rules from eslint-config-esnext
`yaml
rules:
`
selected from here, configured to:
- no-path-concat: disallow string concatenation with __dirname and __filename
- no-process-exit: disallow the use of process.exit()
- no-sync`: disallow synchronous methods; set to warn only