Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

linter

Linter for Dart.

Subscribe to updates I use linter


Statistics on linter

Number of watchers on Github 46
Number of open issues 190
Average time to close an issue 10 days
Main language Dart
Average time to merge a PR 1 day
Open pull requests 24+
Closed pull requests 11+
Last commit over 1 year ago
Repo Created almost 5 years ago
Repo Last Updated over 1 year ago
Size 1.43 MB
Homepage https://dart-lang...
Organization / Authordart-lang
Latest Release0.1.43
Contributors6
Page Updated
Do you use linter? Leave a review!
View open issues (190)
View linter activity
View on github
Fresh, new opensource launches πŸš€πŸš€πŸš€
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating linter for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Linter for Dart

A Dart style linter.

Build Status Build status Coverage Status Pub

Installing

The linter is bundled with the Dart SDK; if you have an updated Dart SDK already, you're done!

Alternatively, if you want to contribute to the linter or examine the source, clone the linter repo like this:

$ git clone https://github.com/dart-lang/linter.git

Usage

The linter gives you feedback to help you catch potential errors and keep your code in line with the published Dart Style Guide. Currently enforcable lint rules (or lints) are catalogued here and can be configured via an analysis options file. The linter is run from within the dartanalyzer command-line tool shipped with the Dart SDK. Assuming you have lints configured in an analysis_options.yaml file with these contents:

linter:
  rules:
    - annotate_overrides
    - hash_and_equals
    - prefer_is_not_empty

you could lint your package like this:

$ dartanalyzer --options analysis_options.yaml .

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).

If a specific lint warning should be ignored, it can be flagged with a comment. For example,

   // ignore: avoid_as
   (pm as Person).firstName = 'Seth'

tells the dartanalyzer to ignore this instance of avoid_as warning. As lints are treated the same as errors and warnings by the analyzer, their severity can similarly be configured in an options file. For example, an analysis options file that specifies

linter:
  rules:
    - avoid_as
analyzer:
  errors:
    avoid_as: error

tells the analyzer to treat avoid_as lints as errors. For more on configuring analysis see the analysis option file docs.

Contributing

Feedback is, of course, greatly appreciated and contributions are welcome! Please read the contribution guidelines; mechanics of writing lints are covered here.

Features and bugs

Please file feature requests and bugs at the issue tracker.

linter open issues Ask a question     (View All Issues)
  • almost 3 years Release new version
  • almost 3 years Lint prefer_final_fields fails for private field modified outside of containing class
  • almost 3 years new lint rule for passing null to Iterable's firstWhere's orElse
  • almost 3 years AVOID mixing in a class that isn’t intended to be a mixin.
  • almost 3 years Provide an `exclude` option for linters in .analysis_options
  • about 3 years constant_identifier_names should do file-by-file consistency only
  • about 3 years cancel_subscriptions can't tell that I'm closing the subscription
  • about 3 years parameter_assignments always fails for optional/named parameters
  • about 3 years Annotation for methods that can be overridden but not called
  • about 3 years Avoid classes with only static members
  • about 3 years Incomplete lint: implementation_imports
  • about 3 years Ordering import and export directives
  • about 3 years Single and double quote string literal consistency
  • about 3 years Update the default analyzer lint set to be more assertive.
  • about 3 years Library prefixes should also support the `$` token
  • about 3 years Rule to warn when a getter has a side effect
  • about 3 years Linter tool support for embedded SDKs.
  • about 3 years Update doc publishing to use new GitHub Pages flow.
  • about 3 years What lints operate on file-by-file (i.e., would not need package graph/analysis)
  • about 3 years Meta linter rules
  • about 3 years Extend leak_detector_visitor rules to include disposer classes
  • about 3 years public_member_api_docs should not require docs for trivial constructors
  • about 3 years Lint class structure best practices for fields
  • about 3 years Review generated lint rule docs.
  • about 3 years Update README.
  • about 3 years Preference for single quotes in simple strings
  • over 3 years unnecessary_getters_setters should not warn if getter or setter is overriden in a derived class
  • over 3 years Lint for catching cases of assigning Iterables to Lists
  • over 3 years unused method tear offs
  • over 3 years Run rules in parallel
linter open pull requests (View All Pulls)
  • migrate tests to use pkg/test
  • Invocation of Iterable<E>.contains with reference of unrelated type.
  • Conditions should not unconditionally evaluate to "TRUE" or to "FALSE"
  • Cancel subscriptions
  • Close instances of dart.core.Sink
  • New AvoidImportingForSdk rule
  • Lint that flags usages of implicitly-dynamic values
  • Add --strong flag to use strong-mode analyzer
  • Cover more use cases where '$' may be used
  • parameter_assignment : Allow ??= assignation for optional parameters …
  • New rule for AngularDart2 : Specify template or templateUrl but not both when annotating with @Component.
  • cascade_invocations: Include assignment expressions when looking for cascade candidates.
  • LeakDetectorVisitor: Include cascade operators when searching for invocations on variable.
  • Add prefer_const_constructor rule (#129)
  • use_string_buffers false positive for 'b = b + x' if b is not a String
  • Clean some type check (is operator) using visitors.
  • New rule: prefer_async_await_over_raw_futures
  • New Rule: Do not pass null arguments where a closure is expected.
  • avoid_shadowing
  • sort_constructors_first applies for all members
  • Remove deprecated calls to `enableAssertInitializer` [BLOCKED]
  • New rule: Prefer spaces before EOL in string literals on the left
  • invariant_booleans: Fix false positive in loops inside cases of break statements
  • add avoid_renaming_method_parameters
linter questions on Stackoverflow (View All Questions)
  • Atom linter-erb failing with "Error: /usr/bin/env: ruby: No such file or directory"
  • language-gamescript and linter in Atom does't work
  • How to remove popup warning in Sublime Linter?
  • Visual Studio Code Linter ES7/Babel code
  • Closure linter warning about interfaces
  • Sublime Text 3 java linter shows errors for imports
  • How change my editer's linter configuration ATOM .jshintrc setting where do i put in
  • Can't get Atom Linter to work
  • Java Linter in Sublime Text 3
  • Atom Linter Not Work Said No Issue
  • Integrate a linter to XCode like SwiftLint
  • Atom PHP Linter on Remote Development
  • Sublime sass linter says there is an error but there isn't
  • Ignore "tabs" in sublime linter CSS
  • Linter that warns about implicit string concatenation in Python
  • Enable JSX in Closure Linter
  • Linter gives "Error parsing URL" error
  • Sublime Linter will only lint the current file in a Sublime Text 3 project
  • Is there a more strict Android java linter?
  • Linter not working correctly: Atom
  • Implied globals are not caught as linter errors
  • Any python linter to warn var shadow argument
  • Atom editor - linter-scss-lint error
  • How can I set the pep8 linter to accept 2 space indents?
  • What is the difference between a linter and a validator?
  • Sublime Seems to be using JSHint linter instead of Anaconda
  • Rails: require JS code to pass the Closure Linter or JSHint
  • Sublime PHP Linter Executabe Path on Vagrant
  • How to resize the linter output in Atom?
  • How do I make the Visual Studio Code linter ignore a line?
linter list of languages used
linter latest release notes
0.1.43 0.1.43

0.1.43

  • new prefer_const_declarations.dart lint
  • new prefer_const_literals_to_create_immutables lint
  • miscellaneous documentation improvements
0.1.42 0.1.42

0.1.42

  • added support for external constructors in avoid_unused_constructor_parameters
  • added code reference resolution docs for comment_references
0.1.41 0.1.41

0.1.41

  • broadened args package dependency to support versions 1.*
Other projects in Dart