ESLint plugin for the ChronoBank related projects.
npm install ChronoBank/eslint-plugin-chronobank --save-dev
- Create a file named
.eslintrc
in your project:
{
extends: ['plugin:chronobank/recommended']
}
- Add to your
package.json
(you'll probably need to changesrc
andspecs
folders to your own):
"scripts": {
...
"lint": "./node_modules/eslint/bin/eslint.js --ext .js,.jsx --fix src specs",
"lint:test": "./node_modules/eslint/bin/eslint.js --ext .js,.jsx src specs",
"test": "npm run lint:test && jest --useStderr --forceExit --runInBand",
- Use
npm test
before any commit and in yourtravis.yml
:
script:
...
- npm test -- --coverage
after_script:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
This package extends eslint:recommended
This package overrides several rules:
Override | Description | Reason |
---|---|---|
"no-constant-condition": 0 |
link | We often use const declarations together with JSX checks |
"semi": ["error", "never"] |
link | We hate them |
"no-case-declarations": 1 |
link | Warning on case declarations (need code refactoring before setting "error" level) |
'curly': [2, 'multi-line'] |
link | Enforce curly braces in multiline blocks |
'dot-location': [2, 'property'] |
link | Enforce the dot to be on the same line as the property |
'eol-last': 2 |
link | Enforce new line at the end of file |
'eqeqeq': [2, 'always', {'null': 'ignore'}] |
link | Enforce using of type-safe equality operators except the cases when it is isNil check |
'handle-callback-err': [2, '^(err|error)$' ] |
link | Enforce handling of callback errors |
'indent': [2, 2, { 'SwitchCase': 1 }] |
link | Enforce indent in switch statements |
'space-before-function-paren': ['error', 'always'] |
link | Enforce space before function parenthesis |