-
Notifications
You must be signed in to change notification settings - Fork 26
Feature/setup-linter-rules #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a0716f8
1bde0c2
908b939
7973edd
c749c97
7c81bbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,192 @@ | ||
include: package:lints/recommended.yaml | ||
|
||
analyzer: | ||
plugins: | ||
- dart_code_metrics | ||
exclude: | ||
- "build/**" | ||
strong-mode: | ||
implicit-casts: false | ||
errors: | ||
always_use_package_imports: error | ||
argument_type_not_assignable: ignore | ||
avoid_empty_else: error | ||
avoid_relative_lib_imports: error | ||
avoid_returning_null_for_future: error | ||
avoid_slow_async_io: error | ||
avoid_type_to_string: error | ||
avoid_types_as_parameter_names: error | ||
close_sinks: error | ||
empty_statements: error | ||
hash_and_equals: error | ||
invalid_assignment: ignore | ||
invariant_booleans: error | ||
iterable_contains_unrelated_type: error | ||
list_remove_unrelated_type: error | ||
literal_only_boolean_expressions: error | ||
no_adjacent_strings_in_list: error | ||
no_duplicate_case_values: error | ||
no_logic_in_create_state: error | ||
non_bool_condition: ignore | ||
prefer_void_to_null: error | ||
return_of_invalid_type: ignore | ||
test_types_in_equals: error | ||
throw_in_finally: error | ||
unnecessary_statements: error | ||
unrelated_type_equality_checks: error | ||
valid_regexps: error | ||
todo: ignore | ||
|
||
|
||
dart_code_metrics: | ||
metrics-exclude: | ||
- test/** | ||
rules: | ||
- newline-before-return | ||
- no-boolean-literal-compare | ||
- no-empty-block | ||
- prefer-trailing-comma | ||
- prefer-conditional-expressions | ||
- no-equal-then-else | ||
- always-remove-listener | ||
- avoid-unused-parameters | ||
- avoid-unnecessary-setstate | ||
- avoid-wrapping-in-padding | ||
- double-literal-format | ||
- prefer-const-border-radius | ||
- prefer_extracting_callbacks | ||
- member-ordering-extended | ||
- prefer-extracting-callbacks | ||
- no-object-declaration | ||
- binary-expression-operand-order | ||
- member-ordering-extended: | ||
order: | ||
- public-static-const-fields | ||
- private-static-const-fields | ||
- public-static-final-fields | ||
- private-static-final-fields | ||
- public-static-fields | ||
- private-static-fields | ||
- public-final-fields | ||
- private-final-fields | ||
- public-fields | ||
- public-getters-setters | ||
- private-fields | ||
- private-getters-setters | ||
- constructors | ||
- named-constructors | ||
- factory-constructors | ||
- overridden-methods | ||
- public-static-methods | ||
- public-methods | ||
- protected-methods | ||
- private-static-methods | ||
- private-methods | ||
|
||
linter: | ||
rules: | ||
constant_identifier_names: false | ||
# Const rules. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some of these rules are already true by default in recommended lints package. We can avoid stating them here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Sanlovty Did you remove rules which are set by default? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, every one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, it seems that a lot of rules explicitly mentioned here are already included by linter:
rules:
- avoid_empty_else
- avoid_relative_lib_imports
- avoid_shadowing_type_parameters
- avoid_types_as_parameter_names
- await_only_futures
- camel_case_extensions
- camel_case_types
- curly_braces_in_flow_control_structures
- depend_on_referenced_packages
- empty_catches
- file_names
- hash_and_equals
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- no_duplicate_case_values
- non_constant_identifier_names
- null_check_on_nullable_type_parameter
- package_prefixed_library_names
- prefer_generic_function_type_aliases
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
- prefer_typing_uninitialized_variables
- provide_deprecation_message
- unnecessary_overrides
- unrelated_type_equality_checks
- valid_regexps
- void_checks
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_function_literals_in_foreach_calls
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null_for_void
- avoid_single_cascade_in_expression_statements
- constant_identifier_names
- control_flow_in_finally
- empty_constructor_bodies
- empty_statements
- exhaustive_cases
- implementation_imports
- library_names
- library_prefixes
- library_private_types_in_public_api
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- null_closures
- overridden_fields
- package_names
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_for_elements_to_map_fromIterable
- prefer_function_declarations_over_variables
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_interpolation_to_compose_strings
- prefer_is_not_operator
- prefer_null_aware_operators
- prefer_spread_collections
- prefer_void_to_null
- recursive_getters
- slash_for_doc_comments
- type_init_formals
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_constructor_name
- unnecessary_getters_setters
- unnecessary_late
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll check this later There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! |
||
prefer_const_constructors: true | ||
|
||
# Error rules. | ||
always_use_package_imports: true | ||
avoid_empty_else: true | ||
avoid_relative_lib_imports: true | ||
avoid_returning_null_for_future: true | ||
avoid_slow_async_io: true | ||
avoid_type_to_string: true | ||
avoid_types_as_parameter_names: true | ||
cancel_subscriptions: true | ||
close_sinks: true | ||
comment_references: true | ||
eol_at_end_of_file: true | ||
hash_and_equals: true | ||
invariant_booleans: true | ||
iterable_contains_unrelated_type: true | ||
list_remove_unrelated_type: true | ||
literal_only_boolean_expressions: true | ||
no_adjacent_strings_in_list: true | ||
no_duplicate_case_values: true | ||
test_types_in_equals: true | ||
throw_in_finally: true | ||
unnecessary_statements: true | ||
unrelated_type_equality_checks: true | ||
unsafe_html: true | ||
valid_regexps: true | ||
|
||
# Style rules. | ||
always_declare_return_types: true | ||
always_put_required_named_parameters_first: true | ||
avoid_equals_and_hash_code_on_mutable_classes: true | ||
avoid_escaping_inner_quotes: true | ||
avoid_field_initializers_in_const_classes: true | ||
avoid_implementing_value_types: true | ||
avoid_js_rounded_ints: true | ||
avoid_multiple_declarations_per_line: true | ||
avoid_private_typedef_functions: true | ||
avoid_redundant_argument_values: true | ||
avoid_returning_null: true | ||
avoid_returning_this: true | ||
avoid_setters_without_getters: true | ||
avoid_shadowing_type_parameters: true | ||
avoid_types_on_closure_parameters: true | ||
avoid_unnecessary_containers: true | ||
avoid_unused_constructor_parameters: true | ||
avoid_void_async: true | ||
await_only_futures: true | ||
camel_case_extensions: true | ||
camel_case_types: true | ||
cascade_invocations: true | ||
curly_braces_in_flow_control_structures: true | ||
deprecated_consistency: true | ||
directives_ordering: true | ||
do_not_use_environment: true | ||
empty_catches: true | ||
file_names: true | ||
leading_newlines_in_multiline_strings: true | ||
missing_whitespace_between_adjacent_strings: true | ||
no_runtimeType_toString: true | ||
noop_primitive_operations: true | ||
non_constant_identifier_names: true | ||
one_member_abstracts: true | ||
only_throw_errors: true | ||
package_api_docs: true | ||
prefer_asserts_in_initializer_lists: true | ||
prefer_constructors_over_static_methods: true | ||
prefer_equal_for_default_values: true | ||
prefer_final_in_for_each: true | ||
prefer_final_locals: true | ||
prefer_generic_function_type_aliases: true | ||
prefer_if_elements_to_conditional_expressions: true | ||
prefer_is_empty: true | ||
prefer_is_not_empty: true | ||
prefer_iterable_whereType: true | ||
prefer_mixin: true | ||
prefer_single_quotes: true | ||
prefer_typing_uninitialized_variables: true | ||
provide_deprecation_message: true | ||
sized_box_for_whitespace: true | ||
type_annotate_public_apis: true | ||
unawaited_futures: true | ||
unnecessary_await_in_return: true | ||
unnecessary_lambdas: true | ||
unnecessary_null_checks: true | ||
unnecessary_overrides: true | ||
unnecessary_parenthesis: true | ||
unnecessary_raw_strings: true | ||
use_if_null_to_convert_nulls_to_bools: true | ||
use_is_even_rather_than_modulo: true | ||
use_late_for_private_fields_and_variables: true | ||
use_named_constants: true | ||
use_raw_strings: true | ||
use_setters_to_change_properties: true | ||
use_string_buffers: true | ||
use_to_and_as_if_applicable: true | ||
void_checks: true | ||
conditional_uri_does_not_exist: true | ||
secure_pubspec_urls: true | ||
sized_box_shrink_expand: true | ||
|
||
# Pub rules. | ||
sort_pub_dependencies: true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't wanna remove this. Can't
dart_code_metrics
work with this? Please remove metrics if it can't. I don't wanna make this change if it can't. I'd prefer standard recommended rules always.