https://prettier.io/
image.png

  1. yarn add @commitlint/cli
  2. yarn add @commitlint/config-conventional
  3. yarn add lint-staged
  4. yarn ad yorkie
  5. yarn add prettier
  6. yarn add @umijs/fabric
  7. yarn add commitizen
  8. npm install --save-dev --save-exact prettier
  9. yarn add --dev --exact prettier
  10. # 新建 prettierrc.json
  11. echo {}> .prettierrc.json
  12. # 新建 .prettierignore
  13. echo .prettierignore

prettierignore

  1. # Ignore artifacts:
  2. build
  3. coverage
  4. # Ignore all HTML files:
  5. *.html

react配置 prettier

eslint-config-prettier

https://github.com/prettier/eslint-config-prettier#installation

  1. npm install --save-dev eslint-config-prettier
  2. {
  3. "extends": [
  4. "some-other-config-you-use",
  5. "prettier"
  6. ]
  7. }

用 Prettier的格式化配置,去覆盖之前的配置

image.png

编辑器配置 prittier

https://prettier.io/docs/en/editors.html