@@ -5,7 +5,7 @@ can be enabled for a given package, so that the plugin can report diagnostics
55(lints and warnings) and offer quick fixes. Plugins are enabled via the
66` analysis_options.yaml ` file under the top-level ` plugins ` section:
77
8- ```
8+ ``` yaml
99plugins :
1010 my_plugin : ^1.0.0
1111` ` `
@@ -26,7 +26,7 @@ as the key. The value can either be
2626
2727For example, while developing a plugin locally, it can be enabled as :
2828
29- ```
29+ ` ` ` yaml
3030plugins:
3131 my_plugin:
3232 path: /path/to/my_plugin
@@ -37,3 +37,39 @@ Note: after any change is made to the `plugins` section of an
3737the effects.
3838
3939[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