包详细信息

@digitalroute/prettier-config

digitalroute77MIT3.0.0

Prettier configuration for DigitalRoute

digitalroute, prettier, prettier-config

自述文件

@digitalroute/prettier-config

Prettier shareable configuration for Digitalroute projects.

Usage

Install this config as a devDependency:

npm install @digitalroute/prettier-config --save-dev

Add the following to your package.json:

{
  "prettier": "@digitalroute/prettier-config"
}

Usage with husky and lint-staged

Husky is a tool that triggers npm-scripts based on git actions. Lint-staged let's you run linting and formatting on files that are staged. You can use these two tools to ensure that all commited files are prettified before they are commited.

Install husky and lint-staged as a devDependency:

npm install husky lint-staged --save-dev

Add the following to your package.json:

{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{ts,tsx,js,jsx,json,md,mdx,yml}": "prettier --write"
  }
}