Skip to content

Instantly share code, notes, and snippets.

@xgqfrms
Created May 6, 2020 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms/c05debb539917a2b0763e50302efa009 to your computer and use it in GitHub Desktop.
Save xgqfrms/c05debb539917a2b0763e50302efa009 to your computer and use it in GitHub Desktop.
git hooks & husky & eslint

git hooks & husky & eslint

https://github.com/typicode/husky

https://www.npmjs.com/package/husky

// package.json
{
  "husky": {
    "hooks": {
      "pre-commit": "npm test",
      "pre-push": "npm test",
      "...": "..."
    }
  }
}
{
  "scripts": {
    "build": "rollup -c",
    "watch": "rollup -c --watch",
    "serve": "COOKIE_SECRET=devonly nodemon --watch .data/dist/server .data/dist/server",
    "start": "node ./start.js",
    "watchnserve": "npm run build && (npm run watch & npm run serve)"
  },
"devDependencies": {
    "husky": "4.2.5",
    "lint-staged": "10.2.2",
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,css,md,ts,tsx}": "prettier --write"
  }
}

https://www.cnblogs.com/xgqfrms/p/11650177.html#4569097

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment