eslint-config-codility
Codility's shared ESLint config.Usage
- Install the package:
yarn add @codility/eslint-config-codility --dev --exact
- Install peer dependencies and optional dependencies if needed
- Add
.eslintrc.js
file:
* For the vanilla JS version use this:
```
/* eslint-disable strict */
'use strict';
module.exports = {
extends: ['@codility/eslint-config-codility'],
};
```
* For the React version use this:
```
/* eslint-disable strict */
'use strict';
module.exports = {
extends: ['@codility/eslint-config-codility/react'],
};
```
- Add
scripts
to yourpackage.json
:
"lint": "eslint .",
"lint:fix": "yarn lint -- --fix"
- Run lint with
yarn lint
- Let the tool fix your code:
yarn lint:fix
Migrating to v.2
Previously the only version available included React plugins and had React as a peer dependency, which was annoying for projects that didn't involve it. That version is now available as@codility/eslint-config-codility/react
- simply add /react
at the end.Warnings vs errors rationale
Rules for setting up the rules:- 0 (off):
- 1 (warn):
console.log
or debugger
)
- stylistic errors- 2 (error):