0.14.0 • Published 6 years ago
@knotel/eslint-config-react v0.14.0
@knotel/eslint-config-react
Knotel shared eslint configuration for React-based applications and components
Installation
yarn add --dev @knotel/eslint-config-reactAlso make sure to add the peerDependencies:
yarn add --dev eslint eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooksUsage
In order to use the shared config simply add the following to your package.json:
{
"name": "@knotel/my-package",
"version": "1.0.0",
...
"eslintConfig": {
"extends": [
"@knotel/eslint-config-react"
]
},
"eslintIgnore": [
"node_modules",
"dist",
".cache"
],
...
}You can also add it in an .eslintrc or eslintrc.json file but adding the config in your package.json will reduce unnecessary clutter.
Configuring your VSCode workspace
For the best developer experience, follow these steps to configure VSCode:
- Make sure you have
ESlintconfigured in VSCode (Extensions > Search for "Eslint" > Install) - Install the StandardJS extensions for VSCode
- Add these keys to your VScode settings
JSON:
"standard.autoFixOnSave": true,
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
],- Add some scripts to your
package.json:
"scripts": {
...
"test:lint": "eslint --ext .js --ext .jsx src",
"test:lint:fix": "eslint --ext .js --ext .jsx src --fix",
...
},Contributing
Submit a pull request against the mono repo