|
| 1 | +# Specify analysis options. |
| 2 | +# |
| 3 | +# Until there are meta linter rules, each desired lint must be explicitly enabled. |
| 4 | +# See: https://github.com/dart-lang/linter/issues/288 |
| 5 | +# |
| 6 | +# For a list of lints, see: http://dart-lang.github.io/linter/lints/ |
| 7 | +# See the configuration guide for more |
| 8 | +# https://github.com/dart-lang/sdk/tree/master/pkg/analyzer#configuring-the-analyzer |
| 9 | +# |
| 10 | +# NOTE: Please keep this file in sync with |
| 11 | +# https://github.com/flutter/flutter/blob/master/.analysis_options |
| 12 | + |
| 13 | +analyzer: |
| 14 | + language: |
| 15 | + enableStrictCallChecks: true |
| 16 | + enableSuperMixins: true |
| 17 | + enableAssertInitializer: true |
| 18 | + strong-mode: |
| 19 | + implicit-dynamic: false |
| 20 | + errors: |
| 21 | + # treat missing required parameters as a warning (not a hint) |
| 22 | + missing_required_param: warning |
| 23 | + # treat missing returns as a warning (not a hint) |
| 24 | + missing_return: warning |
| 25 | + # allow having TODOs in the code |
| 26 | + todo: ignore |
| 27 | + exclude: |
| 28 | + - 'bin/cache/**' |
| 29 | + # the following two are relative to the stocks example and the flutter package respectively |
| 30 | + # see https://github.com/dart-lang/sdk/issues/28463 |
| 31 | + - 'lib/i18n/stock_messages_*.dart' |
| 32 | + - 'lib/src/http/**' |
| 33 | + |
| 34 | +linter: |
| 35 | + rules: |
| 36 | + # these rules are documented on and in the same order as |
| 37 | + # the Dart Lint rules page to make maintenance easier |
| 38 | + # http://dart-lang.github.io/linter/lints/ |
| 39 | + |
| 40 | + # === error rules === |
| 41 | + - avoid_empty_else |
| 42 | + - avoid_slow_async_io |
| 43 | + - cancel_subscriptions |
| 44 | + # - close_sinks # https://github.com/flutter/flutter/issues/5789 |
| 45 | + # - comment_references # blocked on https://github.com/dart-lang/dartdoc/issues/1153 |
| 46 | + - control_flow_in_finally |
| 47 | + - empty_statements |
| 48 | + - hash_and_equals |
| 49 | + # - invariant_booleans # https://github.com/flutter/flutter/issues/5790 |
| 50 | + - iterable_contains_unrelated_type |
| 51 | + - list_remove_unrelated_type |
| 52 | + # - literal_only_boolean_expressions # https://github.com/flutter/flutter/issues/5791 |
| 53 | + - no_adjacent_strings_in_list |
| 54 | + - no_duplicate_case_values |
| 55 | + - test_types_in_equals |
| 56 | + - throw_in_finally |
| 57 | + - unrelated_type_equality_checks |
| 58 | + - valid_regexps |
| 59 | + |
| 60 | + # === style rules === |
| 61 | + - always_declare_return_types |
| 62 | + # - always_put_control_body_on_new_line |
| 63 | + - always_require_non_null_named_parameters |
| 64 | + - always_specify_types |
| 65 | + - annotate_overrides |
| 66 | + # - avoid_annotating_with_dynamic # not yet tested |
| 67 | + - avoid_as |
| 68 | + # - avoid_catches_without_on_clauses # not yet tested |
| 69 | + # - avoid_catching_errors # not yet tested |
| 70 | + # - avoid_classes_with_only_static_members # not yet tested |
| 71 | + # - avoid_function_literals_in_foreach_calls # not yet tested |
| 72 | + - avoid_init_to_null |
| 73 | + - avoid_null_checks_in_equality_operators |
| 74 | + # - avoid_positional_boolean_parameters # not yet tested |
| 75 | + - avoid_return_types_on_setters |
| 76 | + # - avoid_returning_null # not yet tested |
| 77 | + # - avoid_returning_this # not yet tested |
| 78 | + # - avoid_setters_without_getters # not yet tested |
| 79 | + # - avoid_types_on_closure_parameters # not yet tested |
| 80 | + - await_only_futures |
| 81 | + - camel_case_types |
| 82 | + # - cascade_invocations # not yet tested |
| 83 | + # - constant_identifier_names # https://github.com/dart-lang/linter/issues/204 |
| 84 | + - directives_ordering |
| 85 | + - empty_catches |
| 86 | + - empty_constructor_bodies |
| 87 | + - implementation_imports |
| 88 | + # - join_return_with_assignment # not yet tested |
| 89 | + - library_names |
| 90 | + - library_prefixes |
| 91 | + - non_constant_identifier_names |
| 92 | + # - omit_local_variable_types # opposite of always_specify_types |
| 93 | + # - one_member_abstracts # too many false positives |
| 94 | + # - only_throw_errors # https://github.com/flutter/flutter/issues/5792 |
| 95 | + - overridden_fields |
| 96 | + - package_api_docs |
| 97 | + - package_prefixed_library_names |
| 98 | + # - parameter_assignments # we do this commonly |
| 99 | + - prefer_adjacent_string_concatenation |
| 100 | + - prefer_collection_literals |
| 101 | + # - prefer_conditional_assignment # not yet tested |
| 102 | + - prefer_const_constructors |
| 103 | + # - prefer_constructors_over_static_methods # not yet tested |
| 104 | + - prefer_contains |
| 105 | + # - prefer_expression_function_bodies # conflicts with https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#consider-using--for-short-functions-and-methods |
| 106 | + # - prefer_final_fields # https://github.com/dart-lang/linter/issues/506 |
| 107 | + - prefer_final_locals |
| 108 | + # - prefer_foreach # not yet tested |
| 109 | + # - prefer_function_declarations_over_variables # not yet tested |
| 110 | + - prefer_initializing_formals |
| 111 | + # - prefer_interpolation_to_compose_strings # not yet tested |
| 112 | + - prefer_is_empty |
| 113 | + - prefer_is_not_empty |
| 114 | + # - public_member_api_docs # this is the only difference from .analysis_options_repo |
| 115 | + # - recursive_getters # https://github.com/dart-lang/linter/issues/452 |
| 116 | + - slash_for_doc_comments |
| 117 | + - sort_constructors_first |
| 118 | + - sort_unnamed_constructors_first |
| 119 | + - super_goes_last |
| 120 | + # - type_annotate_public_apis # subset of always_specify_types |
| 121 | + - type_init_formals |
| 122 | + # - unawaited_futures # https://github.com/flutter/flutter/issues/5793 |
| 123 | + - unnecessary_brace_in_string_interps |
| 124 | + - unnecessary_getters_setters |
| 125 | + # - unnecessary_lambdas # https://github.com/dart-lang/linter/issues/498 |
| 126 | + - unnecessary_null_aware_assignments |
| 127 | + - unnecessary_null_in_if_null_operators |
| 128 | + # - unnecessary_overrides # https://github.com/dart-lang/linter/issues/626 and https://github.com/dart-lang/linter/issues/627 |
| 129 | + - unnecessary_this |
| 130 | + - use_rethrow_when_possible |
| 131 | + # - use_setters_to_change_properties # not yet tested |
| 132 | + # - use_string_buffers # https://github.com/dart-lang/linter/pull/664 |
| 133 | + # - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review |
| 134 | + |
| 135 | + # === pub rules === |
| 136 | + - package_names |
0 commit comments