Skip to content

Commit

Permalink
refactor: additional lint rules (#4083)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel authored Mar 6, 2024
1 parent 025b21b commit 024a1a7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
13 changes: 13 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ linter:
- always_put_required_named_parameters_first
- always_use_package_imports
- annotate_overrides
- annotate_redeclares
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_double_and_int_checks
Expand Down Expand Up @@ -68,7 +69,9 @@ linter:
- dangling_library_doc_comments
- depend_on_referenced_packages
- deprecated_consistency
- deprecated_member_use_from_same_package
- directives_ordering
- do_not_use_environment
- empty_catches
- empty_constructor_bodies
- empty_statements
Expand All @@ -89,14 +92,18 @@ linter:
- library_private_types_in_public_api
- lines_longer_than_80_chars
- literal_only_boolean_expressions
- matching_super_parameters
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
- no_leading_underscores_for_local_identifiers
- no_literal_bool_comparisons
- no_logic_in_create_state
- no_runtimeType_toString
- no_self_assignments
- no_wildcard_variable_uses
- non_constant_identifier_names
- noop_primitive_operations
- null_check_on_nullable_type_parameter
Expand Down Expand Up @@ -136,6 +143,7 @@ linter:
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
- prefer_mixin
- prefer_null_aware_method_calls
- prefer_null_aware_operators
- prefer_single_quotes
Expand All @@ -159,6 +167,7 @@ linter:
- tighten_type_of_initializing_formals
- type_annotate_public_apis
- type_init_formals
- type_literal_in_constant_pattern
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
Expand All @@ -171,6 +180,7 @@ linter:
- unnecessary_library_directive
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_aware_operator_on_extension_on_nullable
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
Expand All @@ -182,9 +192,12 @@ linter:
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- unreachable_from_main
- unrelated_type_equality_checks
- unsafe_html
- use_build_context_synchronously
- use_colored_box
- use_decorated_box
- use_enums
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class FakeCubit extends Fake implements Cubit<Object> {}

class FakeEvent extends Fake implements Object {}

class FakeState extends Fake implements Object {}

class FakeStackTrace extends Fake implements StackTrace {}

class FakeChange extends Fake implements Change<Object> {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:authentication_repository/authentication_repository.dart';
import 'package:bloc_test/bloc_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -8,9 +7,6 @@ import 'package:form_inputs/form_inputs.dart';
import 'package:formz/formz.dart';
import 'package:mocktail/mocktail.dart';

class MockAuthenticationRepository extends Mock
implements AuthenticationRepository {}

class MockSignUpCubit extends MockCubit<SignUpState> implements SignUpCubit {}

class MockEmail extends Mock implements Email {}
Expand Down
19 changes: 0 additions & 19 deletions packages/replay_bloc/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,6 @@ class CounterPage extends StatelessWidget {
}
}

/// {@template replay_counter_cubit}
/// A simple [ReplayCubit] which manages an `int` as its state
/// and exposes three public methods to `increment`, `decrement`, and
/// `reset` the value of the state.
/// {@endtemplate}
class CounterCubit extends ReplayCubit<int> {
/// {@macro replay_counter_cubit}
CounterCubit() : super(0);

/// Increments the [CounterCubit] state by 1.
void increment() => emit(state + 1);

/// Decrements the [CounterCubit] state by 1.
void decrement() => emit(state - 1);

/// Resets the [CounterCubit] state to 0.
void reset() => emit(0);
}

/// Base event class for the [CounterBloc].
sealed class CounterEvent extends ReplayEvent {}

Expand Down

0 comments on commit 024a1a7

Please sign in to comment.