Is there a tool for lint to check the code for a Dart style guide?

I would like to write code that matches the Dart style guide. So I'm curious if there is any automatic way to check the coding style for Dart.

Do you know of any way to do this?

+6
source share
2 answers

Since Dart 1.13 (the currently released candidate), you can enable lint checks, strong mode and other functions by adding the .analysis_options file to the Dart project (the folder with the pubspec.yaml file)

 analyzer: strong-mode: true exclude: - test/data/** language: enableSuperMixins: true linter: rules: # see http://dart-lang.imtqy.com/linter/lints/ - always_declare_return_types - always_specify_types - camel_case_types - constant_identifier_names - empty_constructor_bodies - implementation_imports - library_names - library_prefixes - non_constant_identifier_names - one_member_abstracts - package_api_docs - package_prefixed_library_names - slash_for_doc_comments - super_goes_last - type_init_formals # - unnecessary_brace_in_string_interp - unnecessary_getters_setters - package_names 

Available lint rules are listed at http://dart-lang.imtqy.com/linter/lints/

see also

+4
source

There is an open issue that you can vote for adding this feature to the Dart Editor:

https://code.google.com/p/dart/issues/detail?id=2059

+4
source

Source: https://habr.com/ru/post/954522/


All Articles