dart_lint_staged 1.0.0
dart_lint_staged: ^1.0.0 copied to clipboard
Run linters on git staged files for your Flutter and Dart projects. Improved fork of lint_staged with JS lint-staged-style batched commands.
example/README.md
dart_lint_staged example #
Minimal setup: format and fix staged Dart files before each commit.
-
Add the package:
dart pub add --dev dart_lint_staged -
Configure commands in your
pubspec.yaml:dart_lint_staged: 'lib/**.dart': dart format && dart fix --apply -
Run it in your
pre-commithook (for example with Husky, in.husky/pre-commit):#!/usr/bin/env sh . "$(dirname "$0")/_/husky.sh" dart run dart_lint_staged
Stage a .dart file under lib/ and commit. The staged files are formatted and fixed, and the changes are added to the commit.
Do not pass file paths in the config. dart_lint_staged appends the staged files for you.
See the main README for all options.