Setting auto-formatting of vite vue.js 3 project with VSCode

·

1 min read

Table of contents

No heading

No headings in the article.

紀錄一下
ref source: https://vueschool.io/articles/vuejs-tutorials/eslint-and-prettier-with-vite-and-vue-js-3/

  1.  npm init vite@latest
    

    or

  2.  npm create vuetify
    
  3.  npm install --save-dev --save-exact prettier
    
  4.  npm install --save-dev eslint eslint-plugin-vue
    
  5.  npm install eslint-config-prettier --save-dev
    
  6. in .vscode/settings.json

{
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}