ESLint shared config for Clockwork
npm install eslint-config-clockwork> ESLint shareable config for Clockwork
``bash`
npm install --save-dev eslint eslint-config-clockwork
Create a .eslintrc file in the root level of your project and add this:`json`
{
"extends": "clockwork"
}
Update scripts in your package.json at the root of your project.
`json`
"scripts": {
"lint": "./node_modules/.bin/eslint
}
Run the NPM script from the command line
`shell`
npm run lint
Use Husky
`shell`
npm install husky --save-dev
Add precommit to package.json scripts
`json``
"scripts": {
"lint": "./node_modules/.bin/eslint
"precommit": "npm run lint"
}
- Focus on rules that could lead to bugs
- Prefer rules that increase readability over stylistic or religious wars (like spacing)
- Make linting easy for CMS, website and application projects
- Applicable to many contexts (jQuery, Angular, React, Vue & Node). Projects may extend it with specifics for each if necessary.