@@ -5,7 +5,7 @@ can be enabled for a given package, so that the plugin can report diagnostics
5
5
(lints and warnings) and offer quick fixes. Plugins are enabled via the
6
6
` analysis_options.yaml ` file under the top-level ` plugins ` section:
7
7
8
- ```
8
+ ``` yaml
9
9
plugins :
10
10
my_plugin : ^1.0.0
11
11
` ` `
@@ -26,7 +26,7 @@ as the key. The value can either be
26
26
27
27
For example, while developing a plugin locally, it can be enabled as :
28
28
29
- ```
29
+ ` ` ` yaml
30
30
plugins:
31
31
my_plugin:
32
32
path: /path/to/my_plugin
@@ -37,3 +37,39 @@ Note: after any change is made to the `plugins` section of an
37
37
the effects.
38
38
39
39
[legacy] : https://github.com/dart-lang/sdk/blob/main/pkg/analyzer_plugin/doc/tutorial/tutorial.md
40
+
41
+ # # Enabling a lint rule
42
+
43
+ A plugin can report two kinds of diagnostics : warnings and lints. Any warnings
44
+ that a plugin defines are enabled by default (like analyzer warnings). Any lint
45
+ rules that a plugin defines are disabled by default (like analyzer lint rules),
46
+ and must be explicitly enabled in analysis options. Lint rules are enabled
47
+ under the `diagnostics` section for a plugin :
48
+
49
+ ` ` ` yaml
50
+ plugins:
51
+ my_plugin:
52
+ path: /path/to/my_plugin
53
+ diagnostics:
54
+ rule_1: true
55
+ rule_2: true
56
+ rule_3: false
57
+ ` ` `
58
+
59
+ In the configuration above, `rule_1` and `rule_2` are enabled. Additionally,
60
+ ` rule_3` is disabled, which can be useful if an included analysis options file
61
+ explicitly enables the rule.
62
+
63
+ # # Suppressing diagnostics
64
+
65
+ A diagnostic which is reported by a plugin can be suppressed with a comment. The
66
+ syntax is similar to suppressing an out-of-the-box warning or lint diagnostic
67
+ (see [the docs](https://dart.dev/tools/analysis#suppressing-diagnostics-for-a-file)).
68
+ To suppress a warning or lint named "some_code" in a plugin named "some_plugin,"
69
+ use a comment like the following :
70
+
71
+ ` ` ` dart
72
+ // ignore: some_plugin/some_code
73
+
74
+ // ignore_for_file: some_plugin/some_code
75
+ ` ` `
0 commit comments