Closed vyshnavsdeepak closed 1 year ago
@vyshnavsdeepak Could you try 0.2.0-dev.0 with glob pattern to exclude the files following the glob syntax
Closed, if any problem exists with the glob pattern, please create a new issue.
@hyiso I also can't exactly find where we should put these globs? Also, these globs only seem to match, not exclude?
@bawahakim See the glob syntax
If it starts with
^
or!
, the construction will instead match all characters not mentioned. For example,test[^a-z].dart
will matchtest1.dart
but nottesta.dart
.
How can we apply a set of "include" and "not include"? E.g. I want to include all files in lib/**/*.dart
but not in lib/**/__generated__/*.dart
? Tried various things like
lint_staged:
'lib/**/*.dart': dart format --fix && dart fix --apply && dart analyze --fatal-infos
'!lib/**/__generated__/**/*.dart':
But the generated files still get linted
Maybe you need to split the configuration into multi glob, as the package glob
does not support a simple configuration to apply both include and exclude
just like
lint_staged:
'lib/{foo, bar,baz}/**.dart': your script
'lib/xxx/{dirs exclude __generated__}/**/*.dart': your script
You can write test code with package glob
to check your configuration
I couldn't find documentation or code related to excluding certain directories. Looks like it is missing.
This will be useful in cases where there are generated dart files, eg. In case the project uses google's protocol buffers, there will be dart files generated by the compiler, protoc.