ESLint shareable config for Keep, based off the Google JavaScript style guide (ES2015+ version).
npm i https://github.com/keep-network/eslint-config-keep.git
- Install the linter and config -
npm i -D eslint https://github.com/keep-network/eslint-config-keep.git
- Create your
.eslintrc
:
{
"extends": "eslint-config-keep",
"rules": {
// Additional, per-project rules...
},
}
- Add commands for linting to your
package.json
:
{
"scripts": {
"lint:js": "eslint .",
"lint:js:fix": "eslint --fix ."
},
}
Adding a pre-commit hook using pre-commit
- repo: local
hooks:
- id: lint-js
name: 'lint js'
entry: /usr/bin/env bash -c "npm run js:lint"
files: '\.js$'
language: script
description: "Checks JS code according to the package's linter configuration"