diff --git a/analysis_options.yaml b/analysis_options.yaml index 0bad56ae4..9344e1913 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -10,6 +10,12 @@ analyzer: - tools/analyzer_plugin/** - ddc_precompiled/** errors: + duplicate_import: warning + must_call_super: error + unused_import: warning + unnecessary_import: warning + unnecessary_null_comparison: warning + # Workaround for https://github.com/dart-lang/sdk/issues/51087 # TODO remove once we're no longer running CI on Dart 2.18 part_of_different_library: ignore diff --git a/example/suspense/lazy.dart b/example/suspense/lazy.dart index 0b486c297..3b33d36f3 100644 --- a/example/suspense/lazy.dart +++ b/example/suspense/lazy.dart @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -import 'dart:js'; import 'dart:js_util'; import 'package:js/js.dart'; diff --git a/lib/src/builder/codegen/accessors_generator.dart b/lib/src/builder/codegen/accessors_generator.dart index 43ee9e58c..4d0dd3a68 100644 --- a/lib/src/builder/codegen/accessors_generator.dart +++ b/lib/src/builder/codegen/accessors_generator.dart @@ -276,13 +276,11 @@ abstract class TypedMapAccessorsGenerator extends BoilerplateDeclarationGenerato metadataSrc.writeln(' ${annotation.toSource()}'); } - const omitTypesInOverrides = false; - - final getterTypeString = omitTypesInOverrides ? '' : typeString; + final getterTypeString = typeString; final setterTypeString = // This change is attempting to help with null safe migration when generated code is available in legacy components field.covariantKeyword == null - ? (omitTypesInOverrides ? '' : typeString) + ? getterTypeString : '${field.covariantKeyword} $typeString'; // Carry over the existing doc comment since IDEs don't inherit diff --git a/lib/src/builder/parsing/ast_util.dart b/lib/src/builder/parsing/ast_util.dart index 0f8843b4a..d34409d49 100644 --- a/lib/src/builder/parsing/ast_util.dart +++ b/lib/src/builder/parsing/ast_util.dart @@ -16,7 +16,6 @@ import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/syntactic_entity.dart'; import 'package:analyzer/dart/ast/token.dart'; import 'package:analyzer/dart/ast/visitor.dart'; -import 'package:collection/collection.dart' show IterableExtension; import 'package:over_react/src/builder/codegen/names.dart'; import 'package:source_span/source_span.dart'; import 'package:transformer_utils/transformer_utils.dart'; diff --git a/lib/src/builder/parsing/member_association.dart b/lib/src/builder/parsing/member_association.dart index feb348ec4..df485a211 100644 --- a/lib/src/builder/parsing/member_association.dart +++ b/lib/src/builder/parsing/member_association.dart @@ -14,7 +14,6 @@ import 'ast_util.dart'; import 'members.dart'; -import 'package:collection/collection.dart' show IterableExtension; import 'util.dart'; /// Removes the generated prefix from anywhere inside of [name]. diff --git a/lib/src/builder/parsing/members.dart b/lib/src/builder/parsing/members.dart index ea1875f9c..320728c99 100644 --- a/lib/src/builder/parsing/members.dart +++ b/lib/src/builder/parsing/members.dart @@ -15,7 +15,6 @@ import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/token.dart'; import 'package:build/build.dart' show log; -import 'package:collection/collection.dart' show IterableExtension; import 'package:meta/meta.dart'; import 'package:over_react/src/builder/codegen/names.dart'; import 'package:over_react/src/component_declaration/annotations.dart' as annotations; @@ -24,12 +23,6 @@ import 'package:over_react/src/util/string_util.dart'; import '../parsing.dart'; import '../util.dart'; -import 'ast_util.dart'; -import 'declarations.dart'; -import 'members_from_ast.dart'; -import 'meta.dart'; -import 'error_collection.dart'; -import 'version.dart'; part 'members/component.dart'; part 'members/factory.dart'; diff --git a/lib/src/builder/util.dart b/lib/src/builder/util.dart index 9f4edff44..9bc2ac49e 100644 --- a/lib/src/builder/util.dart +++ b/lib/src/builder/util.dart @@ -16,7 +16,6 @@ import 'dart:mirrors'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:build/build.dart' show AssetId; -import 'package:collection/collection.dart' show IterableExtension; import 'package:over_react/src/builder/parsing.dart'; import 'package:path/path.dart' as p; import 'package:source_span/source_span.dart'; diff --git a/lib/src/component/_deprecated/abstract_transition.dart b/lib/src/component/_deprecated/abstract_transition.dart index 5cac0b441..9eb32dc34 100644 --- a/lib/src/component/_deprecated/abstract_transition.dart +++ b/lib/src/component/_deprecated/abstract_transition.dart @@ -22,7 +22,6 @@ import 'package:meta/meta.dart'; import 'package:over_react/over_react.dart'; import 'package:over_react/component_base.dart' as component_base; -import '../abstract_transition.dart' show TransitionPhase; export '../abstract_transition.dart' show TransitionPhase; part 'abstract_transition.over_react.g.dart'; diff --git a/lib/src/component/prop_typedefs.dart b/lib/src/component/prop_typedefs.dart index 6bd18bb41..51ec801f2 100644 --- a/lib/src/component/prop_typedefs.dart +++ b/lib/src/component/prop_typedefs.dart @@ -17,7 +17,6 @@ library over_react.prop_typedefs; import 'package:over_react/over_react.dart'; import 'package:over_react/src/component_declaration/component_base.dart' as component_base; -import 'package:react/react_client.dart'; /// A custom rendering prop typedef that allows a custom rendering function to be provided /// with the current [props] and [state] of the [component]. diff --git a/lib/src/over_react_redux/over_react_flux.dart b/lib/src/over_react_redux/over_react_flux.dart index 9edadfe52..cd9d87f0c 100644 --- a/lib/src/over_react_redux/over_react_flux.dart +++ b/lib/src/over_react_redux/over_react_flux.dart @@ -18,7 +18,6 @@ import 'dart:html'; import 'package:meta/meta.dart'; import 'package:over_react/over_react.dart'; import 'package:over_react/over_react_redux.dart'; -import 'package:over_react/src/util/equality.dart'; import 'package:redux/redux.dart' as redux; import 'package:w_flux/w_flux.dart' as flux; @@ -521,8 +520,8 @@ UiFactory Function(UiFactory) final originalMapStateToProps = mapStateToProps; Map wrappedMapStateToProps(TStore state) { return { - ...originalMapStateToProps!(state), - ...mapActionsToProps!(actionsForStore[state] as TActions), + ...originalMapStateToProps(state), + ...mapActionsToProps(actionsForStore[state] as TActions), }; } @@ -533,7 +532,7 @@ UiFactory Function(UiFactory) if (case4) { mapStateToProps = (state) { return { - ...mapActionsToProps!(actionsForStore[state] as TActions), + ...mapActionsToProps(actionsForStore[state] as TActions), }; }; } @@ -543,8 +542,8 @@ UiFactory Function(UiFactory) final originalMapStateWithOwnProps = mapStateToPropsWithOwnProps; Map wrappedMapStateWithOwnProps(TStore state, TProps ownProps) { return { - ...originalMapStateWithOwnProps!(state, ownProps), - ...mapActionsToPropsWithOwnProps!( + ...originalMapStateWithOwnProps(state, ownProps), + ...mapActionsToPropsWithOwnProps( actionsForStore[state] as TActions, ownProps), }; } @@ -556,7 +555,7 @@ UiFactory Function(UiFactory) if (case6) { mapStateToPropsWithOwnProps = (state, ownProps) { return { - ...mapActionsToPropsWithOwnProps!( + ...mapActionsToPropsWithOwnProps( actionsForStore[state] as TActions, ownProps), }; }; @@ -570,7 +569,7 @@ UiFactory Function(UiFactory) mapStateToPropsWithOwnProps = (state, ownProps) { return { ...newMapStateToProps!(state), - ...mapActionsToPropsWithOwnProps!( + ...mapActionsToPropsWithOwnProps( actionsForStore[state] as TActions, ownProps), }; }; @@ -586,7 +585,7 @@ UiFactory Function(UiFactory) Map wrappedMapStateToPropsWithOwnProps(TStore state, TProps ownProps) { return { ...originalMapStateWithOwnProps!(state, ownProps), - ...mapActionsToProps!(actionsForStore[state] as TActions), + ...mapActionsToProps(actionsForStore[state] as TActions), }; } diff --git a/lib/src/util/promise_interop.dart b/lib/src/util/promise_interop.dart index 613e4e8ad..85406d9b4 100644 --- a/lib/src/util/promise_interop.dart +++ b/lib/src/util/promise_interop.dart @@ -1,6 +1,5 @@ @JS() library over_react.promise_interop; -import 'dart:js'; import 'package:js/js.dart'; diff --git a/lib/src/util/react_wrappers.dart b/lib/src/util/react_wrappers.dart index 1c7dbad85..1164a1637 100644 --- a/lib/src/util/react_wrappers.dart +++ b/lib/src/util/react_wrappers.dart @@ -24,7 +24,6 @@ import 'package:over_react/over_react.dart'; import 'package:over_react/src/component_declaration/component_type_checking.dart'; import 'package:react/react.dart' as react; import 'package:react/react_client.dart'; -import 'package:react/react_client/js_backed_map.dart'; import 'package:react/react_client/js_interop_helpers.dart' show jsifyAndAllowInterop; import 'package:react/react_client/react_interop.dart' hide createRef; import 'package:react/react_dom.dart' as react_dom; diff --git a/lib/src/util/rem_util.dart b/lib/src/util/rem_util.dart index e46f306f8..17efc70b3 100644 --- a/lib/src/util/rem_util.dart +++ b/lib/src/util/rem_util.dart @@ -23,7 +23,6 @@ import 'package:meta/meta.dart'; import 'package:over_react/over_react.dart'; import 'package:over_react/components.dart' as v2; import 'package:over_react/src/component_declaration/component_base.dart' as component_base; -import 'package:over_react/src/util/css_value_util.dart'; import 'package:over_react/react_dom.dart' as react_dom; import 'package:platform_detect/platform_detect.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index b266a82dd..c4fe2df25 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,31 +3,31 @@ version: 5.2.0 description: A library for building statically-typed React UI components using Dart. homepage: https://github.com/Workiva/over_react/ environment: - sdk: '>=2.13.0 <3.0.0' + sdk: '>=2.19.0 <3.0.0' dependencies: collection: ^1.15.0 analyzer: ^5.13.0 - build: '>=1.0.0 <3.0.0' + build: ^2.0.0 dart_style: ^2.0.0 js: ^0.6.1+1 logging: ^1.0.0 meta: ^1.6.0 package_config: ^2.1.0 path: ^1.5.1 - react: ^7.0.0 - redux: '>=5.0.0 <6.0.0' + react: ^7.1.0 + redux: ^5.0.0 source_span: ^1.4.1 transformer_utils: ^0.2.6 w_common: ^3.0.0 w_flux: ^3.0.0 - platform_detect: '>=1.3.4 <3.0.0' - quiver: ">=0.25.0 <4.0.0" - redux_dev_tools: '>=0.4.0 <0.8.0' + platform_detect: ^2.0.0 + quiver: ^3.0.0 + redux_dev_tools: '>=0.6.0 <0.8.0' dev_dependencies: benchmark_harness: ^2.2.1 - build_resolvers: '>=1.0.5 <3.0.0' + build_resolvers: ^2.0.0 build_runner: ^2.0.0 build_test: ^2.0.0 build_web_compilers: ^3.0.0 @@ -35,7 +35,7 @@ dev_dependencies: dart_dev: ^4.0.1 dependency_validator: ^3.0.0 glob: ^2.0.1 - io: '>=0.3.2+1 <2.0.0' + io: ^1.0.0 react_testing_library: ^3.0.1 over_react_test: ^3.0.0 pedantic: ^1.11.1 diff --git a/test/over_react/component/element_type_test.dart b/test/over_react/component/element_type_test.dart index 1aece37f6..483917da2 100644 --- a/test/over_react/component/element_type_test.dart +++ b/test/over_react/component/element_type_test.dart @@ -16,7 +16,6 @@ library element_type_test; import 'package:test/test.dart'; import 'package:over_react/over_react.dart'; -import 'package:over_react/src/component/dom_components.dart'; part 'element_type_test.over_react.g.dart'; // ignore: uri_has_not_been_generated diff --git a/test/over_react/component/memo_test.dart b/test/over_react/component/memo_test.dart index 7141ada09..5a49c5259 100644 --- a/test/over_react/component/memo_test.dart +++ b/test/over_react/component/memo_test.dart @@ -14,7 +14,6 @@ library memo_test; -import 'package:over_react/src/util/memo.dart'; import 'package:over_react_test/over_react_test.dart'; import 'package:test/test.dart'; import 'package:over_react/over_react.dart'; diff --git a/test/over_react/component/ref_util_test.dart b/test/over_react/component/ref_util_test.dart index 3b575e1b9..04be1db5a 100644 --- a/test/over_react/component/ref_util_test.dart +++ b/test/over_react/component/ref_util_test.dart @@ -20,7 +20,6 @@ import 'dart:js_util'; import 'package:meta/meta.dart'; import 'package:test/test.dart'; import 'package:over_react/over_react.dart'; -import 'package:over_react/src/component/dom_components.dart'; import '../../test_util/test_util.dart'; import '../component/fixtures/basic_child_component.dart'; diff --git a/test/over_react/component_declaration/builder_integration_tests/component2/null_safe_accessor_integration_test.dart b/test/over_react/component_declaration/builder_integration_tests/component2/null_safe_accessor_integration_test.dart index e8e9f8c6e..bf78a2deb 100644 --- a/test/over_react/component_declaration/builder_integration_tests/component2/null_safe_accessor_integration_test.dart +++ b/test/over_react/component_declaration/builder_integration_tests/component2/null_safe_accessor_integration_test.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// ignore_for_file: unnecessary_question_mark @TestOn('browser') library over_react.test.component2.null_safe_accessor_integration_test; @@ -396,7 +397,6 @@ class _$NullSafeTestProps extends UiProps { String? nullable; dynamic nullableDynamic; - // ignore: unnecessary_question_mark dynamic? nullableDynamicWithQuestion; NullableTypedef nullableTypedefWithoutQuestion; } @@ -412,7 +412,6 @@ class _$NullSafeTestState extends UiState { String? nullable; dynamic nullableDynamic; - // ignore: unnecessary_question_mark dynamic? nullableDynamicWithQuestion; NullableTypedef nullableTypedefWithoutQuestion; } diff --git a/test/over_react/component_declaration/component_base_test.dart b/test/over_react/component_declaration/component_base_test.dart index 59d55ad0e..f02b4eef1 100644 --- a/test/over_react/component_declaration/component_base_test.dart +++ b/test/over_react/component_declaration/component_base_test.dart @@ -22,7 +22,6 @@ import 'dart:html'; import 'package:js/js_util.dart'; import 'package:over_react/over_react.dart' show Dom, DummyComponent, DummyComponent2, JsBackedMap, UiComponent2, UiStatefulComponent2, ValidationUtil, domProps, registerComponent2; import 'package:over_react/over_react.dart' as over_react; -import 'package:over_react_test/over_react_test.dart'; import 'package:over_react/src/component_declaration/component_base.dart'; import 'package:over_react/src/component_declaration/component_type_checking.dart'; import 'package:pedantic/pedantic.dart'; diff --git a/test/over_react/util/prop_key_util_test_dart2.dart b/test/over_react/util/prop_key_util_test_dart2.dart index b09847112..86a8b96c4 100644 --- a/test/over_react/util/prop_key_util_test_dart2.dart +++ b/test/over_react/util/prop_key_util_test_dart2.dart @@ -16,7 +16,6 @@ import 'package:test/test.dart'; import 'package:over_react/over_react.dart'; -import 'package:over_react/src/util/prop_key_util.dart'; part 'prop_key_util_test_dart2.over_react.g.dart'; diff --git a/test/over_react/util/safe_render_manager/safe_render_manager_test.dart b/test/over_react/util/safe_render_manager/safe_render_manager_test.dart index 2363d20f9..ae222284b 100644 --- a/test/over_react/util/safe_render_manager/safe_render_manager_test.dart +++ b/test/over_react/util/safe_render_manager/safe_render_manager_test.dart @@ -21,7 +21,6 @@ import 'dart:html'; import 'package:react/react.dart' as react; import 'package:over_react/over_react.dart'; -import 'package:over_react/src/util/safe_render_manager/safe_render_manager.dart'; import 'package:over_react_test/over_react_test.dart'; import 'package:test/test.dart'; import 'package:w_common/disposable.dart'; diff --git a/test/over_react_redux/fixtures/counter.dart b/test/over_react_redux/fixtures/counter.dart index 860618d1b..011523c6a 100644 --- a/test/over_react_redux/fixtures/counter.dart +++ b/test/over_react_redux/fixtures/counter.dart @@ -49,7 +49,7 @@ class CounterComponent extends UiComponent2 { ..onClick = (_) { if (props.increment != null) { props.increment!(); - } else if (props.dispatch != null) { + } else { props.dispatch(IncrementAction()); } } diff --git a/test/vm_tests/builder/declaration_parsing_test.dart b/test/vm_tests/builder/declaration_parsing_test.dart index 4cd93e9ac..faaeede88 100644 --- a/test/vm_tests/builder/declaration_parsing_test.dart +++ b/test/vm_tests/builder/declaration_parsing_test.dart @@ -20,13 +20,10 @@ library declaration_parsing_test; import 'package:analyzer/dart/analysis/utilities.dart'; import 'package:analyzer/dart/ast/ast.dart'; import 'package:build_test/build_test.dart' show recordLogs; -import 'package:collection/collection.dart' show IterableExtension; import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; import 'package:mocktail/mocktail.dart'; import 'package:over_react/src/builder/parsing.dart'; -import 'package:over_react/src/builder/parsing/member_association.dart'; -import 'package:over_react/src/builder/parsing/error_collection.dart'; import 'package:over_react/src/component_declaration/annotations.dart' as annotations; import 'package:source_span/source_span.dart'; import 'package:test/test.dart'; diff --git a/test/vm_tests/builder/parsing/member_association_test.dart b/test/vm_tests/builder/parsing/member_association_test.dart index b27ace70c..281901d94 100644 --- a/test/vm_tests/builder/parsing/member_association_test.dart +++ b/test/vm_tests/builder/parsing/member_association_test.dart @@ -13,7 +13,7 @@ // limitations under the License. @TestOn('vm') -import 'package:over_react/src/builder/parsing/member_association.dart'; + import 'package:over_react/src/builder/parsing.dart'; import 'package:test/test.dart'; diff --git a/web/component2/src/demos/custom_error_boundary.dart b/web/component2/src/demos/custom_error_boundary.dart index 56bee8121..6f291c6f6 100644 --- a/web/component2/src/demos/custom_error_boundary.dart +++ b/web/component2/src/demos/custom_error_boundary.dart @@ -14,7 +14,6 @@ // ignore_for_file: deprecated_member_use_from_same_package import 'package:over_react/over_react.dart'; -import 'package:react/react_client/react_interop.dart'; part 'custom_error_boundary.over_react.g.dart'; diff --git a/web/flux_to_redux/advanced/examples/influx_implementation/components/connect_flux_big_block.dart b/web/flux_to_redux/advanced/examples/influx_implementation/components/connect_flux_big_block.dart index 5c57da227..352764b8e 100644 --- a/web/flux_to_redux/advanced/examples/influx_implementation/components/connect_flux_big_block.dart +++ b/web/flux_to_redux/advanced/examples/influx_implementation/components/connect_flux_big_block.dart @@ -15,7 +15,6 @@ import 'package:over_react/over_react.dart'; import 'package:over_react/over_react_flux.dart'; import 'package:over_react/over_react_redux.dart'; -import 'package:over_react/src/util/hoc.dart'; import '../store.dart'; import '../../../components/little_block.dart';