@skodaflow/eslint-config-react
v1.1.4
Published
ESLint & Prettier sharable configuration by Skoda Auto
Downloads
28
Readme
@skodaflow/eslint-config-react
Skoda Auto ESLint & Prettier rules for REACT projects. This rules are extension of "react-app", "prettier/recommended" and "prettier/react" configuration
Package contains sharable config for ESLint & Prettier. Useable for applications builded on REACT technology stack.
Usage
Authorization
You need the access token in your .npmrc file for @skodaflow scope to registry: registry=https://tfs.skoda-auto.com/tfs/WFA/_packaging/skodaflow-npm/npm/registry/
Instalation
npm install --save-dev eslint prettier @skodaflow/eslint-config-react
Coniguration
Edit your .eslintrc file in the root of your project
{
"extends": [
"@skodaflow/eslint-config-react"
]
}
Extend scripts in your package.json
"scripts": {
"lint": "eslint src/**",
"lint-fix": "eslint src/** --fix"
}
After that, you can check and fix your code.
Add GIT Hook
If you want to check code style and fix issues automatically for each GIT commit install and configure husky & lint-staged to your project.
Installation
npm install --save-dev husky@4 lint-staged
Configuration
Add this setting to your package.json
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.+(js|jsx|ts|tsx)": "eslint --fix",
"*.+(json|css|md|scss|sass)": "prettier --write"
}
Run this commnand:
npx husky install
That`s all. Each committed files will be checked and formatted with ESLint & Prettier.
Troubleshoots If your commits are not envoking pre-commit hook try to run this command from project root:
git config --unset core.hookspath