Eslint & Prettier & Stylelint & Husky
Introduction
To create the style standard so as to let the code becomes more beautiful
The dependency is installed when new react project is created
Eslint
Install the corresponding dependencies
npm install eslint-webpack-plugin eslint-config-prettier
eslint-plugin-prettier eslint-plugin-react
eslint-plugin-unused-imports babel-eslint @typescript-eslint/eslint-plugin
@typescript-eslint/parserInstall eslint plugin in vsCode for the hints

Create eslint config file - .eslintrc.js
React Version
NextJS + TypeScript Version
Prettier
Install the dependency
Create prettierrc file
Stylelint
Install the dependency
Install the plug-in in vsCode for hints

Create stylelint file
Husky && Lint-Staged
To perform the git hook when commit and focus on the commit file
Update the npm version and install dependencies
Edit the package.json to add prepare script
Can also edit the pre-commit setting in .husky/pre-commit file
VS Code
Close the auto save formatting
Edit settings.json of vsCode
Edit package.json to delete eslint config (default) and add NPM script to fix the styling problem automatically
Reference
Last updated
Was this helpful?