Skip to content

Commit 5ae9626

Browse files
committed
fix more eslint errors
1 parent 767be19 commit 5ae9626

15 files changed

Lines changed: 71 additions & 71 deletions

File tree

docs/src/components/platformcontext.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@ interface PlatformContextProps {
1414
export const PlatformContext = createContext<PlatformContextProps | undefined>(undefined);
1515

1616
function getOS(): Platform {
17-
var platform = window.navigator.platform,
18-
macosPlatforms = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"],
19-
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"],
20-
iosPlatforms = ["iPhone", "iPad", "iPod"],
21-
os: Platform = null;
22-
23-
if (macosPlatforms.indexOf(platform) !== -1 || iosPlatforms.indexOf(platform) !== -1) {
24-
os = "mac";
25-
} else if (windowsPlatforms.indexOf(platform) !== -1) {
26-
os = "windows";
17+
const platform = window.navigator.platform;
18+
const macosPlatforms = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"];
19+
const windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"];
20+
const iosPlatforms = ["iPhone", "iPad", "iPod"];
21+
22+
if (macosPlatforms.includes(platform) || iosPlatforms.includes(platform)) {
23+
return "mac";
24+
} else if (windowsPlatforms.includes(platform)) {
25+
return "windows";
2726
} else {
28-
os = "linux";
27+
return "linux";
2928
}
30-
31-
return os;
3229
}
3330

3431
const PlatformProviderInternal = ({ children }: { children: ReactNode }) => {

eslint.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ import tseslint from "typescript-eslint";
1010
const tsconfigRootDir = path.dirname(fileURLToPath(new URL(import.meta.url)));
1111

1212
export default [
13+
{
14+
languageOptions: {
15+
parserOptions: {
16+
tsconfigRootDir,
17+
},
18+
},
19+
},
20+
1321
{
1422
ignores: [
1523
"**/node_modules/**",
@@ -48,7 +56,7 @@ export default [
4856
},
4957

5058
{
51-
files: ["emain/emain.ts", "electron.vite.config.ts", "**/*.cjs", "eslint.config.js"],
59+
files: ["emain/emain.ts", "electron.vite.config.ts", "**/*.cjs", "eslint.config.js", "docs/babel.config.js"],
5260
languageOptions: {
5361
globals: {
5462
...globals.node,
@@ -67,6 +75,7 @@ export default [
6775
rules: {
6876
"@typescript-eslint/no-unused-vars": "warn",
6977
"prefer-const": "warn",
78+
"no-empty": "warn",
7079
},
7180
},
7281

frontend/app/aipanel/aitypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ type WaveUIDataTypes = {
3232
};
3333
};
3434

35-
export type WaveUIMessage = UIMessage<unknown, WaveUIDataTypes, {}>;
36-
export type WaveUIMessagePart = UIMessagePart<WaveUIDataTypes, {}>;
35+
export type WaveUIMessage = UIMessage<unknown, WaveUIDataTypes, any>;
36+
export type WaveUIMessagePart = UIMessagePart<WaveUIDataTypes, any>;
3737

3838
export type UseChatSetMessagesType = (
3939
messages: WaveUIMessage[] | ((messages: WaveUIMessage[]) => WaveUIMessage[])

frontend/app/block/blockframe.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,7 @@ const BlockFrame_Default_Component = (props: BlockFrameProps) => {
172172
"--magnified-block-blur": `${magnifiedBlockBlur}px`,
173173
} as React.CSSProperties
174174
}
175-
// @ts-ignore: inert does exist in the DOM, just not in react
176-
inert={preview ? "1" : undefined} //
175+
inert={preview || undefined}
177176
>
178177
<BlockMask nodeModel={nodeModel} />
179178
{preview || viewModel == null || !manageConnection ? null : (

frontend/app/element/ansiline.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ const stateToClasses = (state: InternalStateType) => {
113113
return classes.join(" ");
114114
};
115115

116+
// eslint-disable-next-line no-control-regex
116117
const ansiRegex = /\x1b\[([0-9;]+)m/g;
117118

118119
const AnsiLine = ({ line }) => {

frontend/app/element/input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ const Input = memo(
112112
setInternalValue(inputValue);
113113
}
114114

115-
onChange && onChange(inputValue);
115+
onChange?.(inputValue);
116116
};
117117

118118
const handleFocus = () => {

frontend/app/modals/about.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,18 @@ const AboutModalV = ({ versionString, updaterChannel, onClose }: AboutModalVProp
7171

7272
AboutModalV.displayName = "AboutModalV";
7373

74-
interface AboutModalProps {}
75-
76-
const AboutModal = ({}: AboutModalProps) => {
74+
const AboutModal = () => {
7775
const [details] = useState(() => getApi().getAboutModalDetails());
7876
const [updaterChannel] = useState(() => getApi().getUpdaterChannel());
7977
const versionString = `${details.version} (${isDev() ? "dev-" : ""}${details.buildTime})`;
8078

81-
return <AboutModalV versionString={versionString} updaterChannel={updaterChannel} onClose={() => modalsModel.popModal()} />;
79+
return (
80+
<AboutModalV
81+
versionString={versionString}
82+
updaterChannel={updaterChannel}
83+
onClose={() => modalsModel.popModal()}
84+
/>
85+
);
8286
};
8387

8488
AboutModal.displayName = "AboutModal";

frontend/app/modals/typeaheadmodal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,15 @@ const TypeAheadModal = ({
201201
const renderBackdrop = (onClick) => <div className="type-ahead-modal-backdrop" onClick={onClick}></div>;
202202

203203
const handleKeyDown = (e) => {
204-
onKeyDown && onKeyDown(e);
204+
onKeyDown?.(e);
205205
};
206206

207207
const handleChange = (value) => {
208-
onChange && onChange(value);
208+
onChange?.(value);
209209
};
210210

211211
const handleSelect = (value) => {
212-
onSelect && onSelect(value);
212+
onSelect?.(value);
213213
};
214214

215215
const renderModal = () => (

frontend/app/view/helpview/helpview.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class HelpViewModel extends WebViewModel {
2020
super(blockId, nodeModel, tabModel);
2121
this.viewText = atom((get) => {
2222
// force a dependency on meta.url so we re-render the buttons when the url changes
23-
get(this.blockAtom)?.meta?.url || get(this.homepageUrl);
23+
void (get(this.blockAtom)?.meta?.url || get(this.homepageUrl));
2424
return [
2525
{
2626
elemtype: "iconbutton",
@@ -73,6 +73,7 @@ class HelpViewModel extends WebViewModel {
7373
if (globalStore.get(this.domReady)) {
7474
curZoom = this.webviewRef.current?.getZoomFactor() || 1;
7575
}
76+
// eslint-disable-next-line @typescript-eslint/no-this-alias
7677
const model = this; // for the closure to work (this is getting unset)
7778
function makeZoomFactorMenuItem(label: string, factor: number): ContextMenuItem {
7879
return {

frontend/app/view/sysinfo/sysinfo.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function defaultMemMeta(name: string, maxY: string): TimeSeriesMeta {
4848
};
4949
}
5050

51-
const PlotTypes: Object = {
51+
const PlotTypes: object = {
5252
CPU: function (dataItem: DataItem): Array<string> {
5353
return ["cpu"];
5454
},
@@ -547,20 +547,22 @@ const SysinfoViewInner = React.memo(({ model }: SysinfoViewProps) => {
547547
"grid-cols-2": cols2,
548548
})}
549549
>
550-
{plotData && plotData.length > 0 && yvals.map((yval, idx) => {
551-
return (
552-
<SingleLinePlot
553-
key={`plot-${model.blockId}-${yval}`}
554-
plotData={plotData}
555-
yval={yval}
556-
yvalMeta={plotMeta.get(yval)}
557-
blockId={model.blockId}
558-
defaultColor={"var(--accent-color)"}
559-
title={title}
560-
targetLen={targetLen}
561-
/>
562-
);
563-
})}
550+
{plotData &&
551+
plotData.length > 0 &&
552+
yvals.map((yval, idx) => {
553+
return (
554+
<SingleLinePlot
555+
key={`plot-${model.blockId}-${yval}`}
556+
plotData={plotData}
557+
yval={yval}
558+
yvalMeta={plotMeta.get(yval)}
559+
blockId={model.blockId}
560+
defaultColor={"var(--accent-color)"}
561+
title={title}
562+
targetLen={targetLen}
563+
/>
564+
);
565+
})}
564566
</div>
565567
</OverlayScrollbarsComponent>
566568
);

0 commit comments

Comments
 (0)