From 32f97b422cf9b9e5a6ce5a69e25f145320d5499d Mon Sep 17 00:00:00 2001 From: Aaron Lademann Date: Thu, 3 Sep 2020 13:57:39 -0700 Subject: [PATCH] Address static analysis lints/hints --- analysis_options.yaml | 2 ++ .../todo_client/lib/src/components/app.dart | 1 + .../lib/src/components/todo_list.dart | 1 + .../lib/src/components/todo_list_item.dart | 1 + .../lib/src/components/user_list.dart | 1 + .../lib/src/components/user_list_item.dart | 1 + .../lib/src/components/user_selector.dart | 1 + .../browser/components/fixtures/utils.dart | 1 - .../browser/components/js_interop_test.dart | 1 - .../browser/components/material_ui_test.dart | 1 - .../test/unit/browser/redux/store_test.dart | 2 -- .../todo_client/web/main.dart | 3 --- example/builder/main.dart | 2 -- example/builder/src/basic_with_state.dart | 2 -- example/builder/src/private_component.dart | 2 +- .../builder/src/with_legacy_props_mixin.dart | 1 + example/context/main.dart | 3 --- lib/over_react.dart | 1 + lib/src/builder/codegen/names.dart | 2 +- .../parsing/declarations_from_members.dart | 1 - .../parsing/members/props_and_state_util.dart | 2 ++ .../_deprecated/abstract_transition.dart | 6 +++--- .../component/_deprecated/error_boundary.dart | 1 + .../_deprecated/error_boundary_mixins.dart | 5 +++-- lib/src/component/aria_mixin.dart | 1 + lib/src/component/dummy_component2.dart | 2 +- .../component/error_boundary_recoverable.dart | 6 +++--- lib/src/component/fragment_component.dart | 2 -- lib/src/component/hooks.dart | 8 ++++---- lib/src/component/prop_mixins.dart | 2 ++ lib/src/component/pure_component_mixin.dart | 2 +- lib/src/component/resize_sensor.dart | 20 +++++++++---------- lib/src/component/strictmode_component.dart | 2 +- .../component_declaration/component_base.dart | 2 +- .../component_base_2.dart | 3 ++- lib/src/over_react_redux/over_react_flux.dart | 1 + .../over_react_redux/over_react_redux.dart | 1 + lib/src/util/class_names.dart | 10 ++++++---- lib/src/util/class_names.over_react.g.dart | 8 ++++---- lib/src/util/dom_util.dart | 4 ++-- lib/src/util/react_util.dart | 2 +- .../accessor_mixin_integration_test.dart | 1 + .../accessor_mixin_integration_test.dart | 1 + .../accessor_mixin_integration_test.dart | 1 + .../accessor_mixin_integration_test.dart | 1 + .../flux_component_test/component2/basic.dart | 1 + .../component2/handler_lifecycle.dart | 1 + .../component2/handler_precedence.dart | 1 + .../component2/prop_validation.dart | 1 + .../component2/redraw_on.dart | 1 + .../component2/stateful/basic.dart | 1 + .../stateful/handler_lifecycle.dart | 1 + .../stateful/handler_precedence.dart | 1 + .../component2/stateful/prop_validation.dart | 1 + .../component2/stateful/redraw_on.dart | 1 + .../component2/stateful/store_handlers.dart | 1 + .../component2/store_handlers.dart | 1 + .../safe_render_manager_helper_test.dart | 1 - test/over_react/util/shared_type_tester.dart | 4 ++-- ...over_react_component_declaration_test.dart | 3 --- test/over_react_dom_test.dart | 2 -- .../fixtures/flux_counter.dart | 1 + .../redux_multi_provider_test.dart | 1 - test/over_react_redux_test.dart | 3 --- test/over_react_util_test.dart | 3 --- .../builder/declaration_parsing_test.dart | 2 +- web/component1/index.dart | 3 --- .../src/demo_components/button.dart | 6 +++--- .../demo_components/button.over_react.g.dart | 12 +++++------ .../src/demo_components/list_group_item.dart | 18 ++++++++--------- .../list_group_item.over_react.g.dart | 12 +++++------ .../src/demo_components/progress.dart | 6 +++--- .../progress.over_react.g.dart | 4 ++-- .../src/demo_components/toggle_button.dart | 14 ++++++------- .../toggle_button.over_react.g.dart | 20 +++++++++---------- .../demo_components/toggle_button_group.dart | 6 +++--- web/component1/src/demos/button/index.dart | 3 --- .../src/demos/list-group/index.dart | 3 --- web/component1/src/demos/progress/index.dart | 3 --- web/component1/src/demos/tag/index.dart | 3 --- web/component1/src/shared/constants.dart | 7 ++++--- .../src/shared/constants.over_react.g.dart | 8 ++++---- web/component2/index.dart | 2 -- .../src/demo_components/button.dart | 6 +++--- .../src/demo_components/list_group_item.dart | 10 +++++----- .../src/demo_components/progress.dart | 2 +- .../src/demo_components/toggle_button.dart | 14 ++++++------- .../demo_components/toggle_button_group.dart | 6 +++--- web/component2/src/demos/button/index.dart | 3 --- .../src/demos/list-group/index.dart | 3 --- web/component2/src/demos/progress/index.dart | 3 --- web/component2/src/demos/tag/index.dart | 3 --- web/component2/src/shared/constants.dart | 7 ++++--- .../examples/flux_implementation/index.dart | 4 ---- .../examples/influx_implementation/index.dart | 4 ---- .../examples/redux_implementation/index.dart | 4 ---- .../examples/flux_implementation/index.dart | 4 ---- .../examples/influx_implementation/index.dart | 4 ---- .../examples/redux_implementation/index.dart | 4 ---- .../examples/dev_tools/index.dart | 3 --- .../examples/multiple_stores/index.dart | 3 --- .../examples/simple/index.dart | 3 --- 102 files changed, 162 insertions(+), 214 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 0b2ae5884..7750ff7e5 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -7,6 +7,8 @@ analyzer: - app/** - tools/analyzer_plugin/** errors: + unused_import: warning + duplicate_import: warning missing_required_param: error must_call_super: error linter: diff --git a/app/over_react_redux/todo_client/lib/src/components/app.dart b/app/over_react_redux/todo_client/lib/src/components/app.dart index f99170ed3..617ec3704 100644 --- a/app/over_react_redux/todo_client/lib/src/components/app.dart +++ b/app/over_react_redux/todo_client/lib/src/components/app.dart @@ -1,5 +1,6 @@ import 'package:over_react/over_react.dart'; import 'package:over_react/over_react_redux.dart'; +// ignore: implementation_imports import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart'; import 'package:todo_client/src/actions.dart'; diff --git a/app/over_react_redux/todo_client/lib/src/components/todo_list.dart b/app/over_react_redux/todo_client/lib/src/components/todo_list.dart index 3481c8d36..51b3a48b3 100644 --- a/app/over_react_redux/todo_client/lib/src/components/todo_list.dart +++ b/app/over_react_redux/todo_client/lib/src/components/todo_list.dart @@ -1,5 +1,6 @@ import 'package:over_react/over_react.dart'; import 'package:over_react/over_react_redux.dart'; +// ignore: implementation_imports import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart'; import 'package:todo_client/src/store.dart'; diff --git a/app/over_react_redux/todo_client/lib/src/components/todo_list_item.dart b/app/over_react_redux/todo_client/lib/src/components/todo_list_item.dart index 2f88dc196..3fe51bd29 100644 --- a/app/over_react_redux/todo_client/lib/src/components/todo_list_item.dart +++ b/app/over_react_redux/todo_client/lib/src/components/todo_list_item.dart @@ -2,6 +2,7 @@ import 'dart:html'; import 'package:over_react/over_react.dart'; import 'package:over_react/over_react_redux.dart'; +// ignore: implementation_imports import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart'; import 'package:todo_client/src/actions.dart'; diff --git a/app/over_react_redux/todo_client/lib/src/components/user_list.dart b/app/over_react_redux/todo_client/lib/src/components/user_list.dart index 24290e223..0f9c15741 100644 --- a/app/over_react_redux/todo_client/lib/src/components/user_list.dart +++ b/app/over_react_redux/todo_client/lib/src/components/user_list.dart @@ -1,5 +1,6 @@ import 'package:over_react/over_react.dart'; import 'package:over_react/over_react_redux.dart'; +// ignore: implementation_imports import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart'; import 'package:todo_client/src/store.dart'; diff --git a/app/over_react_redux/todo_client/lib/src/components/user_list_item.dart b/app/over_react_redux/todo_client/lib/src/components/user_list_item.dart index 567b5593a..dcbb09c7d 100644 --- a/app/over_react_redux/todo_client/lib/src/components/user_list_item.dart +++ b/app/over_react_redux/todo_client/lib/src/components/user_list_item.dart @@ -2,6 +2,7 @@ import 'dart:html'; import 'package:over_react/over_react.dart'; import 'package:over_react/over_react_redux.dart'; +// ignore: implementation_imports import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart'; import 'package:todo_client/src/actions.dart'; diff --git a/app/over_react_redux/todo_client/lib/src/components/user_selector.dart b/app/over_react_redux/todo_client/lib/src/components/user_selector.dart index e166168b0..b579045da 100644 --- a/app/over_react_redux/todo_client/lib/src/components/user_selector.dart +++ b/app/over_react_redux/todo_client/lib/src/components/user_selector.dart @@ -2,6 +2,7 @@ library todo_client.src.components.user_selector; import 'package:over_react/over_react.dart'; import 'package:over_react/over_react_redux.dart'; +// ignore: implementation_imports import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart'; import 'package:todo_client/src/store.dart'; diff --git a/app/over_react_redux/todo_client/test/unit/browser/components/fixtures/utils.dart b/app/over_react_redux/todo_client/test/unit/browser/components/fixtures/utils.dart index cfa43b5cd..06bfd559e 100644 --- a/app/over_react_redux/todo_client/test/unit/browser/components/fixtures/utils.dart +++ b/app/over_react_redux/todo_client/test/unit/browser/components/fixtures/utils.dart @@ -16,7 +16,6 @@ bool muiJsIsAvailable() { } void initializeComponentTests() { - setClientConfiguration(); enableTestMode(); if (!muiJsIsAvailable()) return; } diff --git a/app/over_react_redux/todo_client/test/unit/browser/components/js_interop_test.dart b/app/over_react_redux/todo_client/test/unit/browser/components/js_interop_test.dart index 144e30cb0..b3044b701 100644 --- a/app/over_react_redux/todo_client/test/unit/browser/components/js_interop_test.dart +++ b/app/over_react_redux/todo_client/test/unit/browser/components/js_interop_test.dart @@ -14,7 +14,6 @@ import 'package:todo_client/src/utils.dart'; external JsMap get mockJsMap; main() { - setClientConfiguration(); JsBackedMap mockJsBackedMap; setUpAll(() async { diff --git a/app/over_react_redux/todo_client/test/unit/browser/components/material_ui_test.dart b/app/over_react_redux/todo_client/test/unit/browser/components/material_ui_test.dart index ada6e1f8e..4e923c142 100644 --- a/app/over_react_redux/todo_client/test/unit/browser/components/material_ui_test.dart +++ b/app/over_react_redux/todo_client/test/unit/browser/components/material_ui_test.dart @@ -7,7 +7,6 @@ import 'package:todo_client/src/components/shared/material_ui.dart'; import 'fixtures/utils.dart'; main() { - setClientConfiguration(); if (!muiJsIsAvailable()) return; group('MaterialUI', () { diff --git a/app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart b/app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart index 189dc0fa7..604881ac9 100644 --- a/app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart +++ b/app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart @@ -1,7 +1,6 @@ @TestOn('browser') import 'dart:convert'; -import 'package:over_react/over_react.dart'; import 'package:test/test.dart'; import 'package:todo_client/src/actions.dart'; @@ -13,7 +12,6 @@ import 'package:todo_client/src/store.dart'; import '../fixtures/utils.dart'; main() { - setClientConfiguration(); const reasonCurrentSetShouldBePersisted = 'The state update should be persisted as the "current" set in window.localStorage'; diff --git a/app/over_react_redux/todo_client/web/main.dart b/app/over_react_redux/todo_client/web/main.dart index a29a443c0..ce53351e0 100644 --- a/app/over_react_redux/todo_client/web/main.dart +++ b/app/over_react_redux/todo_client/web/main.dart @@ -1,14 +1,11 @@ import 'dart:html'; -import 'package:over_react/over_react.dart'; import 'package:over_react/react_dom.dart' as react_dom; import 'package:over_react/over_react_redux.dart'; import 'package:todo_client/todo_client.dart'; main() { - setClientConfiguration(); - final container = querySelector('#todo-container'); final app = (ReduxProvider()..store = getStore())( diff --git a/example/builder/main.dart b/example/builder/main.dart index fc657bc21..1ee59c63d 100644 --- a/example/builder/main.dart +++ b/example/builder/main.dart @@ -25,8 +25,6 @@ import './src/generic_inheritance_super.dart'; import './src/function_component.dart' as function; main() { - setClientConfiguration(); - react_dom.render( Dom.div()( Dom.h3()('Components'), diff --git a/example/builder/src/basic_with_state.dart b/example/builder/src/basic_with_state.dart index f6a34a445..81fd407e5 100644 --- a/example/builder/src/basic_with_state.dart +++ b/example/builder/src/basic_with_state.dart @@ -13,8 +13,6 @@ // limitations under the License. import 'package:over_react/over_react.dart'; -import 'props_mixin.dart' as pm; -import 'state_mixin.dart'; part 'basic_with_state.over_react.g.dart'; diff --git a/example/builder/src/private_component.dart b/example/builder/src/private_component.dart index ff7076a15..7742690ba 100644 --- a/example/builder/src/private_component.dart +++ b/example/builder/src/private_component.dart @@ -16,7 +16,7 @@ import 'package:over_react/over_react.dart'; part 'private_component.over_react.g.dart'; -UiFactory<_PrivateProps> _Private = _$_Private; // ignore: undefined_identifier +UiFactory<_PrivateProps> _Private = _$_Private; // ignore: undefined_identifier, unused_element mixin _PrivateProps on UiProps { bool prop1; diff --git a/example/builder/src/with_legacy_props_mixin.dart b/example/builder/src/with_legacy_props_mixin.dart index e45f44e81..c6698bbd9 100644 --- a/example/builder/src/with_legacy_props_mixin.dart +++ b/example/builder/src/with_legacy_props_mixin.dart @@ -22,6 +22,7 @@ mixin BasicPropsMixin on UiProps { String basicProp; } +// ignore: deprecated_member_use_from_same_package class BasicProps = UiProps with BasicPropsMixin, TransitionPropsMixin; class BasicComponent extends UiComponent2 { diff --git a/example/context/main.dart b/example/context/main.dart index e0e3dca69..c3662f9f6 100644 --- a/example/context/main.dart +++ b/example/context/main.dart @@ -16,15 +16,12 @@ import 'dart:html'; import 'package:over_react/over_react.dart'; import 'package:over_react/components.dart' as v2; -import 'package:react/react_client.dart'; import 'package:react/react_dom.dart' as react_dom; import './components/my_provider_component.dart'; import './components/my_context_component.dart'; import './context.dart'; main() { - setClientConfiguration(); - react_dom.render( v2.ErrorBoundary()( MyProvider()( diff --git a/lib/over_react.dart b/lib/over_react.dart index ce8f95ef6..ede2aa288 100644 --- a/lib/over_react.dart +++ b/lib/over_react.dart @@ -34,6 +34,7 @@ export 'package:react/react.dart' export 'package:react/react_client/js_backed_map.dart' show JsBackedMap; export 'package:react/react_client.dart' + // ignore: deprecated_member_use show setClientConfiguration, ReactElement, ReactComponentFactoryProxy; export 'package:react/react_client/react_interop.dart' show ReactErrorInfo, Ref; export 'package:react/hooks.dart' show StateHook, ReducerHook; diff --git a/lib/src/builder/codegen/names.dart b/lib/src/builder/codegen/names.dart index 4e46fee68..57b8ff95f 100644 --- a/lib/src/builder/codegen/names.dart +++ b/lib/src/builder/codegen/names.dart @@ -43,7 +43,7 @@ class FactoryNames { /// /// - Input: `Foo` /// - Output: `_$Foo` - String get implName => '$_prefix$privateSourcePrefix${unprefixedConsumerName}'; + String get implName => '$_prefix$privateSourcePrefix$unprefixedConsumerName'; /// The name of the generated function component props config for the factory. /// diff --git a/lib/src/builder/parsing/declarations_from_members.dart b/lib/src/builder/parsing/declarations_from_members.dart index 59f74f1d1..1532ecc4c 100644 --- a/lib/src/builder/parsing/declarations_from_members.dart +++ b/lib/src/builder/parsing/declarations_from_members.dart @@ -69,7 +69,6 @@ Iterable getBoilerplateDeclarations( if (members.isEmpty) return; final _consumedMembers = {}; - final _functionComponentFactories = {}; /// Indicate that [member] has been grouped into a declaration, /// so that it is not grouped into another declaration. diff --git a/lib/src/builder/parsing/members/props_and_state_util.dart b/lib/src/builder/parsing/members/props_and_state_util.dart index d8c09c705..811eeaf3b 100644 --- a/lib/src/builder/parsing/members/props_and_state_util.dart +++ b/lib/src/builder/parsing/members/props_and_state_util.dart @@ -55,9 +55,11 @@ annotations.TypedMap getPropsOrStateAnnotation(bool isProps, AnnotatedNode node) final meta = isProps ? (InstantiatedMeta(node) ?? InstantiatedMeta(node) ?? + // ignore: deprecated_member_use_from_same_package InstantiatedMeta(node)) : (InstantiatedMeta(node) ?? InstantiatedMeta(node) ?? + // ignore: deprecated_member_use_from_same_package InstantiatedMeta(node)); return meta?.value ?? (isProps ? annotations.Props() : annotations.State()); diff --git a/lib/src/component/_deprecated/abstract_transition.dart b/lib/src/component/_deprecated/abstract_transition.dart index 8bb08028a..8487f8663 100644 --- a/lib/src/component/_deprecated/abstract_transition.dart +++ b/lib/src/component/_deprecated/abstract_transition.dart @@ -159,7 +159,7 @@ abstract class AbstractTransitionComponent