@neozenith/eslint-config
v3.0.0
Published
Shareable esLint config
Downloads
3
Readme
ESLint Config
Shareable ESLint Configuration to apply coding standards across javascript development.
Getting Started
Installation
Install peer dependencies and install the eslint configuration:
npm install --save-dev eslint prettier eslint-plugin-prettier eslint-config-prettier
npm install --save-dev @neozenith/eslint-config
echo "**/node_modules/**" >> .eslintignore
Configuration
Basic Configuration
Then add the following to your package.json
:
{
"eslintConfig":{ "extends": "@neozenith" }
}
Well that seems really simple right? And everyone gets the same rules, no excuses.
Advanced Configuration
In future, environment specific rules, would be specified as below:
"eslintConfig":{
"extends":[
"@neozenith",
"@neozenith/eslint-config/node"
]
}
}
Scripts
Finally you'll want to add the following scripts to your package.json
.
{
"scripts": {
"test:lint:all":"./node_modules/.bin/eslint --ignore-path .",
"test:lint":"npm run test:lint -- --quiet",
"test:lint:fix":"npm run test:lint -- --fix",
"pretest":"npm run test:lint"
}
}
test:lint:all
- this will runeslint
as per usual outputting all errors and warningstest:lint
- including the--quiet
flag reduceseslint
's output to errors onlytest:lint:fix
- this fixes all errors that are auto-fixable such as formatting issues that do not impact the semantics of the code. Allprettier
rules are always auto-fixable.pretest
- By running this before your tests it will enforce linting and halt on any errors preventingnpm test
from actually running until linting is satisfied. You may want to update this totest:lint:all
so that it breaks on warnings too.
Maintaining
# Bump version number according to changes
npm version [major|minor|patch]
# Publish a public scoped repository
npm publish