@onidivo/eslint-config-react
v1.0.38
Published
The ESLint configuration for React used by Onidivo
Readme
onidivo/eslint-config-react
Installation
Install our configuration and its peer dependencies.
yarn add --dev @onidivo/eslint-config-react
OR
npm install --save-dev eslint @onidivo/eslint-config-reactnpx install-peerdeps --dev @onidivo/eslint-config-reactCreate a .eslintrc.json file in your root with the following content:
{
"extends": [
"@onidivo/eslint-config-react",
]
}Add a linter script to your package.json. In the following example, all files in the src and test folder (and
their subfolders) are checked:
{
"scripts": {
"lint": "eslint '{src,test}/**/*.{js,ts,tsx}'",
"lint:fix": "eslint '{src,test}/**/*.{js,ts,tsx}' --fix"
}
}Watcher task
You can use chokidar-cli to add a task that lints your files on save. First install it:
npm install --save-dev chokidar-cliThen add a watch script to your package.json. In the following example, chokidar will look for changes in any files in the src and test folder (and their subfolders):
{
"scripts": {
"lint": "eslint '{src,test}/**/*.js' --fix",
"lint:watch": "npm run watch:js -- -c 'npm run lint'",
"watch:js": "chokidar '{src,test}/**/*.js' --initial"
}
}