Fix some unbound-method ESLint errors (#1576)

* Fix some unbound-method ESLint errors

* Keep that one
This commit is contained in:
Nathan Bierema 2023-12-17 22:03:02 -05:00 committed by GitHub
parent e9afa8fb27
commit b79b2c3bbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 31 additions and 38 deletions

View File

@ -9,7 +9,6 @@ import InstanceSelector from './InstanceSelector';
import SyncButton from './buttons/SyncButton';
import { Options, State } from '../reducers/instances';
// eslint-disable-next-line @typescript-eslint/unbound-method
const { reset, rollback, commit, sweep } = ActionCreators;
interface Props {

View File

@ -27,6 +27,7 @@ class DevTools extends Component<Props> {
LiftedState<unknown, Action<string>, unknown>
> & {
update(
this: void,
monitorProps: unknown,
state: unknown | undefined,
action: Action<string>,
@ -44,7 +45,6 @@ class DevTools extends Component<Props> {
this.monitorProps = monitorElement.props;
this.Monitor = monitorElement.type;
// eslint-disable-next-line @typescript-eslint/unbound-method
const update = this.Monitor!.update;
if (update) {
let newMonitorState;

View File

@ -11,7 +11,7 @@ import type { Options } from 'd3-state-visualizer';
import reducer, { ChartMonitorState } from './reducers';
import Chart, { Props } from './Chart';
// eslint-disable-next-line @typescript-eslint/unbound-method
const { reset, rollback, commit, sweep, toggleAction } = ActionCreators;
const styles: { container: CSSProperties } = {

View File

@ -25,17 +25,11 @@ import {
import { ThemeProvider } from '@emotion/react';
const {
// eslint-disable-next-line @typescript-eslint/unbound-method
commit,
// eslint-disable-next-line @typescript-eslint/unbound-method
sweep,
// eslint-disable-next-line @typescript-eslint/unbound-method
toggleAction,
// eslint-disable-next-line @typescript-eslint/unbound-method
jumpToAction,
// eslint-disable-next-line @typescript-eslint/unbound-method
jumpToState,
// eslint-disable-next-line @typescript-eslint/unbound-method
reorderAction,
} = ActionCreators;

View File

@ -133,6 +133,7 @@ export type LiftedAction<S, A extends Action<string>, MonitorState> =
*/
export const ActionCreators = {
performAction<A extends Action<string>>(
this: void,
action: A,
trace?: ((action: A) => string | undefined) | boolean,
traceLimit?: number,
@ -203,27 +204,28 @@ export const ActionCreators = {
};
},
reset(): ResetAction {
reset(this: void): ResetAction {
return { type: ActionTypes.RESET, timestamp: Date.now() };
},
rollback(): RollbackAction {
rollback(this: void): RollbackAction {
return { type: ActionTypes.ROLLBACK, timestamp: Date.now() };
},
commit(): CommitAction {
commit(this: void): CommitAction {
return { type: ActionTypes.COMMIT, timestamp: Date.now() };
},
sweep(): SweepAction {
sweep(this: void): SweepAction {
return { type: ActionTypes.SWEEP };
},
toggleAction(id: number): ToggleAction {
toggleAction(this: void, id: number): ToggleAction {
return { type: ActionTypes.TOGGLE_ACTION, id };
},
setActionsActive(
this: void,
start: number,
end: number,
active = true,
@ -231,30 +233,35 @@ export const ActionCreators = {
return { type: ActionTypes.SET_ACTIONS_ACTIVE, start, end, active };
},
reorderAction(actionId: number, beforeActionId: number): ReorderAction {
reorderAction(
this: void,
actionId: number,
beforeActionId: number,
): ReorderAction {
return { type: ActionTypes.REORDER_ACTION, actionId, beforeActionId };
},
jumpToState(index: number): JumpToStateAction {
jumpToState(this: void, index: number): JumpToStateAction {
return { type: ActionTypes.JUMP_TO_STATE, index };
},
jumpToAction(actionId: number): JumpToActionAction {
jumpToAction(this: void, actionId: number): JumpToActionAction {
return { type: ActionTypes.JUMP_TO_ACTION, actionId };
},
importState<S, A extends Action<string>, MonitorState = null>(
this: void,
nextLiftedState: LiftedState<S, A, MonitorState> | readonly A[],
noRecompute?: boolean,
): ImportStateAction<S, A, MonitorState> {
return { type: ActionTypes.IMPORT_STATE, nextLiftedState, noRecompute };
},
lockChanges(status: boolean): LockChangesAction {
lockChanges(this: void, status: boolean): LockChangesAction {
return { type: ActionTypes.LOCK_CHANGES, status };
},
pauseRecording(status: boolean): PauseRecordingAction {
pauseRecording(this: void, status: boolean): PauseRecordingAction {
return { type: ActionTypes.PAUSE_RECORDING, status };
},
};

View File

@ -17,7 +17,6 @@ import reducer, { LogMonitorState } from './reducers';
import LogMonitorButtonBar from './LogMonitorButtonBar';
import LogMonitorEntryList from './LogMonitorEntryList';
// eslint-disable-next-line @typescript-eslint/unbound-method
const { toggleAction, setActionsActive } = ActionCreators;
const styles: {

View File

@ -6,7 +6,6 @@ import LogMonitorButton from './LogMonitorButton';
import { LogMonitorAction } from './actions';
import { LogMonitorState } from './reducers';
// eslint-disable-next-line @typescript-eslint/unbound-method
const { reset, rollback, commit, sweep } = ActionCreators;
const style: CSSProperties = {

View File

@ -73,10 +73,10 @@ export type TodoAction =
| ClearMarkedAction;
export interface TodoActions {
addTodo(text: string): AddTodoAction;
deleteTodo(id: number): DeleteTodoAction;
editTodo(id: number, text: string): EditTodoAction;
markTodo(id: number): MarkTodoAction;
markAll(): MarkAllAction;
clearMarked(): ClearMarkedAction;
addTodo(this: void, text: string): AddTodoAction;
deleteTodo(this: void, id: number): DeleteTodoAction;
editTodo(this: void, id: number, text: string): EditTodoAction;
markTodo(this: void, id: number): MarkTodoAction;
markAll(this: void): MarkAllAction;
clearMarked(this: void): ClearMarkedAction;
}

View File

@ -70,7 +70,6 @@ export default class MainSection extends Component<Props, State> {
className="toggle-all"
type="checkbox"
checked={markedCount === todos.length}
// eslint-disable-next-line @typescript-eslint/unbound-method
onChange={actions.markAll}
/>
);

View File

@ -18,7 +18,6 @@ interface Props {
const TodoApp: FunctionComponent<Props> = ({ todos, actions }) => (
<div>
{/* eslint-disable-next-line @typescript-eslint/unbound-method */}
<Header addTodo={actions.addTodo} />
<MainSection todos={todos} actions={actions} />
</div>

View File

@ -18,7 +18,6 @@ import {
import reducer from './reducers';
import SliderButton from './SliderButton';
// eslint-disable-next-line @typescript-eslint/unbound-method
const { reset, jumpToAction } = ActionCreators;
interface ExternalProps<S, A extends Action<string>> {

View File

@ -73,10 +73,10 @@ export type TodoAction =
| ClearMarkedAction;
export interface TodoActions {
addTodo(text: string): AddTodoAction;
deleteTodo(id: number): DeleteTodoAction;
editTodo(id: number, text: string): EditTodoAction;
markTodo(id: number): MarkTodoAction;
markAll(): MarkAllAction;
clearMarked(): ClearMarkedAction;
addTodo(this: void, text: string): AddTodoAction;
deleteTodo(this: void, id: number): DeleteTodoAction;
editTodo(this: void, id: number, text: string): EditTodoAction;
markTodo(this: void, id: number): MarkTodoAction;
markAll(this: void): MarkAllAction;
clearMarked(this: void): ClearMarkedAction;
}

View File

@ -77,7 +77,6 @@ export default class MainSection extends Component<Props, State> {
className="toggle-all"
type="checkbox"
checked={markedCount === todos.length}
// eslint-disable-next-line @typescript-eslint/unbound-method
onChange={actions.markAll}
/>
<label htmlFor={this.htmlFormInputId}>Mark all as complete</label>

View File

@ -22,7 +22,6 @@ class TodoApp extends Component<Props> {
return (
<div>
{/* eslint-disable-next-line @typescript-eslint/unbound-method */}
<Header addTodo={actions.addTodo} />
<MainSection todos={todos} actions={actions} />
</div>