eslint-config-vizzuality
v1.3.0
Published
This package provides Vizzuality's .eslintrc as an extensible shared config.
Downloads
1,034
Readme
eslint-config-vizzuality
This package provides Vizzuality's .eslintrc as an extensible shared config.
## Usage
We export three ESLint configurations for your usage.
Install
Unsing npm:
npx install-peerdeps --dev eslint-config-vizzuality
npm install --save-dev eslint-config-vizzuality
Using yarn:
yarn add [email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
eslint-config-vizzuality@latest \
--dev
Add "extends": "vizzuality"
to your .eslintrc
Example of .eslintrc.json
:
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": [
"vizzuality"
]
}
Add script to in your package.json
:
{
"scripts": {
...
"lint": "eslint --ext .js --ext .jsx ."
}
}
And execute eslint running:
yarn lint
Recommendations
Pre-commit hooks
As a good practice running eslint only in git staged files using (lint-staged)[https://github.com/okonet/lint-staged] will have quicker analysis and ensure quality in each commit.
And it is as easy as install the dependency:
npm install lint-staged
or
yarn add lint-staged
And add the following code to the package.json
:
"scripts": {
"precommit": "lint-staged"
},
"lint-staged": {
"**/*.js": [
"eslint --quiet --fix",
"git add"
]
},