目录

Prettier

安装

npm install --save-dev --save-exact prettier

配置

.prettierrc.js
module.exports = {
  // https://github.com/google/gts/blob/main/.prettierrc.json
  bracketSpacing: false,
  singleQuote: true,
  trailingComma: "es5",
  arrowParens: "avoid",
  overrides: [
    {
      files: ["*.html", "*.tsx", "*.vue"],
      options: {
        printWidth: 120,
      },
    },
  ],
};

Ignoring Code

.prettierignore
# Ignore artifacts:
build
coverage

使用

npx prettier --write --ignore-unknown .

Pre-commit Hook

npx mrm@2 lint-staged