From 7e592f03079314ec783db7a2adda33311dcebd44 Mon Sep 17 00:00:00 2001 From: Ellet Date: Fri, 17 Jan 2025 18:06:07 +0300 Subject: [PATCH] chore: improve lints --- analysis_options.yaml | 135 +++++++++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 29 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index abdbd96fc..2f49ff5a6 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,33 +1,110 @@ include: package:flutter_lints/flutter.yaml +analyzer: + # would be nice, but requires a lot of manual work: + # language: + # strict-casts: true + # strict-inference: true + # strict-raw-types: true + exclude: + # Ignore generated files + - '**/*.g.dart' + - '**/*.mocks.dart' # Mockito (https://pub.dev/packages/mockito) + linter: rules: - always_declare_return_types: true - always_put_required_named_parameters_first: true - annotate_overrides: true - avoid_empty_else: true - avoid_escaping_inner_quotes: true - avoid_print: true - avoid_types_on_closure_parameters: true - avoid_void_async: true - cascade_invocations: true - directives_ordering: true - omit_local_variable_types: true - prefer_const_constructors: true - prefer_const_constructors_in_immutables: true - prefer_const_declarations: true - prefer_final_fields: true - prefer_final_in_for_each: true - prefer_final_locals: true - prefer_initializing_formals: true - prefer_int_literals: true - prefer_interpolation_to_compose_strings: true - prefer_relative_imports: true - prefer_single_quotes: true - sort_constructors_first: true - sort_unnamed_constructors_first: true - unnecessary_lambdas: true - unnecessary_parenthesis: true - unnecessary_string_interpolations: true - avoid_web_libraries_in_flutter: true - conditional_uri_does_not_exist: true + - always_declare_return_types + - avoid_escaping_inner_quotes + - avoid_void_async + - directives_ordering + - avoid_web_libraries_in_flutter + - prefer_const_constructors + - prefer_const_constructors_in_immutables + - prefer_const_declarations + - use_test_throws_matchers + - use_raw_strings + - use_named_constants + - use_late_for_private_fields_and_variables + - use_is_even_rather_than_modulo + - use_if_null_to_convert_nulls_to_bools + - use_enums + - use_colored_box + - unnecessary_this + - unnecessary_statements + - unnecessary_raw_strings + - unnecessary_parenthesis + - unnecessary_null_checks + - unnecessary_null_aware_operator_on_extension_on_nullable + - unnecessary_library_directive + # - unnecessary_breaks # would be nice, but requires a lot of manual work + - unnecessary_await_in_return + - unawaited_futures + - type_annotate_public_apis + - tighten_type_of_initializing_formals + - throw_in_finally + - test_types_in_equals + - sort_unnamed_constructors_first + - sort_constructors_first + - sort_child_properties_last + - slash_for_doc_comments + - sized_box_shrink_expand + # - require_trailing_commas # would be nice, but requires a lot of manual work + - prefer_void_to_null + - prefer_null_aware_method_calls + - prefer_mixin + - prefer_if_elements_to_conditional_expressions + - prefer_foreach + - prefer_final_in_for_each + - prefer_final_locals + - prefer_relative_imports + - prefer_single_quotes + # - prefer_expression_function_bodies # would be nice, but requires a lot of manual work + - prefer_const_literals_to_create_immutables + # - prefer_asserts_with_message # would be nice, but requires a lot of manual work + - prefer_asserts_in_initializer_lists + - parameter_assignments + - only_throw_errors + - noop_primitive_operations + - no_self_assignments + - no_runtimeType_toString + - no_literal_bool_comparisons + - no_default_cases + - no_adjacent_strings_in_list + - missing_whitespace_between_adjacent_strings + - missing_code_block_language_in_doc_comment + - literal_only_boolean_expressions + # - lines_longer_than_80_chars + - library_names + - leading_newlines_in_multiline_strings + - join_return_with_assignment + - invalid_case_patterns + - implicit_reopen + - flutter_style_todos + - file_names + - eol_at_end_of_file + - do_not_use_environment + # - deprecated_consistency + - conditional_uri_does_not_exist + - combinators_ordering + - cast_nullable_to_non_nullable + - cancel_subscriptions + - avoid_unused_constructor_parameters + - avoid_type_to_string + - avoid_slow_async_io + # - avoid_setters_without_getters # would be nice, but requires a lot of manual work + - avoid_redundant_argument_values + # - avoid_positional_boolean_parameters # would be nice, but requires a lot of manual work + - avoid_js_rounded_ints + - avoid_implementing_value_types + - avoid_field_initializers_in_const_classes + - avoid_equals_and_hash_code_on_mutable_classes + - avoid_dynamic_calls + - avoid_double_and_int_checks + - avoid_catching_errors + # - avoid_catches_without_on_clauses # would be nice, but requires a lot of manual work + - avoid_bool_literals_in_conditional_expressions + - always_put_control_body_on_new_line + - always_put_required_named_parameters_first + - avoid_types_on_closure_parameters + - omit_local_variable_types + - prefer_int_literals