From a1ded90927e218cbb9d7a641432a05d2a1296830 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 4 Nov 2023 15:56:56 -0400 Subject: [PATCH] Fix lint errors --- .../src/TestGenerator.tsx | 11 ++++------- .../src/ActionList.tsx | 2 +- .../src/ActionListRow.tsx | 4 ++-- .../src/LogMonitorEntryAction.tsx | 2 +- packages/redux-devtools-remote/src/devTools.ts | 12 +++--------- .../src/SliderMonitor.tsx | 4 ++-- packages/redux-devtools-utils/src/filters.ts | 6 +++--- 7 files changed, 16 insertions(+), 25 deletions(-) diff --git a/packages/redux-devtools-inspector-monitor-test-tab/src/TestGenerator.tsx b/packages/redux-devtools-inspector-monitor-test-tab/src/TestGenerator.tsx index 5a8f38c8..2449c09c 100644 --- a/packages/redux-devtools-inspector-monitor-test-tab/src/TestGenerator.tsx +++ b/packages/redux-devtools-inspector-monitor-test-tab/src/TestGenerator.tsx @@ -77,7 +77,7 @@ export default class TestGenerator< A extends Action, > extends (PureComponent || Component)> { getMethod(action: A) { - let type: string = action.type as string; + let type = action.type; if (type[0] === '┗') type = type.substr(1).trim(); const args = (action as unknown as { arguments: unknown[] }).arguments ? (action as unknown as { arguments: unknown[] }).arguments @@ -143,11 +143,11 @@ export default class TestGenerator< if ( !isVanilla || /* eslint-disable-next-line no-useless-escape */ - /^┗?\s?[a-zA-Z0-9_@.\[\]-]+?$/.test(actions[i].action.type as string) + /^┗?\s?[a-zA-Z0-9_@.\[\]-]+?$/.test(actions[i].action.type) ) { if (isFirst) isFirst = false; else r += space; - if (!isVanilla || (actions[i].action.type as string)[0] !== '@') { + if (!isVanilla || actions[i].action.type[0] !== '@') { r += (dispatcher as (locals: DispatcherLocals) => string)({ action: !isVanilla @@ -184,10 +184,7 @@ export default class TestGenerator< actionName: (selectedActionId === null || selectedActionId > 0) && actions[startIdx] - ? (actions[startIdx].action.type as string).replace( - /[^a-zA-Z0-9_-]+/, - '', - ) + ? actions[startIdx].action.type.replace(/[^a-zA-Z0-9_-]+/, '') : 'should return the initial state', initialState: stringify(computedStates[startIdx - 1].state), assertions: r, diff --git a/packages/redux-devtools-inspector-monitor/src/ActionList.tsx b/packages/redux-devtools-inspector-monitor/src/ActionList.tsx index 7baba2e3..41e020af 100644 --- a/packages/redux-devtools-inspector-monitor/src/ActionList.tsx +++ b/packages/redux-devtools-inspector-monitor/src/ActionList.tsx @@ -140,7 +140,7 @@ export default function ActionList>({ const filteredActionIds = searchValue ? actionIds.filter( (id) => - (actions[id].action.type as string) + actions[id].action.type .toLowerCase() .indexOf(lowerSearchValue as string) !== -1, ) diff --git a/packages/redux-devtools-inspector-monitor/src/ActionListRow.tsx b/packages/redux-devtools-inspector-monitor/src/ActionListRow.tsx index 50b3e262..48b8c0f3 100644 --- a/packages/redux-devtools-inspector-monitor/src/ActionListRow.tsx +++ b/packages/redux-devtools-inspector-monitor/src/ActionListRow.tsx @@ -73,7 +73,7 @@ export default class ActionListRow< let actionType = action.type; if (typeof actionType === 'undefined') actionType = ''; else if (actionType === null) actionType = ''; - else actionType = (actionType as string).toString() || ''; + else actionType = actionType.toString() || ''; return (
- {actionType as string} + {actionType}
{hideActionButtons ? ( diff --git a/packages/redux-devtools-log-monitor/src/LogMonitorEntryAction.tsx b/packages/redux-devtools-log-monitor/src/LogMonitorEntryAction.tsx index 1e02a633..5a4fac9f 100644 --- a/packages/redux-devtools-log-monitor/src/LogMonitorEntryAction.tsx +++ b/packages/redux-devtools-log-monitor/src/LogMonitorEntryAction.tsx @@ -71,7 +71,7 @@ export default class LogMonitorAction< }} >
- {type !== null && (type as string).toString()} + {type !== null && type.toString()}
{!this.props.collapsed ? this.renderPayload(payload) : ''} diff --git a/packages/redux-devtools-remote/src/devTools.ts b/packages/redux-devtools-remote/src/devTools.ts index f5942442..4da6ff31 100644 --- a/packages/redux-devtools-remote/src/devTools.ts +++ b/packages/redux-devtools-remote/src/devTools.ts @@ -492,25 +492,19 @@ class DevToolsEnhancer> { if ( this.startOn && !this.started && - this.startOn.indexOf( - (action as PerformAction
).action.type as string, - ) !== -1 + this.startOn.indexOf((action as PerformAction).action.type) !== -1 ) async(this.start); else if ( this.stopOn && this.started && - this.stopOn.indexOf( - (action as PerformAction).action.type as string, - ) !== -1 + this.stopOn.indexOf((action as PerformAction).action.type) !== -1 ) async(this.stop); else if ( this.sendOn && !this.started && - this.sendOn.indexOf( - (action as PerformAction).action.type as string, - ) !== -1 + this.sendOn.indexOf((action as PerformAction).action.type) !== -1 ) async(this.send); } diff --git a/packages/redux-devtools-slider-monitor/src/SliderMonitor.tsx b/packages/redux-devtools-slider-monitor/src/SliderMonitor.tsx index 5b0aa08d..9840573e 100644 --- a/packages/redux-devtools-slider-monitor/src/SliderMonitor.tsx +++ b/packages/redux-devtools-slider-monitor/src/SliderMonitor.tsx @@ -333,7 +333,7 @@ class SliderMonitor> extends (PureComponent || let actionType = actionsById[actionId].action.type; if (actionType === undefined) actionType = ''; else if (actionType === null) actionType = ''; - else actionType = (actionType as string).toString() || ''; + else actionType = actionType.toString() || ''; const onPlayClick = replaySpeed === 'Live' ? this.startRealtimeReplay : this.startReplay; @@ -352,7 +352,7 @@ class SliderMonitor> extends (PureComponent || {playPause}