Install prettier and setup default config files
- Install prettier
npm install --save-dev prettier
- Create prettier config file
touch .prettierrc.js
-
Edit
.prettierrc.js
to look like this.
module.exports = { semi: false, singleQuote: true, trailingComma: 'es5', }
Create prettier ignore file
touch .prettierignore
-
Edit
.prettierignore
to look like this.
# Ignore artifacts: dist coverage
-
Add
"format": "prettier --write ."
to"scripts"
section inpackage.json
"scripts": { ..., - "serve": "vite preview" + "serve": "vite preview", + "format": "prettier --write ." },
Run
npm run format
git add .
git commit -m 'install prettier'
Links
- https://prettier.io/docs/en/install.html
- https://prettier.io/docs/en/configuration.html
- https://prettier.io/docs/en/ignore.html#ignoring-files-prettierignore
- https://vueschool.io/articles/vuejs-tutorials/eslint-and-prettier-with-vite-and-vue-js-3/
Top comments (0)