Same lint, format and complexity gates as core, plus a lint rule that keeps core a types-only import in plugin sources. Runtime suites are chosen from each package's engines, so declaring a runtime is what puts a package under its test. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
15 lines
501 B
Bash
Executable File
15 lines
501 B
Bash
Executable File
#!/bin/sh
|
|
# Pre-commit gate. Auto-fixes formatting and lint on staged TypeScript, re-stages it, then enforces lint
|
|
# and the complexity gate. Enabled by the `prepare` script (`git config core.hooksPath .githooks`).
|
|
set -e
|
|
|
|
staged=$(git diff --cached --name-only --diff-filter=ACM -- 'packages/*.ts' 'test/*.ts')
|
|
if [ -n "$staged" ]; then
|
|
echo "$staged" | xargs npx prettier --write
|
|
echo "$staged" | xargs npx eslint --fix
|
|
echo "$staged" | xargs git add
|
|
fi
|
|
|
|
npm run lint
|
|
npm run complexity:check
|