Skip to content

Commit 94422f9

Browse files
Merge pull request #625 from Workiva/clean-up-static-analysis
Address static analysis lints/hints
2 parents 3e9bb81 + 32f97b4 commit 94422f9

File tree

102 files changed

+161
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+161
-213
lines changed

analysis_options.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ analyzer:
77
- app/**
88
- tools/analyzer_plugin/**
99
errors:
10+
unused_import: warning
11+
duplicate_import: warning
1012
missing_required_param: error
1113
must_call_super: error
1214
linter:

app/over_react_redux/todo_client/lib/src/components/app.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:over_react/over_react.dart';
22
import 'package:over_react/over_react_redux.dart';
3+
// ignore: implementation_imports
34
import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart';
45

56
import 'package:todo_client/src/actions.dart';

app/over_react_redux/todo_client/lib/src/components/todo_list.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:over_react/over_react.dart';
22
import 'package:over_react/over_react_redux.dart';
3+
// ignore: implementation_imports
34
import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart';
45

56
import 'package:todo_client/src/store.dart';

app/over_react_redux/todo_client/lib/src/components/todo_list_item.dart

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'dart:html';
22

33
import 'package:over_react/over_react.dart';
44
import 'package:over_react/over_react_redux.dart';
5+
// ignore: implementation_imports
56
import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart';
67

78
import 'package:todo_client/src/actions.dart';

app/over_react_redux/todo_client/lib/src/components/user_list.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:over_react/over_react.dart';
22
import 'package:over_react/over_react_redux.dart';
3+
// ignore: implementation_imports
34
import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart';
45

56
import 'package:todo_client/src/store.dart';

app/over_react_redux/todo_client/lib/src/components/user_list_item.dart

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'dart:html';
22

33
import 'package:over_react/over_react.dart';
44
import 'package:over_react/over_react_redux.dart';
5+
// ignore: implementation_imports
56
import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart';
67

78
import 'package:todo_client/src/actions.dart';

app/over_react_redux/todo_client/lib/src/components/user_selector.dart

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ library todo_client.src.components.user_selector;
22

33
import 'package:over_react/over_react.dart';
44
import 'package:over_react/over_react_redux.dart';
5+
// ignore: implementation_imports
56
import 'package:over_react/src/component/test_fixtures/redraw_counter_component_mixin.dart';
67

78
import 'package:todo_client/src/store.dart';

app/over_react_redux/todo_client/test/unit/browser/components/fixtures/utils.dart

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ bool muiJsIsAvailable() {
1616
}
1717

1818
void initializeComponentTests() {
19-
setClientConfiguration();
2019
enableTestMode();
2120
if (!muiJsIsAvailable()) return;
2221
}

app/over_react_redux/todo_client/test/unit/browser/components/js_interop_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import 'package:todo_client/src/utils.dart';
1414
external JsMap get mockJsMap;
1515

1616
main() {
17-
setClientConfiguration();
1817
JsBackedMap mockJsBackedMap;
1918

2019
setUpAll(() async {

app/over_react_redux/todo_client/test/unit/browser/components/material_ui_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'package:todo_client/src/components/shared/material_ui.dart';
77
import 'fixtures/utils.dart';
88

99
main() {
10-
setClientConfiguration();
1110
if (!muiJsIsAvailable()) return;
1211

1312
group('MaterialUI', () {

app/over_react_redux/todo_client/test/unit/browser/redux/store_test.dart

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@TestOn('browser')
22
import 'dart:convert';
33

4-
import 'package:over_react/over_react.dart';
54
import 'package:test/test.dart';
65

76
import 'package:todo_client/src/actions.dart';
@@ -13,7 +12,6 @@ import 'package:todo_client/src/store.dart';
1312
import '../fixtures/utils.dart';
1413

1514
main() {
16-
setClientConfiguration();
1715
const reasonCurrentSetShouldBePersisted =
1816
'The state update should be persisted as the "current" set in window.localStorage';
1917

app/over_react_redux/todo_client/web/main.dart

-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import 'dart:html';
22

3-
import 'package:over_react/over_react.dart';
43
import 'package:over_react/react_dom.dart' as react_dom;
54
import 'package:over_react/over_react_redux.dart';
65

76
import 'package:todo_client/todo_client.dart';
87

98
main() {
10-
setClientConfiguration();
11-
129
final container = querySelector('#todo-container');
1310

1411
final app = (ReduxProvider()..store = getStore())(

example/builder/main.dart

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ import './src/generic_inheritance_super.dart';
2525
import './src/function_component.dart' as function;
2626

2727
main() {
28-
setClientConfiguration();
29-
3028
react_dom.render(
3129
Dom.div()(
3230
Dom.h3()('Components'),

example/builder/src/basic_with_state.dart

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
// limitations under the License.
1414

1515
import 'package:over_react/over_react.dart';
16-
import 'props_mixin.dart' as pm;
17-
import 'state_mixin.dart';
1816

1917
part 'basic_with_state.over_react.g.dart';
2018

example/builder/src/private_component.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import 'package:over_react/over_react.dart';
1616

1717
part 'private_component.over_react.g.dart';
1818

19-
UiFactory<_PrivateProps> _Private = _$_Private; // ignore: undefined_identifier
19+
UiFactory<_PrivateProps> _Private = _$_Private; // ignore: undefined_identifier, unused_element
2020

2121
mixin _PrivateProps on UiProps {
2222
bool prop1;

example/builder/src/with_legacy_props_mixin.dart

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ mixin BasicPropsMixin on UiProps {
2222
String basicProp;
2323
}
2424

25+
// ignore: deprecated_member_use_from_same_package
2526
class BasicProps = UiProps with BasicPropsMixin, TransitionPropsMixin;
2627

2728
class BasicComponent extends UiComponent2<BasicProps> {

example/context/main.dart

-3
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ import 'dart:html';
1616

1717
import 'package:over_react/over_react.dart';
1818
import 'package:over_react/components.dart' as v2;
19-
import 'package:react/react_client.dart';
2019
import 'package:react/react_dom.dart' as react_dom;
2120
import './components/my_provider_component.dart';
2221
import './components/my_context_component.dart';
2322
import './context.dart';
2423

2524
main() {
26-
setClientConfiguration();
27-
2825
react_dom.render(
2926
v2.ErrorBoundary()(
3027
MyProvider()(

lib/over_react.dart

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export 'package:react/react.dart'
3434
export 'package:react/react_client/js_backed_map.dart' show JsBackedMap;
3535

3636
export 'package:react/react_client.dart'
37+
// ignore: deprecated_member_use
3738
show setClientConfiguration, ReactElement, ReactComponentFactoryProxy;
3839
export 'package:react/react_client/react_interop.dart' show ReactErrorInfo, Ref;
3940
export 'package:react/hooks.dart' show StateHook, ReducerHook;

lib/src/builder/codegen/names.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class FactoryNames {
4343
///
4444
/// - Input: `Foo`
4545
/// - Output: `_$Foo`
46-
String get implName => '$_prefix$privateSourcePrefix${unprefixedConsumerName}';
46+
String get implName => '$_prefix$privateSourcePrefix$unprefixedConsumerName';
4747

4848
/// The name of the generated function component props config for the factory.
4949
///

lib/src/builder/parsing/declarations_from_members.dart

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ Iterable<BoilerplateDeclaration> getBoilerplateDeclarations(
6969
if (members.isEmpty) return;
7070

7171
final _consumedMembers = <BoilerplateMember>{};
72-
final _functionComponentFactories = <BoilerplateFactory>{};
7372

7473
/// Indicate that [member] has been grouped into a declaration,
7574
/// so that it is not grouped into another declaration.

lib/src/builder/parsing/members/props_and_state_util.dart

+2
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ annotations.TypedMap getPropsOrStateAnnotation(bool isProps, AnnotatedNode node)
5555
final meta = isProps
5656
? (InstantiatedMeta<annotations.Props>(node) ??
5757
InstantiatedMeta<annotations.AbstractProps>(node) ??
58+
// ignore: deprecated_member_use_from_same_package
5859
InstantiatedMeta<annotations.PropsMixin>(node))
5960
: (InstantiatedMeta<annotations.State>(node) ??
6061
InstantiatedMeta<annotations.AbstractState>(node) ??
62+
// ignore: deprecated_member_use_from_same_package
6163
InstantiatedMeta<annotations.StateMixin>(node));
6264

6365
return meta?.value ?? (isProps ? annotations.Props() : annotations.State());

lib/src/component/_deprecated/abstract_transition.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ abstract class AbstractTransitionComponent<T extends AbstractTransitionProps,
159159

160160
/// Begin showing the [AbstractTransitionComponent], unless:
161161
/// * The [AbstractTransitionComponent] is already shown or is in the process of showing.
162-
/// * The [AbstractTransitionProps.onWillShow] callback returns `false`.
162+
/// * The [TransitionPropsMixin.onWillShow] callback returns `false`.
163163
void _handleShow() {
164164
if (isOrWillBeShown) {
165165
return;
@@ -179,7 +179,7 @@ abstract class AbstractTransitionComponent<T extends AbstractTransitionProps,
179179

180180
/// Begin hiding the [AbstractTransitionComponent], unless:
181181
/// * The [AbstractTransitionComponent] is already hidden or is in the process of being hidden.
182-
/// * The [AbstractTransitionProps.onWillHide] callback returns `false`.
182+
/// * The [TransitionPropsMixin.onWillHide] callback returns `false`.
183183
void _handleHide() {
184184
if (isOrWillBeHidden) {
185185
return;
@@ -426,7 +426,7 @@ abstract class AbstractTransitionComponent<T extends AbstractTransitionProps,
426426
_handleHide();
427427
}
428428

429-
/// Toggles the visibility of the [AbstractTransitionComponent] based on the value of [AbstractTransitionState.transitionPhase].
429+
/// Toggles the visibility of the [AbstractTransitionComponent] based on the value of `AbstractTransitionState.transitionPhase`.
430430
void toggle() {
431431
if (isOrWillBeShown) {
432432
/// If the [AbstractTransitionComponent] is shown or in the process of showing, hide it.

lib/src/component/_deprecated/error_boundary.dart

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class ErrorBoundaryComponent<T extends ErrorBoundaryProps, S extends ErrorBounda
146146
///
147147
/// This can be called manually on the component instance using a `ref` -
148148
/// or by passing in a new child instance after a child has thrown an error.
149+
@override
149150
void reset() {
150151
setState(initialState);
151152
}

lib/src/component/_deprecated/error_boundary_mixins.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: deprecated_member_use_from_same_package
1516
import 'dart:async';
1617

1718
import 'package:logging/logging.dart';
@@ -369,8 +370,8 @@ mixin ErrorBoundaryMixin<T extends ErrorBoundaryPropsMixin, S extends ErrorBound
369370
)();
370371
}
371372

372-
/// Called via [componentDidCatch] to start a `Timer` that will nullify the [_lastError] and [_lastErrorInfo]
373-
/// internal fields that keep track of the last error thrown.
373+
/// Called via [componentDidCatch] to start a `Timer` that will nullify the [_domAtTimeOfError]
374+
/// internal field that keeps track of the last error thrown.
374375
///
375376
/// If an identical error is thrown by an identical child component twice in a row:
376377
///

lib/src/component/aria_mixin.dart

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ abstract class $AriaPropsMixin {
3636

3737
/// Typed getters/setters for accessibility props.
3838
/// To be used as a mixin for React components and builders.
39+
// ignore: deprecated_member_use_from_same_package
3940
@PropsMixin(keyNamespace: '')
4041
abstract class _$AriaPropsMixin {
4142
Map get props;

lib/src/component/dummy_component2.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import 'package:over_react/over_react.dart';
1717
part 'dummy_component2.over_react.g.dart';
1818

1919
@Factory()
20-
// ignore: undefined_identifier
20+
// ignore: undefined_identifier, unused_element
2121
UiFactory<_Dummy2Props> _Dummy2 = _$_Dummy2;
2222

2323
@Props()

lib/src/component/error_boundary_recoverable.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ class RecoverableErrorBoundaryComponent<T extends RecoverableErrorBoundaryProps,
200200
)();
201201
}
202202

203-
/// Called via [componentDidCatch] to start a `Timer` that will nullify the [_lastError] and [_lastErrorInfo]
204-
/// internal fields that keep track of the last error thrown.
203+
/// Called via [componentDidCatch] to start a `Timer` that will nullify the [_domAtTimeOfError]
204+
/// internal field that keeps track of the last error thrown.
205205
///
206206
/// If an identical error is thrown by an identical child component twice in a row:
207207
///
@@ -210,7 +210,7 @@ class RecoverableErrorBoundaryComponent<T extends RecoverableErrorBoundaryProps,
210210
/// * __After the timer's callback fires__ - internal component logic will NOT treat the second error
211211
/// as an unrecoverable one.
212212
///
213-
/// > Not used when [ErrorBoundaryPropsMixin.fallbackUIRenderer] is set.
213+
/// > Not used when `ErrorBoundaryProps.fallbackUIRenderer` is set.
214214
void _startIdenticalErrorTimer() {
215215
if (_identicalErrorTimer != null) return;
216216

lib/src/component/fragment_component.dart

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import 'package:over_react/src/component_declaration/component_base.dart'
16-
as component_base;
1715
import 'package:over_react/src/component_declaration/builder_helpers.dart'
1816
as builder_helpers;
1917
import 'package:react/react_client.dart';

lib/src/component/hooks.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Ref<T> useRef<T>([T initialValue]) => react_hooks.useRef(initialValue);
325325

326326
/// Returns a memoized version of the return value of [createFunction].
327327
///
328-
/// If one of the [dependencies] has changed, [createFunction] is run during rendering of the [DartFunctionComponent].
328+
/// If one of the [dependencies] has changed, [createFunction] is run during rendering of the dart function component.
329329
/// This optimization helps to avoid expensive calculations on every render.
330330
///
331331
/// > __Note:__ there are two [rules for using Hooks](https://reactjs.org/docs/hooks-rules.html):
@@ -362,7 +362,7 @@ Ref<T> useRef<T>([T initialValue]) => react_hooks.useRef(initialValue);
362362
T useMemo<T>(T Function() createFunction, [List<dynamic> dependencies]) =>
363363
react_hooks.useMemo(createFunction, dependencies);
364364

365-
/// Runs [sideEffect] synchronously after a [DartFunctionComponent] renders, but before the screen is updated.
365+
/// Runs [sideEffect] synchronously after a dart function component renders, but before the screen is updated.
366366
///
367367
/// Compare to [useEffect] which runs [sideEffect] after the screen updates.
368368
/// Prefer the standard [useEffect] when possible to avoid blocking visual updates.
@@ -403,7 +403,7 @@ T useMemo<T>(T Function() createFunction, [List<dynamic> dependencies]) =>
403403
/// Learn more: <https://reactjs.org/docs/hooks-reference.html#uselayouteffect>.
404404
void useLayoutEffect(dynamic Function() sideEffect, [List<Object> dependencies]) => react_hooks.useLayoutEffect(sideEffect, dependencies);
405405

406-
/// Customizes the [ref] value that is exposed to parent components when using [uiForwardRef] by setting [ref.current]
406+
/// Customizes the [ref] value that is exposed to parent components when using [uiForwardRef] by setting [Ref.current]
407407
/// to the return value of [createHandle].
408408
///
409409
/// In most cases, imperative code using refs should be avoided.

lib/src/component/prop_mixins.dart

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
// ignore_for_file: deprecated_member_use_from_same_package
16+
1517
/// Various prop related mixins to be used with `UiComponent` descendants.
1618
library over_react.prop_mixins;
1719

lib/src/component/pure_component_mixin.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import 'package:over_react/over_react.dart';
1616

17-
/// A mixin to make a [react.Component2] instance behave
17+
/// A mixin to make a `Component2` instance behave
1818
/// like a [ReactJS `PureComponent`](https://reactjs.org/docs/react-api.html#reactpurecomponent).
1919
///
2020
/// The value of `props.children` is not compared deeply by default. Any time a new `ReactElement`

0 commit comments

Comments
 (0)