Skip to content

Commit 3418286

Browse files
chore: add dart format to pre-commit check and CI (#296)
* chore: add dart format to pre-commit check and CI Adds a `format` mise task (`dart format .`) and includes it in the `check` pre-commit gate. CI gains a `dart format --set-exit-if-changed .` step before `flutter analyze` so unformatted code is a hard failure on PRs rather than a silent auto-fix. The local task reformats in place; CI uses `--set-exit-if-changed` to fail the build without modifying files. * style: apply dart format to entire codebase Bulk-format all Dart files with `dart format .`. No logic changes — line wrapping, trailing whitespace, and indentation only. * docs: document dart format --no-deps usage in AGENTS.md * chore: add dart:format, prettier:format and mise:format tasks Splits the single `format` task into three named sub-tasks: - `dart:format` — dart format . (use --no-deps for speed after Dart changes) - `prettier:format` — Prettier for JS/TS/MJS files - `mise:format` — mise fmt for mise.toml The top-level `format` task now depends on all three. CI check formatting step expanded to cover all three. Prettier added to root package.json; .prettierignore excludes build/, android/, ios/. * style: apply prettier to JS/TS/MJS files * fix: correct CI format check and dart:format task ordering - Add --output=none to dart format CI check so it doesn't modify files (--set-exit-if-changed alone still writes) - Remove mise fmt --check from CI: mise is not installed in the CI environment (setup-flutter-app uses subosito/flutter-action directly) - Make dart:format depend on generate so mock files are formatted after codegen, not before * style: format files introduced by PR #295 bug fixes --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent e3fdb5c commit 3418286

89 files changed

Lines changed: 3467 additions & 2289 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ jobs:
6565
google-services-json: ${{ secrets.GOOGLE_SERVICES_JSON }}
6666
generate-mocks: 'true'
6767

68+
- name: Check formatting
69+
run: |
70+
dart format --output=none --set-exit-if-changed .
71+
npm ci
72+
npx prettier --check "**/*.{js,ts,mjs}"
73+
6874
- name: Analyze code
6975
run: flutter analyze --no-fatal-infos
7076

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/
2+
android/
3+
ios/

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ MISE_ENV=dev ./bin/mise tasks ls # All tasks including build/serve
7272
| Task | Command | Notes |
7373
|------|---------|-------|
7474
| **Pre-commit gate** | `./bin/mise run check` | **Run before every commit** |
75+
| **Format all code** | `./bin/mise run format` | Runs all three formatters below |
76+
| Format Dart | `./bin/mise run --no-deps dart:format` | **Run after every Dart change**`--no-deps` skips unnecessary `pub get` |
77+
| Format JS/TS | `./bin/mise run prettier:format` | After JS/TS changes |
78+
| Format mise.toml | `./bin/mise run mise:format` | After editing mise.toml |
7579
| Generate code (mocks) | `./bin/mise run generate` | After model changes |
7680
| Analyze code | `./bin/mise run analyze` | generate → analyze |
7781
| Run tests | `./bin/mise run test` | generate → test |

0 commit comments

Comments
 (0)