dart_custom_lint icon indicating copy to clipboard operation
dart_custom_lint copied to clipboard

The directive `// ignore_for_file: type=lint` is not working properly for custom_lint.

Open arthurbcd opened this issue 4 months ago • 2 comments

Describe the bug Flutter allows us to disable lints using: // ignore_for_file: type=lint. Reference: https://dart.dev/tools/analysis

This is working as expected, actually.

When I start my project with this directive, all lints will be correctly ignored (flutter's and custom_lint). The problem is when I add this directive to other files. The flutter lints will be immediately ignored, but custom_lint's will stay there.

In order to make it work for custom_lint, I have to restart the analysis server.

To Reproduce

  1. Add // ignore_for_file: type=lint to any existing file with custom_lint activated.
  2. Remove it.

Expected behavior Lints to be instantly disabled.

arthurbcd avatar Mar 03 '24 12:03 arthurbcd

It is working fine for me. Please share a complete example.

rrousselGit avatar Mar 03 '24 20:03 rrousselGit

Example here:

  1. Clone it https://github.com/arthurbcd/type_lint_issue

  2. After pub get add the line on the top of main.dart:

// ignore_for_file: type=lint

The lints stay even after it adding it. image

Restarting analysis server solves. (slow way)

But if I ctrl+a then ctrl-x then ctrl+v, the lints disappear immediately (fast way).

The same thing happens with other packages like pyramid_lints.

PS: This is a new project created with Flutter: new project [empty template].

arthurbcd avatar Apr 14 '24 21:04 arthurbcd