A collection of my common eslint configurations
Check the releases for the latest version.
Add eslint-config-jakesidsmith to your package.json. This can easily be done with the following command
npm install https://github.com/JakeSidSmith/eslint-config-jakesidsmith#v2.1.1 --save-dev
Or manually add this to the package.json
"devDependencies": {
"eslint-config-jakesidsmith": "git+https://github.com/JakeSidSmith/eslint-config-jakesidsmith.git#v2.1.1"
}
Create a file called .eslintrc.json
and extend the configs you require
Default config (ES6, React & CommonJS)
{
"extends": [
"jakesidsmith/default"
]
}
Custom config
{
"extends": [
"jakesidsmith/node",
"jakesidsmith/es6"
]
}
base (all basic rules, all other configs extend base)
default (ES6, React & CommonJS)
browser
commonjs
es6
jest
mocha
node
react
react-native
Add a script like the following to your package.json with your chosen configurations.
In this example we have a second config specifically for our test files
"scripts": {
"lint": "eslint src/",
"lint-tests": "eslint -c .eslintrc-tests tests/"
}
And run it with
npm run eslint
# and or
npm run eslint-tests
I'd recommend calling the eslint script in your test script
"scripts": {
"test": "npm run lint && npm run mocha"
}