Install esLint dependencies:

Yarn add eslint-config-airbnb-base eslint-plugin-sonarjs eslint-plugin-vue [email protected] eslint-plugin-html -d yarn add eslint-config-airbnb-base eslint-plugin-sonarjs eslint-plugin-vue [email protected] eslint-plugin-html -dCopy the code

Install styleLint dependency:

yarn add stylelint-config-standard stylelint-config-rational-order stylelint -D
Copy the code

Install the gitHook dependency (the version must be consistent, otherwise it will not take effect) :

Yarn add [email protected] [email protected] -dCopy the code

Eslintrc.js file configuration

module.exports = {
  root: true.extends: [
    'eslint-config-airbnb-base'.'eslint-plugin-sonarjs'.'eslint-plugin-vue',].globals: {
    Vue: true
  },
  rules: {
    // Custom configuration}}Copy the code

.stylelintrc.js File configuration

module.exports = {
  extends: ['stylelint-config-standard'.'stylelint-config-rational-order'].rules: {
    // Custom configuration}}Copy the code

Package. The json configuration

"husky": {
  "hooks": {
    "pre-commit": "lint-staged"}},"lint-staged": {
  "*.{ts,tsx,js,vue}": [
    "eslint --fix"]."*.{vue,css,less}": [
    "stylelint --fix"]},Copy the code