chore: add pre-commit guardrails #6
+10
-3
@@ -55,15 +55,22 @@ repos:
|
||||
|
||||
# --------------------------------------------------------- ESLint (Nuxt) -
|
||||
# Local hook: needs `pnpm install` to have run in this repo. --fix makes
|
||||
# it a helper; only staged files are linted (fast).
|
||||
# it a helper; only staged files are linted (fast). When --fix rewrites
|
||||
# a staged file, pre-commit aborts the commit ("files were modified") -
|
||||
# re-stage and commit again; that re-stage loop is the standard price
|
||||
# of a fixer hook.
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: eslint
|
||||
name: eslint --fix (staged files)
|
||||
entry: bash -c 'pnpm exec eslint --fix'
|
||||
# no shell wrapper: pre-commit appends the staged filenames to the
|
||||
# entry itself. A 'bash -c' wrapper would eat the first filename
|
||||
# as $0 and eslint would get no file arguments at all (linting the
|
||||
# whole repo instead - review finding on this PR, empirically
|
||||
# verified).
|
||||
entry: pnpm exec eslint --fix
|
||||
language: system
|
||||
files: \.(vue|ts|js|mjs|cjs)$
|
||||
types: [file]
|
||||
|
||||
# When Go services arrive, add:
|
||||
# - repo: https://github.com/dnephin/pre-commit-golang
|
||||
|
||||
Reference in new issue
Block a user