flutter_analysis_options 2.49 KB
Newer Older
1 2 3 4 5
# Specify analysis options.
#
# Note that until there is a default "all-in" lint rule-set we need
# to opt-in to all desired lints (https://github.com/dart-lang/sdk/issues/25843).
# For a list of lints, see: http://dart-lang.github.io/linter/lints/
6
#
7
# This file is the .analysis_options file used by "flutter analyze".
8 9 10
# It isn't named that because otherwise editors like Atom would try
# to use it, and that wouldn't work because it enables things that
# need to be silenced, in particular, public_member_api_docs.
11 12
#
# When editing, make sure you keep /.analysis_options consistent.
13

14
analyzer:
15
  language:
16
    enableStrictCallChecks: true
17
    enableSuperMixins: true
Hixie's avatar
Hixie committed
18
  strong-mode: true
19 20 21 22 23
  errors:
    # we allow overriding fields (if they use super, ideally...)
    strong_mode_invalid_field_override: ignore
    # we allow type narrowing
    strong_mode_invalid_method_override: ignore
Hixie's avatar
Hixie committed
24 25 26
    strong_mode_static_type_error: ignore
    strong_mode_down_cast_composite: ignore
    # we allow having TODOs in the code
27
    todo: ignore
28

29 30
linter:
  rules:
31 32 33 34
    # these are in the same order as http://dart-lang.github.io/linter/lints/
    # to make maintenance easier

    # # error rules
35
    - avoid_empty_else
36 37 38 39 40 41 42 43 44
    # - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153
    - control_flow_in_finally
    - hash_and_equals
    # - iterable_contains_unrelated_type # https://github.com/dart-lang/linter/issues/245
    - test_types_in_equals
    - throw_in_finally
    - unrelated_type_equality_checks

    # style rules
45
    - always_declare_return_types
Ian Hickson's avatar
Ian Hickson committed
46
    - always_specify_types
47
    - annotate_overrides
48
    - avoid_as
Ian Hickson's avatar
Ian Hickson committed
49
    - avoid_init_to_null
50
    - avoid_return_types_on_setters
51
    - await_only_futures
52
    - camel_case_types
53 54
    # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204
    - control_flow_in_finally
55
    - empty_constructor_bodies
56
    - implementation_imports
Ian Hickson's avatar
Ian Hickson committed
57
    - library_names
58 59
    - library_prefixes
    - non_constant_identifier_names
60
    - one_member_abstracts
61
    # - overriden_field # the analyzer code itself violates this right now :-)
Ian Hickson's avatar
Ian Hickson committed
62 63 64
    - package_api_docs
    - package_prefixed_library_names
    - prefer_is_not_empty
65
    - public_member_api_docs
66
    - slash_for_doc_comments
Ian Hickson's avatar
Ian Hickson committed
67 68
    - sort_constructors_first
    - sort_unnamed_constructors_first
69
    - super_goes_last
70
    # - type_annotate_public_apis # subset of always_specify_types
71 72
    - type_init_formals
    - unnecessary_brace_in_string_interp
Ian Hickson's avatar
Ian Hickson committed
73
    - unnecessary_getters_setters
74 75 76

    # pub rules
    - package_names