lefthook.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # EXAMPLE USAGE:
  2. #
  3. # Refer for explanation to following link:
  4. # https://lefthook.dev/configuration/
  5. #
  6. # pre-push:
  7. # jobs:
  8. # - name: packages audit
  9. # tags:
  10. # - frontend
  11. # - security
  12. # run: yarn audit
  13. #
  14. # - name: gems audit
  15. # tags:
  16. # - backend
  17. # - security
  18. # run: bundle audit
  19. #
  20. # pre-commit:
  21. # parallel: true
  22. # jobs:
  23. # - run: yarn eslint {staged_files}
  24. # glob: "*.{js,ts,jsx,tsx}"
  25. #
  26. # - name: rubocop
  27. # glob: "*.rb"
  28. # exclude:
  29. # - config/application.rb
  30. # - config/routes.rb
  31. # run: bundle exec rubocop --force-exclusion {all_files}
  32. #
  33. # - name: govet
  34. # files: git ls-files -m
  35. # glob: "*.go"
  36. # run: go vet {files}
  37. #
  38. # - script: "hello.js"
  39. # runner: node
  40. #
  41. # - script: "hello.go"
  42. # runner: go run
  43. pre-commit:
  44. parallel: true
  45. commands:
  46. code-workspace:
  47. run: pnpm vsh code-workspace --auto-commit
  48. lint-md:
  49. run: pnpm prettier --cache --ignore-unknown --write {staged_files}
  50. glob: '*.md'
  51. lint-vue:
  52. run: pnpm prettier --write {staged_files} && pnpm eslint --cache --fix {staged_files} && pnpm stylelint --fix --allow-empty-input {staged_files}
  53. glob: '*.vue'
  54. lint-js:
  55. run: pnpm prettier --cache --ignore-unknown --write {staged_files} && pnpm eslint --cache --fix {staged_files}
  56. glob: '*.{js,jsx,ts,tsx}'
  57. lint-style:
  58. run: pnpm prettier --cache --ignore-unknown --write {staged_files} && pnpm stylelint --fix --allow-empty-input {staged_files}
  59. glob: '*.{scss,less,styl,html,vue,css}'
  60. lint-package:
  61. run: pnpm prettier --cache --write {staged_files}
  62. glob: 'package.json'
  63. lint-json:
  64. run: pnpm prettier --cache --write --parser json {staged_files}
  65. glob: '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}'
  66. post-merge:
  67. commands:
  68. install:
  69. run: pnpm install
  70. commit-msg:
  71. commands:
  72. commitlint:
  73. run: pnpm exec commitlint --edit $1