prettier

yarn add prettier --dev --exact 

yarn add eslint-config-prettier eslint-plugin-prettier --dev
Copy the code

husky

npx husky-init && yarn

yarn add pretty-quick lint-staged --dev
Copy the code

eslint

yarn add eslint --dev 
yarn add eslint-config-prettier eslint-plugin-prettier eslint-plugin-vue --dev
Copy the code

.eslintrc.js

extends: [
    'plugin:vue/recommended'.'eslint:recommended'.'prettier'.'plugin:prettier/recommended'
]
Copy the code

tips

Delete eslintprettier/prettierAn error

Solution:

  1. .editorconfig end_of_line=crlf
  2. .prettierrc "endOfLine": "auto"
  3. Restart vscode