Fix lint errors

This commit is contained in:
Nathan Bierema 2023-11-04 15:56:56 -04:00
parent 763b9ff543
commit 884ad5fd91
7 changed files with 16 additions and 25 deletions

View File

@ -77,7 +77,7 @@ export default class TestGenerator<
A extends Action<string>,
> extends (PureComponent || Component)<Props<S, A>> {
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,

View File

@ -140,7 +140,7 @@ export default function ActionList<A extends Action<string>>({
const filteredActionIds = searchValue
? actionIds.filter(
(id) =>
(actions[id].action.type as string)
actions[id].action.type
.toLowerCase()
.indexOf(lowerSearchValue as string) !== -1,
)

View File

@ -73,7 +73,7 @@ export default class ActionListRow<
let actionType = action.type;
if (typeof actionType === 'undefined') actionType = '<UNDEFINED>';
else if (actionType === null) actionType = '<NULL>';
else actionType = (actionType as string).toString() || '<EMPTY>';
else actionType = actionType.toString() || '<EMPTY>';
return (
<div
@ -106,7 +106,7 @@ export default class ActionListRow<
isSkipped && 'actionListItemNameSkipped',
])}
>
{actionType as string}
{actionType}
</div>
{hideActionButtons ? (
<RightSlider styling={styling} shown>

View File

@ -71,7 +71,7 @@ export default class LogMonitorAction<
}}
>
<div style={styles.actionBar} onClick={this.props.onClick}>
{type !== null && (type as string).toString()}
{type !== null && type.toString()}
</div>
{!this.props.collapsed ? this.renderPayload(payload) : ''}
</div>

View File

@ -492,25 +492,19 @@ class DevToolsEnhancer<S, A extends Action<string>> {
if (
this.startOn &&
!this.started &&
this.startOn.indexOf(
(action as PerformAction<A>).action.type as string,
) !== -1
this.startOn.indexOf((action as PerformAction<A>).action.type) !== -1
)
async(this.start);
else if (
this.stopOn &&
this.started &&
this.stopOn.indexOf(
(action as PerformAction<A>).action.type as string,
) !== -1
this.stopOn.indexOf((action as PerformAction<A>).action.type) !== -1
)
async(this.stop);
else if (
this.sendOn &&
!this.started &&
this.sendOn.indexOf(
(action as PerformAction<A>).action.type as string,
) !== -1
this.sendOn.indexOf((action as PerformAction<A>).action.type) !== -1
)
async(this.send);
}

View File

@ -333,7 +333,7 @@ class SliderMonitor<S, A extends Action<string>> extends (PureComponent ||
let actionType = actionsById[actionId].action.type;
if (actionType === undefined) actionType = '<UNDEFINED>';
else if (actionType === null) actionType = '<NULL>';
else actionType = (actionType as string).toString() || '<EMPTY>';
else actionType = actionType.toString() || '<EMPTY>';
const onPlayClick =
replaySpeed === 'Live' ? this.startRealtimeReplay : this.startReplay;
@ -352,7 +352,7 @@ class SliderMonitor<S, A extends Action<string>> extends (PureComponent ||
<Toolbar noBorder compact fullHeight theme={theme}>
{playPause}
<Slider
label={actionType as string}
label={actionType}
sublabel={`(${actionId})`}
min={0}
max={max}

View File

@ -100,16 +100,16 @@ export function isFiltered(
(!localFilter &&
opts.filter &&
opts.filter === FilterState.DO_NOT_FILTER) ||
(type && typeof (type as string).match !== 'function')
(type && typeof type.match !== 'function')
)
return false;
const { allowlist, denylist } = localFilter || opts;
return (
// eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
(allowlist && !(type as string).match(allowlist)) ||
(allowlist && !type.match(allowlist)) ||
// eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
(denylist && (type as string).match(denylist))
(denylist && type.match(denylist))
);
}