hyiso / lint_staged

Run linters on git staged files for your Flutter and Dart projects. Inspired by JavaScript lint-staged library
https://pub.dev/packages/lint_staged
Apache License 2.0
8 stars 2 forks source link

Files with ignore_for_file: type=lint are not ignored #12

Closed bawahakim closed 8 months ago

bawahakim commented 8 months ago

File with comment // ignore_for_file: type=lint are not ignored. I think the expected behaviour would be to ignore these

hyiso commented 8 months ago

File with comment // ignore_for_file: type=lint are not ignored. I think the expected behaviour would be to ignore these

It's not clear what does this mean,lint_staged does not support things like // ignore_for_file: type=lint

bawahakim commented 8 months ago

In many (if not all) generated files (e.g. with build_runner), there is a comment at the top // ignore_for_file: type=lint which tells the linter to ignore the file. However, it seems lint_staged does not ignore this and throws an error for these type of files

hyiso commented 8 months ago

They are totally different things: lint_staged handle files in git staged, it does not care about the file type and content // ignore_for_file: type=lint is handled by dart lang linters

That is ,the problem is the linter you use (dart analyzer or something else) that does not ignore // ignore_for_file: type=lint, not lint_staged