You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 20, 2024. It is now read-only.
Linter for Dart gives you feedback to help you keep your code in line with the published [Dart Style Guide](https://www.dartlang.org/articles/style-guide/). Currently enforced lint rules (or "lints") are catalogued [here](http://dart-lang.github.io/linter/lints/). When you run the linter all lints are enabled but don't worry, configuration, wherein you can specifically enable/disable lints, is in the [works](https://github.com/dart-lang/linter/issues/7). While initial focus is on style lints, other lints that catch common programming errors are certainly of interest. If you have ideas, please file a [feature request][tracker].
23
-
24
-
Running the linter via `pub` looks like this:
25
-
26
-
$ pub global run linter my_project
27
-
28
-
With example output will looking like this:
29
-
30
-
my_project/my_library.dart 13:8 [lint] Name non-constant identifiers using lowerCamelCase.
31
-
IOSink std_err = stderr;
32
-
^^^^^^^
33
-
12 files analyzed, 1 issue found.
34
-
35
-
Supported options are
36
-
37
-
-h, --help Shows usage information.
38
-
-s, --stats Show lint statistics.
39
-
--[no-]visit-transitive-closure Visit the transitive closure of imported/exported libraries.
40
-
-q, --[no-]quiet Don't show individual lint errors.
The linter gives you feedback to help you catch potential errors and keep your code in line with the published [Dart Style Guide](https://www.dartlang.org/articles/style-guide/). Currently enforcable lint rules (or "lints") are catalogued [here][lints] and can be configured via an [analysis options file][options_file]. The linter is run from within the `dartanalyzer`[command-line tool](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli#dartanalyzer) shipped with the Dart SDK. Assuming you have lints configured in an `.analysis_options` file with these contents:
44
21
45
-
Note that you should not need to specify an `sdk` or `package-root`. Lint configuration file format is provisional and under [active discussion](https://github.com/dart-lang/linter/issues/41). Other configuration options are on the way.
22
+
```
23
+
linter:
24
+
rules:
25
+
- annotate_overrides
26
+
- hash_and_equals
27
+
- prefer_is_not_empty
28
+
```
29
+
you could lint your package like this:
46
30
31
+
$ dartanalyzer --options .analysis_options .
32
+
33
+
and see any violations of the `annotate_overrides`, `hash_and_equals`, and `prefer_is_not_empty` rules in the console. In practice you would probably configure quite a few more rules (the full list is [here][lints]). For more on configuring analysis, see the analysis option file [docs][options_file].
47
34
48
35
## Contributing
49
36
@@ -55,4 +42,6 @@ Feedback is, of course, greatly appreciated and contributions are welcome! Pleas
55
42
Please file feature requests and bugs at the [issue tracker][tracker].
0 commit comments