-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
63 lines (56 loc) · 2.22 KB
/
Copy pathlefthook.yml
File metadata and controls
63 lines (56 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Lefthook config — git hooks runner.
# Pre-commit: lint + format staged files (parallel).
# Pre-push: run tests for affected workspace.
#
# Notes:
# - dart/fvm/flutter guarded so backend-only contributors and CI bots
# without Flutter toolchain don't get blocked (Red Team #13).
# - Mobile env file scan blocks committing secrets to apps/mobile/.env*
# (Red Team #11).
pre-commit:
parallel: true
commands:
lint-api:
# `root` strips the `apps/api/` prefix from {staged_files} and runs
# the command with cwd = apps/api (so eslint resolves paths correctly).
root: "apps/api/"
glob: "apps/api/**/*.{ts,js}"
run: pnpm exec eslint --fix --max-warnings=0 {staged_files}
stage_fixed: true
format-api:
root: "apps/api/"
glob: "apps/api/**/*.{ts,js,json,md}"
run: pnpm exec prettier --write {staged_files}
stage_fixed: true
# Logic delegated to bash scripts because lefthook's Windows shell wrapper
# (printed as "not:" in errors) doesn't reliably parse inline if/elif/fi.
# Same pattern as lint-mobile-env. Scripts have explicit shebangs.
analyze-mobile:
root: "apps/mobile/"
glob: "apps/mobile/**/*.dart"
# Filter out generated files — dart analyze ignores analysis_options
# exclude patterns when given explicit file args.
exclude:
- "apps/mobile/**/*.g.dart"
- "apps/mobile/**/*.freezed.dart"
- "apps/mobile/lib/l10n/app_localizations*.dart"
# `root` makes cwd = apps/mobile, so script path is relative to that.
run: bash ../../tools/scripts/dart-analyze-staged.sh {staged_files}
format-mobile:
root: "apps/mobile/"
glob: "apps/mobile/**/*.dart"
exclude:
- "apps/mobile/**/*.g.dart"
- "apps/mobile/**/*.freezed.dart"
- "apps/mobile/lib/l10n/app_localizations*.dart"
run: bash ../../tools/scripts/dart-format-staged.sh {staged_files}
stage_fixed: true
lint-mobile-env:
glob: "apps/mobile/.env*"
run: bash tools/scripts/lint-mobile-env.sh {staged_files}
pre-push:
commands:
test-api:
run: pnpm --filter @mobile-boilerplate/api test -- --passWithNoTests
test-mobile:
run: bash tools/scripts/flutter-test.sh