Skip to content

Commit 06a70a8

Browse files
committedJan 10, 2023
chore: specify lint rules
Signed-off-by: xsahil03x <xdsahil@gmail.com>
1 parent 729b542 commit 06a70a8

File tree

9 files changed

+296
-252
lines changed

9 files changed

+296
-252
lines changed
 

‎all_lint_rules.yaml

+211
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
linter:
2+
rules:
3+
- always_declare_return_types
4+
- always_put_control_body_on_new_line
5+
- always_put_required_named_parameters_first
6+
- always_require_non_null_named_parameters
7+
- always_specify_types
8+
- always_use_package_imports
9+
- annotate_overrides
10+
- avoid_annotating_with_dynamic
11+
- avoid_bool_literals_in_conditional_expressions
12+
- avoid_catches_without_on_clauses
13+
- avoid_catching_errors
14+
- avoid_classes_with_only_static_members
15+
- avoid_double_and_int_checks
16+
- avoid_dynamic_calls
17+
- avoid_empty_else
18+
- avoid_equals_and_hash_code_on_mutable_classes
19+
- avoid_escaping_inner_quotes
20+
- avoid_field_initializers_in_const_classes
21+
- avoid_final_parameters
22+
- avoid_function_literals_in_foreach_calls
23+
- avoid_implementing_value_types
24+
- avoid_init_to_null
25+
- avoid_js_rounded_ints
26+
- avoid_multiple_declarations_per_line
27+
- avoid_null_checks_in_equality_operators
28+
- avoid_positional_boolean_parameters
29+
- avoid_print
30+
- avoid_private_typedef_functions
31+
- avoid_redundant_argument_values
32+
- avoid_relative_lib_imports
33+
- avoid_renaming_method_parameters
34+
- avoid_return_types_on_setters
35+
- avoid_returning_null
36+
- avoid_returning_null_for_future
37+
- avoid_returning_null_for_void
38+
- avoid_returning_this
39+
- avoid_setters_without_getters
40+
- avoid_shadowing_type_parameters
41+
- avoid_single_cascade_in_expression_statements
42+
- avoid_slow_async_io
43+
- avoid_type_to_string
44+
- avoid_types_as_parameter_names
45+
- avoid_types_on_closure_parameters
46+
- avoid_unnecessary_containers
47+
- avoid_unused_constructor_parameters
48+
- avoid_void_async
49+
- avoid_web_libraries_in_flutter
50+
- await_only_futures
51+
- camel_case_extensions
52+
- camel_case_types
53+
- cancel_subscriptions
54+
- cascade_invocations
55+
- cast_nullable_to_non_nullable
56+
- close_sinks
57+
- collection_methods_unrelated_type
58+
- combinators_ordering
59+
- comment_references
60+
- conditional_uri_does_not_exist
61+
- constant_identifier_names
62+
- control_flow_in_finally
63+
- curly_braces_in_flow_control_structures
64+
- depend_on_referenced_packages
65+
- deprecated_consistency
66+
- diagnostic_describe_all_properties
67+
- directives_ordering
68+
- discarded_futures
69+
- do_not_use_environment
70+
- empty_catches
71+
- empty_constructor_bodies
72+
- empty_statements
73+
- eol_at_end_of_file
74+
- exhaustive_cases
75+
- file_names
76+
- flutter_style_todos
77+
- hash_and_equals
78+
- implementation_imports
79+
- iterable_contains_unrelated_type
80+
- join_return_with_assignment
81+
- leading_newlines_in_multiline_strings
82+
- library_names
83+
- library_prefixes
84+
- library_private_types_in_public_api
85+
- lines_longer_than_80_chars
86+
- list_remove_unrelated_type
87+
- literal_only_boolean_expressions
88+
- missing_whitespace_between_adjacent_strings
89+
- no_adjacent_strings_in_list
90+
- no_default_cases
91+
- no_duplicate_case_values
92+
- no_leading_underscores_for_library_prefixes
93+
- no_leading_underscores_for_local_identifiers
94+
- no_logic_in_create_state
95+
- no_runtimeType_toString
96+
- non_constant_identifier_names
97+
- noop_primitive_operations
98+
- null_check_on_nullable_type_parameter
99+
- null_closures
100+
- omit_local_variable_types
101+
- one_member_abstracts
102+
- only_throw_errors
103+
- overridden_fields
104+
- package_api_docs
105+
- package_names
106+
- package_prefixed_library_names
107+
- parameter_assignments
108+
- prefer_adjacent_string_concatenation
109+
- prefer_asserts_in_initializer_lists
110+
- prefer_asserts_with_message
111+
- prefer_collection_literals
112+
- prefer_conditional_assignment
113+
- prefer_const_constructors
114+
- prefer_const_constructors_in_immutables
115+
- prefer_const_declarations
116+
- prefer_const_literals_to_create_immutables
117+
- prefer_constructors_over_static_methods
118+
- prefer_contains
119+
- prefer_double_quotes
120+
- prefer_equal_for_default_values
121+
- prefer_expression_function_bodies
122+
- prefer_final_fields
123+
- prefer_final_in_for_each
124+
- prefer_final_locals
125+
- prefer_final_parameters
126+
- prefer_for_elements_to_map_fromIterable
127+
- prefer_foreach
128+
- prefer_function_declarations_over_variables
129+
- prefer_generic_function_type_aliases
130+
- prefer_if_elements_to_conditional_expressions
131+
- prefer_if_null_operators
132+
- prefer_initializing_formals
133+
- prefer_inlined_adds
134+
- prefer_int_literals
135+
- prefer_interpolation_to_compose_strings
136+
- prefer_is_empty
137+
- prefer_is_not_empty
138+
- prefer_is_not_operator
139+
- prefer_iterable_whereType
140+
- prefer_mixin
141+
- prefer_null_aware_method_calls
142+
- prefer_null_aware_operators
143+
- prefer_relative_imports
144+
- prefer_single_quotes
145+
- prefer_spread_collections
146+
- prefer_typing_uninitialized_variables
147+
- prefer_void_to_null
148+
- provide_deprecation_message
149+
- public_member_api_docs
150+
- recursive_getters
151+
- require_trailing_commas
152+
- secure_pubspec_urls
153+
- sized_box_for_whitespace
154+
- sized_box_shrink_expand
155+
- slash_for_doc_comments
156+
- sort_child_properties_last
157+
- sort_constructors_first
158+
- sort_pub_dependencies
159+
- sort_unnamed_constructors_first
160+
- test_types_in_equals
161+
- throw_in_finally
162+
- tighten_type_of_initializing_formals
163+
- type_annotate_public_apis
164+
- type_init_formals
165+
- unawaited_futures
166+
- unnecessary_await_in_return
167+
- unnecessary_brace_in_string_interps
168+
- unnecessary_const
169+
- unnecessary_constructor_name
170+
- unnecessary_final
171+
- unnecessary_getters_setters
172+
- unnecessary_lambdas
173+
- unnecessary_late
174+
- unnecessary_new
175+
- unnecessary_null_aware_assignments
176+
- unnecessary_null_aware_operator_on_extension_on_nullable
177+
- unnecessary_null_checks
178+
- unnecessary_null_in_if_null_operators
179+
- unnecessary_nullable_for_final_variable_declarations
180+
- unnecessary_overrides
181+
- unnecessary_parenthesis
182+
- unnecessary_raw_strings
183+
- unnecessary_statements
184+
- unnecessary_string_escapes
185+
- unnecessary_string_interpolations
186+
- unnecessary_this
187+
- unnecessary_to_list_in_spreads
188+
- unreachable_from_main
189+
- unrelated_type_equality_checks
190+
- unsafe_html
191+
- use_build_context_synchronously
192+
- use_colored_box
193+
- use_decorated_box
194+
- use_enums
195+
- use_full_hex_values_for_flutter_colors
196+
- use_function_type_syntax_for_parameters
197+
- use_if_null_to_convert_nulls_to_bools
198+
- use_is_even_rather_than_modulo
199+
- use_key_in_widget_constructors
200+
- use_late_for_private_fields_and_variables
201+
- use_named_constants
202+
- use_raw_strings
203+
- use_rethrow_when_possible
204+
- use_setters_to_change_properties
205+
- use_string_buffers
206+
- use_string_in_part_of_directives
207+
- use_super_parameters
208+
- use_test_throws_matchers
209+
- use_to_and_as_if_applicable
210+
- valid_regexps
211+
- void_checks

‎analysis_options.yaml

+85-180
Original file line numberDiff line numberDiff line change
@@ -1,185 +1,90 @@
1+
include: all_lint_rules.yaml
2+
13
analyzer:
2-
plugins:
3-
- dart_code_metrics
4+
language:
5+
strict-casts: false
6+
strict-inference: true
7+
strict-raw-types: true
8+
errors:
9+
# Otherwise cause the import of all_lint_rules to warn because of some rules conflicts.
10+
# We explicitly enabled even conflicting rules and are fixing the conflict
11+
# in this file.
12+
included_file_warning: ignore
413
exclude:
5-
- packages/*/lib/**/*.pb.dart
6-
- packages/*/lib/**/*.pbenum.dart
7-
- packages/*/lib/**/*.pbjson.dart
8-
- packages/*/lib/**/*.pbserver.dart
9-
- packages/*/lib/**/*.pbtwirp.dart
10-
- packages/*/lib/**/*.g.dart
11-
- packages/*/lib/**/*.freezed.dart
14+
# exclude all the generated files
15+
- packages/*/lib/**/*.*.dart
16+
1217

1318
linter:
1419
rules:
15-
# these rules are documented on and in the same order as
16-
# the Dart Lint rules page to make maintenance easier
17-
# https://github.com/dart-lang/linter/blob/master/example/all.yaml
18-
- always_use_package_imports
19-
- avoid_empty_else
20-
- avoid_relative_lib_imports
21-
- avoid_slow_async_io
22-
- avoid_types_as_parameter_names
23-
- cancel_subscriptions
24-
- close_sinks
25-
- control_flow_in_finally
26-
- empty_statements
27-
- hash_and_equals
28-
- invariant_booleans
29-
- iterable_contains_unrelated_type
30-
- list_remove_unrelated_type
31-
- literal_only_boolean_expressions
32-
- no_adjacent_strings_in_list
33-
- no_duplicate_case_values
34-
- no_logic_in_create_state
35-
- prefer_void_to_null
36-
- test_types_in_equals
37-
- throw_in_finally
38-
- unnecessary_statements
39-
- unrelated_type_equality_checks
40-
- omit_local_variable_types
41-
- use_key_in_widget_constructors
42-
- valid_regexps
43-
- always_declare_return_types
44-
- always_require_non_null_named_parameters
45-
- annotate_overrides
46-
- avoid_bool_literals_in_conditional_expressions
47-
- avoid_catching_errors
48-
- avoid_init_to_null
49-
- avoid_null_checks_in_equality_operators
50-
- avoid_positional_boolean_parameters
51-
- avoid_private_typedef_functions
52-
- avoid_redundant_argument_values
53-
- avoid_return_types_on_setters
54-
- avoid_returning_null_for_void
55-
- avoid_shadowing_type_parameters
56-
- avoid_single_cascade_in_expression_statements
57-
- avoid_unnecessary_containers
58-
- avoid_unused_constructor_parameters
59-
- await_only_futures
60-
- camel_case_extensions
61-
- camel_case_types
62-
- cascade_invocations
63-
64-
- constant_identifier_names
65-
- curly_braces_in_flow_control_structures
66-
- directives_ordering
67-
- empty_catches
68-
- empty_constructor_bodies
69-
- exhaustive_cases
70-
- file_names
71-
- implementation_imports
72-
- join_return_with_assignment
73-
- leading_newlines_in_multiline_strings
74-
- library_names
75-
- library_prefixes
76-
- lines_longer_than_80_chars
77-
- missing_whitespace_between_adjacent_strings
78-
- non_constant_identifier_names
79-
- null_closures
80-
- one_member_abstracts
81-
- only_throw_errors
82-
- package_api_docs
83-
- package_prefixed_library_names
84-
- parameter_assignments
85-
- prefer_adjacent_string_concatenation
86-
- prefer_asserts_in_initializer_lists
87-
- prefer_asserts_with_message
88-
- prefer_collection_literals
89-
- prefer_conditional_assignment
90-
- prefer_const_constructors
91-
- prefer_const_constructors_in_immutables
92-
- prefer_const_declarations
93-
- prefer_const_literals_to_create_immutables
94-
- prefer_constructors_over_static_methods
95-
- prefer_contains
96-
- prefer_equal_for_default_values
97-
- prefer_final_fields
98-
- prefer_final_in_for_each
99-
- prefer_final_locals
100-
- prefer_function_declarations_over_variables
101-
- prefer_generic_function_type_aliases
102-
- prefer_if_elements_to_conditional_expressions
103-
- prefer_if_null_operators
104-
- prefer_initializing_formals
105-
- prefer_inlined_adds
106-
- prefer_int_literals
107-
- prefer_interpolation_to_compose_strings
108-
- prefer_is_empty
109-
- prefer_is_not_empty
110-
- prefer_is_not_operator
111-
- prefer_null_aware_operators
112-
- prefer_single_quotes
113-
- prefer_spread_collections
114-
- prefer_typing_uninitialized_variables
115-
- provide_deprecation_message
116-
- public_member_api_docs
117-
- recursive_getters
118-
- sized_box_for_whitespace
119-
- slash_for_doc_comments
120-
- sort_child_properties_last
121-
- sort_constructors_first
122-
- sort_unnamed_constructors_first
123-
124-
- type_annotate_public_apis
125-
- type_init_formals
126-
- unnecessary_await_in_return
127-
- unnecessary_brace_in_string_interps
128-
- unnecessary_const
129-
- unnecessary_getters_setters
130-
- unnecessary_lambdas
131-
- unnecessary_new
132-
- unnecessary_null_aware_assignments
133-
- unnecessary_null_in_if_null_operators
134-
- unnecessary_nullable_for_final_variable_declarations
135-
- unnecessary_parenthesis
136-
- unnecessary_raw_strings
137-
- unnecessary_string_escapes
138-
- unnecessary_string_interpolations
139-
- unnecessary_this
140-
- use_is_even_rather_than_modulo
141-
- use_late_for_private_fields_and_variables
142-
- use_rethrow_when_possible
143-
- use_setters_to_change_properties
144-
- use_to_and_as_if_applicable
145-
- package_names
146-
- sort_pub_dependencies
147-
148-
- cast_nullable_to_non_nullable
149-
- unnecessary_null_checks
150-
- tighten_type_of_initializing_formals
151-
- null_check_on_nullable_type_parameter
152-
153-
- conditional_uri_does_not_exist
154-
- secure_pubspec_urls
155-
- sized_box_shrink_expand
156-
- unnecessary_constructor_name
157-
- unnecessary_late
158-
- use_colored_box
159-
- use_decorated_box
160-
- use_enums
161-
- use_super_parameters
162-
- avoid_escaping_inner_quotes
163-
- unnecessary_overrides
164-
- prefer_null_aware_method_calls
165-
- use_named_constants
166-
- use_raw_strings
167-
168-
# https://dartcodemetrics.dev/docs/getting-started/introduction
169-
dart_code_metrics:
170-
rules:
171-
# Dart Specific
172-
- binary-expression-operand-order
173-
- double-literal-format
174-
- no-boolean-literal-compare
175-
- no-equal-then-else
176-
- no-empty-block:
177-
exclude:
178-
- packages/*/test/**
179-
- prefer-trailing-comma:
180-
exclude:
181-
- packages/*/test/**
182-
183-
# Flutter specific
184-
- always-remove-listener
185-
- avoid-unnecessary-setstate
20+
## Disabled rules because the repository doesn't respect them (yet)
21+
avoid_setters_without_getters: false
22+
discarded_futures: false
23+
24+
#############
25+
26+
# TODO: re-enable documentation rule and fix issues.
27+
public_member_api_docs: false
28+
29+
always_put_control_body_on_new_line: false
30+
31+
# Does not always make code more readable.
32+
cascade_invocations: false
33+
34+
# Conflicts with `prefer_single_quotes`
35+
# Single quotes are easier to type and don't compromise on readability.
36+
prefer_double_quotes: false
37+
38+
# Conflicts with `omit_local_variable_types` and other rules.
39+
# As per Dart guidelines, we want to avoid unnecessary types to make the code
40+
# more readable.
41+
# See https://dart.dev/guides/language/effective-dart/design#avoid-type-annotating-initialized-local-variables
42+
always_specify_types: false
43+
44+
# Incompatible with `prefer_final_locals`
45+
# Having immutable local variables makes larger functions more predictable,
46+
# so we will use `prefer_final_locals` instead.
47+
unnecessary_final: false
48+
49+
# Not quite suitable for Flutter, which may have a `build` method with a single
50+
# return, but that return is still complex enough that a "body" is worth it.
51+
prefer_expression_function_bodies: false
52+
53+
# Conflicts with the convention used by flutter, which puts `Key key`
54+
# and `@required Widget child` last.
55+
always_put_required_named_parameters_first: false
56+
57+
# `as` is not that bad (especially with the upcoming non-nullable types).
58+
# Explicit exceptions is better than implicit exceptions.
59+
avoid_as: false
60+
61+
# This project doesn't use Flutter-style todos
62+
flutter_style_todos: false
63+
64+
# There are situations where we voluntarily want to catch everything,
65+
# especially as a library.
66+
avoid_catches_without_on_clauses: false
67+
68+
# Boring as it sometimes force a line of 81 characters to be split in two.
69+
# As long as we try to respect that 80 characters limit, going slightly
70+
# above is fine.
71+
lines_longer_than_80_chars: false
72+
73+
# Conflicts with disabling `implicit-dynamic`
74+
avoid_annotating_with_dynamic: false
75+
76+
# conflicts with `prefer_relative_imports`
77+
always_use_package_imports: false
78+
79+
# False positive, null checks don't need a message
80+
prefer_asserts_with_message: false
81+
82+
# Cumbersome with `context.select`
83+
avoid_types_on_closure_parameters: false
84+
85+
# Too many false positive (builders)
86+
diagnostic_describe_all_properties: false
87+
88+
# Not a common style and would add a lot of verbosity to function signature.
89+
# 'parameter_assignments' already enforces this to an extent.
90+
prefer_final_parameters: false

‎dogfooding/analysis_options.yaml

-29
This file was deleted.

‎dogfooding/pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ dependencies:
2424
dev_dependencies:
2525
flutter_test:
2626
sdk: flutter
27-
flutter_lints: ^2.0.0
2827

2928
# The following section is specific to Flutter packages.
3029
flutter:

‎packages/stream_video/pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,5 @@ dependencies:
2525
rate_limiter: ^1.0.0
2626

2727
dev_dependencies:
28-
dart_code_metrics: ^4.4.0
2928
flutter_test:
3029
sdk: flutter

‎packages/stream_video_flutter/analysis_options.yaml

-4
This file was deleted.

‎packages/stream_video_flutter/example/analysis_options.yaml

-29
This file was deleted.

‎packages/stream_video_flutter/example/pubspec.yaml

-7
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@ dev_dependencies:
4747
flutter_test:
4848
sdk: flutter
4949

50-
# The "flutter_lints" package below contains a set of recommended lints to
51-
# encourage good coding practices. The lint set provided by the package is
52-
# activated in the `analysis_options.yaml` file located at the root of your
53-
# package. See that file for information about deactivating specific lint
54-
# rules and activating additional ones.
55-
flutter_lints: ^2.0.0
56-
5750
# For information on the generic Dart part of this file, see the
5851
# following page: https://dart.dev/tools/pub/pubspec
5952

‎packages/stream_video_flutter/pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ dependencies:
2020
dev_dependencies:
2121
flutter_test:
2222
sdk: flutter
23-
flutter_lints: ^2.0.0
2423

2524
# For information on the generic Dart part of this file, see the
2625
# following page: https://dart.dev/tools/pub/pubspec

0 commit comments

Comments
 (0)
Please sign in to comment.