@@ -29,7 +29,8 @@ analyzer:
29
29
30
30
linter :
31
31
rules :
32
- # This list is derived from the list of all available lints located at
32
+ # these rules are documented on and in the same order as
33
+ # the Dart Lint rules page to make maintenance easier
33
34
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
34
35
- always_declare_return_types
35
36
- always_put_control_body_on_new_line
@@ -40,34 +41,32 @@ linter:
40
41
- annotate_overrides
41
42
# - avoid_annotating_with_dynamic # conflicts with always_specify_types
42
43
- avoid_bool_literals_in_conditional_expressions
43
- # - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
44
- # - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
44
+ # - avoid_catches_without_on_clauses # we do this commonly
45
+ # - avoid_catching_errors # we do this commonly
45
46
- avoid_classes_with_only_static_members
46
- - avoid_double_and_int_checks
47
+ # - avoid_double_and_int_checks # only useful when targeting JS runtime
47
48
- avoid_dynamic_calls
48
49
- avoid_empty_else
49
50
- avoid_equals_and_hash_code_on_mutable_classes
50
51
- avoid_escaping_inner_quotes
51
52
- avoid_field_initializers_in_const_classes
52
- # - avoid_final_parameters # incompatible with prefer_final_parameters
53
53
- avoid_function_literals_in_foreach_calls
54
- - avoid_implementing_value_types
54
+ # - avoid_implementing_value_types # not yet tested
55
55
- avoid_init_to_null
56
- - avoid_js_rounded_ints
57
- # - avoid_multiple_declarations_per_line # seems to be a stylistic choice we don't subscribe to
56
+ # - avoid_js_rounded_ints # only useful when targeting JS runtime
58
57
- avoid_null_checks_in_equality_operators
59
- # - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
60
- - avoid_print
58
+ # - avoid_positional_boolean_parameters # not yet tested
59
+ # - avoid_print # not yet tested
61
60
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
62
61
- avoid_redundant_argument_values
63
62
- avoid_relative_lib_imports
64
63
- avoid_renaming_method_parameters
65
64
- avoid_return_types_on_setters
66
- # - avoid_returning_null # still violated by some pre-nnbd code that we haven't yet migrated
67
- - avoid_returning_null_for_future
65
+ # - avoid_returning_null # there are plenty of valid reasons to return null
66
+ # - avoid_returning_null_for_future # not yet tested
68
67
- avoid_returning_null_for_void
69
- # - avoid_returning_this # there are enough valid reasons to return ` this` that this lint ends up with too many false positives
70
- - avoid_setters_without_getters
68
+ # - avoid_returning_this # there are plenty of valid reasons to return this
69
+ # - avoid_setters_without_getters # not yet tested
71
70
- avoid_shadowing_type_parameters
72
71
- avoid_single_cascade_in_expression_statements
73
72
- avoid_slow_async_io
@@ -77,28 +76,24 @@ linter:
77
76
- avoid_unnecessary_containers
78
77
- avoid_unused_constructor_parameters
79
78
- avoid_void_async
80
- # - avoid_web_libraries_in_flutter # we use web libraries in web-specific code, and our tests prevent us from using them elsewhere
79
+ # - avoid_web_libraries_in_flutter # not yet tested
81
80
- await_only_futures
82
81
- camel_case_extensions
83
82
- camel_case_types
84
83
- cancel_subscriptions
85
- # - cascade_invocations # doesn't match the typical style of this repo
86
- - cast_nullable_to_non_nullable
84
+ # - cascade_invocations # not yet tested
87
85
# - close_sinks # not reliable enough
88
86
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
89
- # - conditional_uri_does_not_exist # not yet tested
90
87
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
91
88
- control_flow_in_finally
92
89
# - curly_braces_in_flow_control_structures # not required by flutter style
93
- - depend_on_referenced_packages
94
90
- deprecated_consistency
95
- # - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
91
+ # - diagnostic_describe_all_properties # not yet tested
96
92
- directives_ordering
97
- # - do_not_use_environment # there are appropriate times to use the environment, especially in our tests and build logic
93
+ # - do_not_use_environment # we do this commonly
98
94
- empty_catches
99
95
- empty_constructor_bodies
100
96
- empty_statements
101
- - eol_at_end_of_file
102
97
- exhaustive_cases
103
98
- file_names
104
99
- flutter_style_todos
@@ -110,25 +105,22 @@ linter:
110
105
- leading_newlines_in_multiline_strings
111
106
- library_names
112
107
- library_prefixes
113
- - library_private_types_in_public_api
114
108
# - lines_longer_than_80_chars # not required by flutter style
115
109
- list_remove_unrelated_type
116
- # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter /issues/453
110
+ # - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk /issues/34181
117
111
- missing_whitespace_between_adjacent_strings
118
112
- no_adjacent_strings_in_list
119
- - no_default_cases
113
+ # - no_default_cases # too many false positives
120
114
- no_duplicate_case_values
121
- - no_leading_underscores_for_library_prefixes
122
- - no_leading_underscores_for_local_identifiers
123
115
- no_logic_in_create_state
124
116
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
125
- - non_constant_identifier_names
126
117
- noop_primitive_operations
118
+ - non_constant_identifier_names
127
119
- null_check_on_nullable_type_parameter
128
120
- null_closures
129
121
# - omit_local_variable_types # opposite of always_specify_types
130
122
# - one_member_abstracts # too many false positives
131
- - only_throw_errors # this does get disabled in a few places where we have legacy code that uses strings et al
123
+ # - only_throw_errors # https://github.com/flutter/flutter/issues/5792
132
124
- overridden_fields
133
125
- package_api_docs
134
126
- package_names
@@ -151,7 +143,6 @@ linter:
151
143
- prefer_final_fields
152
144
- prefer_final_in_for_each
153
145
- prefer_final_locals
154
- # - prefer_final_parameters # we should enable this one day when it can be auto-fixed (https://github.com/dart-lang/linter/issues/3104), see also parameter_assignments
155
146
- prefer_for_elements_to_map_fromIterable
156
147
- prefer_foreach
157
148
- prefer_function_declarations_over_variables
@@ -166,23 +157,20 @@ linter:
166
157
- prefer_is_not_empty
167
158
- prefer_is_not_operator
168
159
- prefer_iterable_whereType
169
- # - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
170
- # - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
160
+ # - prefer_mixin # https://github.com/dart-lang/language/issues/32
171
161
- prefer_null_aware_operators
172
- - prefer_relative_imports
162
+ # - prefer_relative_imports # incompatible with sub-package imports
173
163
- prefer_single_quotes
174
164
- prefer_spread_collections
175
165
- prefer_typing_uninitialized_variables
176
166
- prefer_void_to_null
177
167
- provide_deprecation_message
178
168
# - public_member_api_docs # enabled on a case-by-case basis; see e.g. packages/analysis_options.yaml
179
169
- recursive_getters
180
- # - require_trailing_commas # blocked on https://github.com/dart-lang/sdk/issues/47441
181
- - secure_pubspec_urls
170
+ - require_trailing_commas
182
171
- sized_box_for_whitespace
183
- # - sized_box_shrink_expand # not yet tested
184
172
- slash_for_doc_comments
185
- - sort_child_properties_last
173
+ # - sort_child_properties_last # not yet tested
186
174
- sort_constructors_first
187
175
# - sort_pub_dependencies # prevents separating pinned transitive dependencies
188
176
- sort_unnamed_constructors_first
@@ -191,45 +179,38 @@ linter:
191
179
- tighten_type_of_initializing_formals
192
180
# - type_annotate_public_apis # subset of always_specify_types
193
181
- type_init_formals
194
- # - unawaited_futures # too many false positives, especially with the way AnimationController works
182
+ # - unawaited_futures # too many false positives
195
183
- unnecessary_await_in_return
196
184
- unnecessary_brace_in_string_interps
197
185
- unnecessary_const
198
- - unnecessary_constructor_name
199
186
# - unnecessary_final # conflicts with prefer_final_locals
200
187
- unnecessary_getters_setters
201
188
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
202
- - unnecessary_late
203
189
- unnecessary_new
204
190
- unnecessary_null_aware_assignments
205
191
- unnecessary_null_checks
206
192
- unnecessary_null_in_if_null_operators
207
193
- unnecessary_nullable_for_final_variable_declarations
208
194
- unnecessary_overrides
209
195
- unnecessary_parenthesis
210
- # - unnecessary_raw_strings # what's "necessary" is a matter of opinion; consistency across strings can help readability more than this lint
196
+ # - unnecessary_raw_strings # not yet tested
211
197
- unnecessary_statements
212
198
- unnecessary_string_escapes
213
199
- unnecessary_string_interpolations
214
200
- unnecessary_this
215
201
- unrelated_type_equality_checks
216
- - unsafe_html
217
- # - use_build_context_synchronously
218
- # - use_colored_box # not yet tested
219
- # - use_decorated_box # not yet tested
220
- # - use_enums # not yet tested
202
+ # - unsafe_html # not yet tested
221
203
- use_full_hex_values_for_flutter_colors
222
204
- use_function_type_syntax_for_parameters
223
- - use_if_null_to_convert_nulls_to_bools
205
+ # - use_if_null_to_convert_nulls_to_bools # not yet tested
224
206
- use_is_even_rather_than_modulo
225
207
- use_key_in_widget_constructors
226
208
- use_late_for_private_fields_and_variables
227
209
- use_named_constants
228
210
- use_raw_strings
229
211
- use_rethrow_when_possible
230
- - use_setters_to_change_properties
212
+ # - use_setters_to_change_properties # not yet tested
231
213
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
232
- - use_super_parameters
233
214
- use_test_throws_matchers
234
215
# - use_to_and_as_if_applicable # has false positives, so we prefer to catch this by code-review
235
216
- valid_regexps
0 commit comments