Skip to content

Commit 75cdc9a

Browse files
authored
Merge pull request #1125 from rust-lang/eslint-and-more
Upgrade JS dependencies: semver-compatible, ESlint, uuid
2 parents 97331e5 + 368ebc6 commit 75cdc9a

26 files changed

+1882
-1788
lines changed

ui/frontend/.eslintrc.js

Lines changed: 0 additions & 108 deletions
This file was deleted.

ui/frontend/.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ node_modules
1212
*.scss
1313

1414
# Slowly migrate files that we've touched
15-
!.eslintrc.js
1615
!BuildMenu.tsx
1716
!ButtonSet.tsx
1817
!Header.tsx
@@ -32,6 +31,7 @@ node_modules
3231
!editor/MonacoEditorCore.tsx
3332
!editor/SimpleEditor.tsx
3433
!editor/rust_monaco_def.ts
34+
!eslint.config.mjs
3535
!hooks.ts
3636
!observer.ts
3737
!prism-shim.ts

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/Icon.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React from 'react';
22

33
import * as styles from './Icon.module.css';
44

5-
/* eslint-disable max-len */
6-
75
// These icons came from Material Design originally
86
// https://material.io/tools/icons/?icon=assignment&style=outline
97

@@ -30,7 +28,6 @@ export const MoreOptionsIcon = () => (
3028

3129
export const MoreOptionsActiveIcon = () => (
3230
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg">
33-
{/* eslint-disable-next-line react/no-unknown-property */}
3431
<path fillRule="evenodd" fill="#428bca" d="M4,5 h16 a3,3 0 0,1 3,3 v8 a3,3 0 0,1 -3,3 h-16 a3,3 0 0,1 -3,-3 v-8 a3,3 0 0,1 3,-3 Z M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" />
3532
</svg>
3633
);

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/compileActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface Props {
3232
}
3333

3434
interface CompileActions {
35-
action: AsyncThunk<CompileResponseBody, CompileRequestBody, {}>;
35+
action: AsyncThunk<CompileResponseBody, CompileRequestBody, object>;
3636
performCompile: () => ThunkAction;
3737
}
3838

0 commit comments

Comments
 (0)