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>, A extends Action<string>,
> extends (PureComponent || Component)<Props<S, A>> { > extends (PureComponent || Component)<Props<S, A>> {
getMethod(action: A) { getMethod(action: A) {
let type: string = action.type as string; let type = action.type;
if (type[0] === '┗') type = type.substr(1).trim(); if (type[0] === '┗') type = type.substr(1).trim();
const args = (action as unknown as { arguments: unknown[] }).arguments const args = (action as unknown as { arguments: unknown[] }).arguments
? (action as unknown as { arguments: unknown[] }).arguments ? (action as unknown as { arguments: unknown[] }).arguments
@ -143,11 +143,11 @@ export default class TestGenerator<
if ( if (
!isVanilla || !isVanilla ||
/* eslint-disable-next-line no-useless-escape */ /* 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; if (isFirst) isFirst = false;
else r += space; else r += space;
if (!isVanilla || (actions[i].action.type as string)[0] !== '@') { if (!isVanilla || actions[i].action.type[0] !== '@') {
r += r +=
(dispatcher as (locals: DispatcherLocals) => string)({ (dispatcher as (locals: DispatcherLocals) => string)({
action: !isVanilla action: !isVanilla
@ -184,10 +184,7 @@ export default class TestGenerator<
actionName: actionName:
(selectedActionId === null || selectedActionId > 0) && (selectedActionId === null || selectedActionId > 0) &&
actions[startIdx] actions[startIdx]
? (actions[startIdx].action.type as string).replace( ? actions[startIdx].action.type.replace(/[^a-zA-Z0-9_-]+/, '')
/[^a-zA-Z0-9_-]+/,
'',
)
: 'should return the initial state', : 'should return the initial state',
initialState: stringify(computedStates[startIdx - 1].state), initialState: stringify(computedStates[startIdx - 1].state),
assertions: r, assertions: r,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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