Skip to content

Instantly share code, notes, and snippets.

@edufolly
Last active February 10, 2023 22:03
Show Gist options
  • Save edufolly/ceb47eb81ed1aa9a50cc5027f92dac13 to your computer and use it in GitHub Desktop.
Save edufolly/ceb47eb81ed1aa9a50cc5027f92dac13 to your computer and use it in GitHub Desktop.
Heaviest (less permissive) Flutter Linter Rules
include: package:flutter_lints/flutter.yaml
analizer:
strong-mode:
implicit-casts: false
linter:
# https://dart-lang.github.io/linter/lints/index.html.
rules:
# Errors
always_use_package_imports: true
avoid_dynamic_calls: true
avoid_slow_async_io: true
avoid_type_to_string: true
avoid_web_libraries_in_flutter: true
cancel_subscriptions: true
close_sinks: true
collection_methods_unrelated_type: true # experimental
comment_references: true
# diagnostic_describe_all_properties: true
# discarded_futures: true
literal_only_boolean_expressions: true
no_adjacent_strings_in_list: true
test_types_in_equals: true
throw_in_finally: true
unnecessary_statements: true
unsafe_html: true
# Styles
always_declare_return_types: true
always_put_control_body_on_new_line: true
always_put_required_named_parameters_first: true
always_specify_types: true
# avoid_annotating_with_dynamic: true
avoid_bool_literals_in_conditional_expressions: true
avoid_catches_without_on_clauses: true
avoid_catching_errors: true
# avoid_classes_with_only_static_members: true
avoid_double_and_int_checks: true
# avoid_equals_and_hash_code_on_mutable_classes: true
avoid_escaping_inner_quotes: true
avoid_field_initializers_in_const_classes: true
# avoid_final_parameters: true
avoid_implementing_value_types: true
avoid_js_rounded_ints: true
avoid_multiple_declarations_per_line: true
avoid_positional_boolean_parameters: true
avoid_private_typedef_functions: true
avoid_redundant_argument_values: true
avoid_returning_this: true
avoid_setters_without_getters: true
# avoid_types_on_closure_parameters: true
avoid_unused_constructor_parameters: true
avoid_void_async: true
cascade_invocations: true
cast_nullable_to_non_nullable: true
combinators_ordering: true # experimental
conditional_uri_does_not_exist: true
dangling_library_doc_comments: true
deprecated_consistency: true
directives_ordering: true
do_not_use_environment: true
eol_at_end_of_file: true
flutter_style_todos: true
implicit_call_tearoffs: true # experimental
join_return_with_assignment: true
leading_newlines_in_multiline_strings: true
library_annotations: true
lines_longer_than_80_chars: true
missing_whitespace_between_adjacent_strings: true
no_default_cases: true # experimental
no_runtimeType_toString: true
noop_primitive_operations: true
one_member_abstracts: true
only_throw_errors: true
prefer_asserts_in_initializer_lists: true
prefer_asserts_with_message: true
prefer_constructors_over_static_methods: true
# prefer_expression_function_bodies: true
prefer_final_in_for_each: true
prefer_for_elements_to_map_fromIterable: true
prefer_int_literals: true
prefer_null_aware_method_calls: true
prefer_single_quotes: true
require_trailing_commas: true
sized_box_shrink_expand: true
# sort_constructors_first: true
sort_unnamed_constructors_first: true
tighten_type_of_initializing_formals: true
type_annotate_public_apis: true
unawaited_futures: true
unnecessary_await_in_return: true
unnecessary_null_aware_operator_on_extension_on_nullable: true
unnecessary_null_checks: true # experimental
unnecessary_nullable_for_final_variable_declarations: true # experimental
unnecessary_parenthesis: true
unnecessary_raw_strings: true
unnecessary_to_list_in_spreads: true
unreachable_from_main: true # experimental
use_colored_box: true
use_decorated_box: true
use_enums: 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 # experimental
use_named_constants: true
use_raw_strings: true
use_setters_to_change_properties: true
use_string_buffers: true
use_string_in_part_of_directives: true
use_super_parameters: true # experimental
use_test_throws_matchers: true
use_to_and_as_if_applicable: true
# TODO(edufolly): Remove
# constant_identifier_names: false
use_build_context_synchronously: false
# Pub
sort_pub_dependencies: true
# https://dart.dev/guides/language/analysis-options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment