Skip to content

Commit 37f44eb

Browse files
committed
Address ESLint @typescript-eslint/no-explicit-any
1 parent 1cc66db commit 37f44eb

File tree

15 files changed

+42
-36
lines changed

15 files changed

+42
-36
lines changed

ui/frontend/ConfigElement.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface EitherProps<T extends string> extends ConfigElementProps {
1111
aLabel?: string;
1212
bLabel?: string;
1313
value: T;
14-
onChange: (_: T) => any;
14+
onChange: (_: T) => void;
1515
}
1616

1717
export const Either =
@@ -39,7 +39,7 @@ export const Either =
3939
interface SelectProps<T extends string> extends ConfigElementProps {
4040
children: React.ReactNode;
4141
value: T;
42-
onChange: (_: T) => any;
42+
onChange: (_: T) => void;
4343
}
4444

4545
export const Select = <T extends string,>({ value, onChange, children, ...rest }: SelectProps<T>) => (

ui/frontend/Output.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface TabProps {
3131
kind: Focus;
3232
focus?: Focus;
3333
label: string;
34-
onClick: () => any;
34+
onClick: () => void;
3535
tabProps: object;
3636
}
3737

ui/frontend/Output/Execute.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Execute: React.FC = () => {
2424
};
2525

2626
interface WarningProps {
27-
addMainFunction: () => any;
27+
addMainFunction: () => void;
2828
}
2929

3030
const Warning: React.FC<WarningProps> = props => (

ui/frontend/Router.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
2-
import { UnknownAction } from '@reduxjs/toolkit';
2+
import { Reducer, UnknownAction } from '@reduxjs/toolkit';
33

44
import { createBrowserHistory as createHistory, Path, Location } from 'history';
5-
import { createRouter, PlainOrThunk } from './uss-router';
5+
import { createRouter, PlainOrThunk, RouterObject, StoreArg } from './uss-router';
66
import UssRouter from './uss-router/Router';
77

88
import qs from 'qs';
@@ -82,7 +82,7 @@ const locationToAction = (location: Location): PlainOrThunk<State, UnknownAction
8282
};
8383

8484
export default class Router extends React.Component<RouterProps> {
85-
private router: any;
85+
private router: RouterObject<UnknownAction>;
8686

8787
public constructor(props: RouterProps) {
8888
super(props);
@@ -104,6 +104,6 @@ export default class Router extends React.Component<RouterProps> {
104104

105105
interface RouterProps {
106106
children: React.ReactNode;
107-
store: any;
108-
reducer: any;
107+
store: StoreArg<State, UnknownAction>;
108+
reducer: Reducer<State>;
109109
}

ui/frontend/SelectOne.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface SelectOneProps<T> {
77
name: string;
88
currentValue: T;
99
thisValue: T;
10-
changeValue: (_: T) => any;
10+
changeValue: (_: T) => void;
1111
}
1212

1313
export default class SelectOne<T> extends React.PureComponent<SelectOneProps<T>> {

ui/frontend/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ export function jsonGet(url: FetchArg): Promise<unknown> {
2323
});
2424
}
2525

26-
export function jsonPost(url: FetchArg, body: Record<string, any>): Promise<unknown> {
26+
type ToJson = Parameters<typeof JSON.stringify>[0];
27+
28+
export function jsonPost(url: FetchArg, body: ToJson): Promise<unknown> {
2729
return fetchJson(url, {
2830
method: 'post',
2931
body: JSON.stringify(body),

ui/frontend/editor/AceEditorCore.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const buildCrateAutocompleter = (autocompleteOnUse: boolean, crates: Crate[]): A
6464
},
6565
});
6666

67-
function useRafDebouncedFunction<A extends any[]>(fn: (...args: A) => void, onCall?: (...args: A) => void) {
67+
function useRafDebouncedFunction<A extends unknown[]>(fn: (...args: A) => void, onCall?: (...args: A) => void) {
6868
const timeout = useRef<number>();
6969

7070
return useCallback((...args: A): void => {
@@ -82,9 +82,9 @@ function useRafDebouncedFunction<A extends any[]>(fn: (...args: A) => void, onCa
8282
interface AceEditorProps {
8383
autocompleteOnUse: boolean;
8484
code: string;
85-
execute: () => any;
85+
execute: () => void;
8686
keybinding: string;
87-
onEditCode: (_: string) => any;
87+
onEditCode: (_: string) => void;
8888
position: Position;
8989
selection: Selection;
9090
theme: string;

ui/frontend/eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default tseslint.config(
3434
},
3535
],
3636

37-
'@typescript-eslint/no-explicit-any': 'off',
3837
'@typescript-eslint/no-unused-vars': [
3938
'error',
4039
{

ui/frontend/local_storage.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { deserialize } from './local_storage';
22

3+
type ToJson = Parameters<typeof JSON.stringify>[0];
4+
35
describe('restoring saved state', () => {
4-
const easyDeserialize = (state: any) => {
6+
const easyDeserialize = (state: string | ToJson) => {
57
if (typeof state === 'string' || state === undefined) {
68
return deserialize(state);
79
} else {

ui/frontend/local_storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface V2Configuration {
3232
processAssembly: ProcessAssembly;
3333
};
3434
code: string;
35-
notifications: any;
35+
notifications: object;
3636
}
3737

3838
interface V1Configuration {
@@ -48,7 +48,7 @@ interface V1Configuration {
4848
processAssembly: ProcessAssembly;
4949
};
5050
code: string;
51-
notifications: any;
51+
notifications: object;
5252
}
5353

5454
type CurrentConfiguration = V2Configuration;

0 commit comments

Comments
 (0)