1
- # ~ Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2
- # ~ for details. All rights reserved. Use of this source code is governed by a
3
- # ~ BSD-style license that can be found in the LICENSE file.
4
- # ~
5
- # ~ A living list of rules following the Effective Dart guide.
6
- # ~ https://www.dartlang.org/guides/language/effective-dart
7
- # ~
8
- # ~ Note: not everything suggested in the guide has a rule associated with it.
1
+ # This file configures the analyzer, which statically analyzes Dart code to
2
+ # check for errors, warnings, and lints.
3
+ #
4
+ # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5
+ # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6
+ # invoked from the command line by running `flutter analyze`.
9
7
10
- analyzer :
11
- # strong-mode:
12
- # implicit-casts: false
13
- # implicit-dynamic: false
14
- errors :
15
- todo : ignore
16
- # exclude:
8
+ # The following line activates a set of recommended lints for Flutter apps,
9
+ # packages, and plugins designed to encourage good coding practices.
10
+ include : package:flutter_lints/flutter.yaml
17
11
18
- # ~ Effective dart lint rules form https://github.com/dart-lang/linter
19
- # ~ We have implemented all but lines_longer_than_80_chars & public_member_api_docs
20
12
linter :
13
+ # The lint rules applied to this project can be customized in the
14
+ # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15
+ # included above or to enable additional rules. A list of all available lints
16
+ # and their documentation is published at https://dart.dev/lints.
17
+ #
18
+ # Instead of disabling a lint rule for the entire project in the
19
+ # section below, it can also be suppressed for a single line of code
20
+ # or a specific dart file by using the `// ignore: name_of_lint` and
21
+ # `// ignore_for_file: name_of_lint` syntax on the line or in the file
22
+ # producing the lint.
21
23
rules :
22
- # ~ --- STYLE
23
- # ~ identifiers
24
- - camel_case_types
25
- - library_names
26
- - file_names
27
- - library_prefixes
28
- - non_constant_identifier_names
29
- - constant_identifier_names # ~ prefer
30
- # ~ ordering
31
- - directives_ordering
32
- # ~ formating
33
- - curly_braces_in_flow_control_structures
34
- # ~ --- DOCUMENTATION
35
- # ~ comments
36
- # ~ doc comments
37
- - slash_for_doc_comments
38
- - package_api_docs # ~ prefer
39
- - comment_references
40
- # ~ markdown
41
- # ~ writing
42
- # ~ --- USAGE
43
- # ~ libraries
44
- - implementation_imports
45
- - avoid_relative_lib_imports
46
- # ~ strings
47
- - prefer_adjacent_string_concatenation
48
- - prefer_interpolation_to_compose_strings # ~ prefer
49
- - unnecessary_brace_in_string_interps # ~ avoid
50
- # ~ collections
51
- - prefer_collection_literals
52
- - avoid_function_literals_in_foreach_calls # ~ avoid
53
- - prefer_iterable_whereType
54
- # ~ functions
55
- - prefer_function_declarations_over_variables
56
- - unnecessary_lambdas
57
- # ~ variables
58
- - avoid_init_to_null
59
- # ~ members
60
- - unnecessary_getters_setters
61
- - prefer_final_fields
62
- - prefer_expression_function_bodies # consider
63
- - unnecessary_this
64
- - prefer_typing_uninitialized_variables
65
- # ~ constructors
66
- - prefer_initializing_formals
67
- - type_init_formals
68
- - empty_constructor_bodies
69
- - unnecessary_new
70
- - unnecessary_const
71
- # ~ error handling
72
- - avoid_catches_without_on_clauses # ~ avoid
73
- - use_rethrow_when_possible
74
- # ~ asynchrony
75
- # ~ --- DESIGN
76
- # ~ names
77
- - use_to_and_as_if_applicable
78
- # ~ libraries
79
- # ~ classes
80
- - one_member_abstracts # ~ avoid
81
- - avoid_classes_with_only_static_members # ~ avoid
82
- # ~ constructors
83
- - prefer_constructors_over_static_methods
84
- # ~ members
85
- - use_setters_to_change_properties
86
- - avoid_setters_without_getters
87
- - avoid_returning_this # ~ avoid
88
- # ~ types
89
- - type_annotate_public_apis # ~ prefer
90
- - omit_local_variable_types # ~ avoid
91
- - avoid_types_on_closure_parameters # ~ avoid
92
- - avoid_return_types_on_setters
93
- - prefer_generic_function_type_aliases
94
- - avoid_private_typedef_functions # ~ prefer
95
- # ~ parameters
96
- - avoid_positional_boolean_parameters # ~ avoid
97
- # ~ equality
98
- - hash_and_equals
99
- - avoid_null_checks_in_equality_operators
100
-
101
- # ~ Rules that are not used but are recommended by effective dart:
102
- #
103
- # - public_member_api_docs # ~ We don't have time to document everything yet
104
- # - lines_longer_than_80_chars # prefer # ~ Doesn't seem reasonable
24
+ # avoid_print: false # Uncomment to disable the `avoid_print` rule
25
+ # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
105
26
106
- # ~ Rules that are not used
107
- # - always_declare_return_types
108
- # - always_put_control_body_on_new_line
109
- # - always_put_required_named_parameters_first
110
- # - always_require_non_null_named_parameters
111
- # - always_specify_types
112
- # - annotate_overrides
113
- # - avoid_annotating_with_dynamic
114
- # - avoid_as
115
- # - avoid_bool_literals_in_conditional_expressions
116
- # - avoid_catching_errors
117
- # - avoid_double_and_int_checks
118
- # - avoid_empty_else
119
- # - avoid_field_initializers_in_const_classes
120
- # - avoid_js_rounded_ints
121
- # - avoid_renaming_method_parameters
122
- # - avoid_single_cascade_in_expression_statements
123
- # - avoid_slow_async_io
124
- # - avoid_types_as_parameter_names
125
- # - avoid_unused_constructor_parameters
126
- # - await_only_futures
127
- # - cancel_subscriptions
128
- # - cascade_invocations
129
- # - close_sinks
130
- # - control_flow_in_finally
131
- # - empty_catches
132
- # - empty_statements
133
- # - invariant_booleans
134
- # - iterable_contains_unrelated_type
135
- # - join_return_with_assignment
136
- # - list_remove_unrelated_type
137
- # - literal_only_boolean_expressions
138
- # - no_adjacent_strings_in_list
139
- # - no_duplicate_case_values
140
- # - null_closures
141
- # - only_throw_errors
142
- # - overridden_fields
143
- # - package_names
144
- # - package_prefixed_library_names
145
- # - parameter_assignments
146
- # - prefer_asserts_in_initializer_lists
147
- # - prefer_bool_in_asserts
148
- # - prefer_conditional_assignment
149
- # - prefer_const_constructors
150
- # - prefer_const_constructors_in_immutables
151
- # - prefer_const_declarations
152
- # - prefer_const_literals_to_create_immutables
153
- # - prefer_contains
154
- # - prefer_expression_function_bodies
155
- # - prefer_final_locals
156
- # - prefer_foreach
157
- # - prefer_is_empty
158
- # - prefer_is_not_empty
159
- # - prefer_single_quotes
160
- # - recursive_getters
161
- # - sort_constructors_first
162
- # - sort_unnamed_constructors_first
163
- # - super_goes_last
164
- # - test_types_in_equals
165
- # - throw_in_finally
166
- # - unawaited_futures
167
- # - unnecessary_null_aware_assignments
168
- # - unnecessary_null_in_if_null_operators
169
- # - unnecessary_overrides
170
- # - unnecessary_parenthesis
171
- # - unnecessary_statements
172
- # - unrelated_type_equality_checks
173
- # - use_string_buffers
174
- # - valid_regexps
175
- # - void_checks
27
+ # Additional information about this file can be found at
28
+ # https://dart.dev/guides/language/analysis-options
0 commit comments