Lotterywest ESLint Config
See the Confluence styleguide page for more information.
Setting up a new project
The default eslint-config option assumes the project is using Typescript.
It is based on AirBnB style with some tweaks.
Installing the @binaryben ESLint configs will automatically install Prettier and the Lotterywest Prettier config as peer dependencies as well.
Install
$ npm i -D git+https://{team}:{password}@bitbucket.org/lotterywest/eslint-config.git
Edit package.json
{
// ...
"scripts": {
// ...
"lint": "npm run lint:format && npm run lint:errors && ...",
"lint:format": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
"lint:errors": "eslint \"src/**/*.{js,jsx,ts,tsx}\" --quiet"
// ...
},
// ...
"prettier": "@binaryben/prettier-config",
"eslintConfig": {
"root": true,
"extends": ["@binaryben"]
}
}
To use the other ESLint options provided in this repo, add them to the extends
array. For example, to add support for a React based project:
"eslintConfig": {
"root": true,
"extends": ["@binaryben", "@binaryben/eslint-config/react]
}
Set up VSCode
- Install the extension for VScode
- Open settings (⌘ + ,) and set
prettier.requireConfig
and editor.formatOnSave
to true
Usage
npm run lint
Note: It is highly recommended to use this with eslint as well
References
https://eslint.org/docs/developer-guide/shareable-configs