Skip to content

Commit 110e2b9

Browse files
authored
update eslint to v9 (and fix all eslint errors) (#2923)
1 parent a79a534 commit 110e2b9

33 files changed

Lines changed: 551 additions & 466 deletions

docs/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@
3838
"@docusaurus/module-type-aliases": "3.9.2",
3939
"@docusaurus/tsconfig": "3.9.2",
4040
"@docusaurus/types": "3.9.2",
41-
"@eslint/js": "^8.57.0",
41+
"@eslint/js": "^9.39",
4242
"@mdx-js/typescript-plugin": "^0.1.3",
43-
"@types/eslint": "^9.6.1",
44-
"@types/eslint-config-prettier": "^6.11.3",
4543
"@types/react": "^18.3.0",
4644
"@types/react-dom": "^18.3.0",
47-
"eslint": "^8.57.0",
45+
"eslint": "^9.39",
4846
"eslint-config-prettier": "^10.1.8",
4947
"eslint-plugin-mdx": "^3.6.2",
5048
"prettier": "^3.8.1",
@@ -56,7 +54,7 @@
5654
"remark-preset-lint-consistent": "^6.0.1",
5755
"remark-preset-lint-recommended": "^7.0.1",
5856
"typescript": "^5.9.3",
59-
"typescript-eslint": "^8.54.0"
57+
"typescript-eslint": "^8.56"
6058
},
6159
"resolutions": {
6260
"path-to-regexp@npm:2.2.1": "^3",

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 }) => {

emain/emain-menu.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async function getWorkspaceMenu(ww?: WaveBrowserWindow): Promise<Electron.MenuIt
5858
return unamePlatform == "darwin" ? `Command+Control+${i + 1}` : `Alt+Control+${i + 1}`;
5959
}
6060
}
61-
workspaceList?.length &&
61+
if (workspaceList?.length) {
6262
workspaceMenu.push(
6363
{ type: "separator" },
6464
...workspaceList.map<Electron.MenuItemConstructorOptions>((workspace, i) => {
@@ -71,6 +71,7 @@ async function getWorkspaceMenu(ww?: WaveBrowserWindow): Promise<Electron.MenuIt
7171
};
7272
})
7373
);
74+
}
7475
return workspaceMenu;
7576
}
7677

emain/emain-wavesrv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function runWaveSrv(handleWSEvent: (evtMsg: WSEventType) => void): Promis
107107
});
108108
rlStderr.on("line", (line) => {
109109
if (line.includes("WAVESRV-ESTART")) {
110-
const startParams = /ws:([a-z0-9.:]+) web:([a-z0-9.:]+) version:([a-z0-9.\-]+) buildtime:(\d+)/gm.exec(
110+
const startParams = /ws:([a-z0-9.:]+) web:([a-z0-9.:]+) version:([a-z0-9.-]+) buildtime:(\d+)/gm.exec(
111111
line
112112
);
113113
if (startParams == null) {

emain/emain-window.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export class WaveBrowserWindow extends BaseWindow {
228228
this.finalizePositioning();
229229
}, 1000);
230230
this.on(
231-
// @ts-expect-error
231+
// @ts-expect-error -- "resize" event with debounce handler not in Electron type definitions
232232
"resize",
233233
debounce(400, (e) => this.mainResizeHandler(e))
234234
);
@@ -239,7 +239,7 @@ export class WaveBrowserWindow extends BaseWindow {
239239
this.activeTabView?.positionTabOnScreen(this.getContentBounds());
240240
});
241241
this.on(
242-
// @ts-expect-error
242+
// @ts-expect-error -- "move" event with debounce handler not in Electron type definitions
243243
"move",
244244
debounce(400, (e) => this.mainResizeHandler(e))
245245
);
@@ -271,7 +271,6 @@ export class WaveBrowserWindow extends BaseWindow {
271271
if (getGlobalIsRelaunching()) {
272272
return;
273273
}
274-
focusedWaveWindow = this;
275274
console.log("focus win", this.waveWindowId);
276275
fireAndForget(() => ClientService.FocusWindow(this.waveWindowId));
277276
setWasInFg(true);
@@ -547,7 +546,7 @@ export class WaveBrowserWindow extends BaseWindow {
547546
await WorkspaceService.SetActiveTab(this.workspaceId, tabId);
548547
}
549548
break;
550-
case "closetab":
549+
case "closetab": {
551550
tabId = entry.tabId;
552551
const rtn = await WorkspaceService.CloseTab(this.workspaceId, tabId, true);
553552
if (rtn == null) {
@@ -569,7 +568,8 @@ export class WaveBrowserWindow extends BaseWindow {
569568
}
570569
tabId = rtn.newactivetabid;
571570
break;
572-
case "switchworkspace":
571+
}
572+
case "switchworkspace": {
573573
const newWs = await WindowService.SwitchWorkspace(this.waveWindowId, entry.workspaceId);
574574
if (!newWs) {
575575
return;
@@ -581,6 +581,7 @@ export class WaveBrowserWindow extends BaseWindow {
581581
this.allLoadedTabViews = new Map();
582582
tabId = newWs.activetabid;
583583
break;
584+
}
584585
}
585586
if (tabId == null) {
586587
return;

emain/preload-webview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2025, Command Line Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
const { ipcRenderer } = require("electron");
4+
import { ipcRenderer } from "electron";
55

66
document.addEventListener("contextmenu", (event) => {
77
console.log("contextmenu event", event);

eslint.config.js

Lines changed: 80 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,89 @@
22

33
import eslint from "@eslint/js";
44
import eslintConfigPrettier from "eslint-config-prettier";
5+
import globals from "globals";
6+
import path from "node:path";
7+
import { fileURLToPath } from "node:url";
58
import tseslint from "typescript-eslint";
69

7-
const baseConfig = tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended);
10+
const tsconfigRootDir = path.dirname(fileURLToPath(new URL(import.meta.url)));
811

9-
const customConfig = {
10-
...baseConfig,
11-
overrides: [
12-
{
13-
files: ["emain/emain.ts", "electron.vite.config.ts"],
14-
env: {
15-
node: true,
12+
export default [
13+
{
14+
languageOptions: {
15+
parserOptions: {
16+
tsconfigRootDir,
1617
},
1718
},
18-
],
19-
};
19+
},
2020

21-
export default [customConfig, eslintConfigPrettier];
21+
{
22+
ignores: [
23+
"**/node_modules/**",
24+
"**/dist/**",
25+
"**/build/**",
26+
"**/make/**",
27+
"tsunami/frontend/scaffold/**",
28+
"docs/.docusaurus/**",
29+
],
30+
},
31+
32+
{
33+
files: ["frontend/**/*.{ts,tsx}", "emain/**/*.{ts,tsx}"],
34+
languageOptions: {
35+
parserOptions: {
36+
tsconfigRootDir,
37+
project: "./tsconfig.json",
38+
},
39+
},
40+
},
41+
42+
{
43+
files: ["docs/**/*.{ts,tsx}"],
44+
languageOptions: {
45+
parserOptions: { tsconfigRootDir, project: "./docs/tsconfig.json" },
46+
},
47+
},
48+
49+
eslint.configs.recommended,
50+
...tseslint.configs.recommended,
51+
52+
{
53+
rules: {
54+
"@typescript-eslint/no-explicit-any": "off",
55+
},
56+
},
57+
58+
{
59+
files: ["emain/**/*.ts", "electron.vite.config.ts", "**/*.cjs", "eslint.config.js", "docs/babel.config.js"],
60+
languageOptions: {
61+
globals: {
62+
...globals.node,
63+
},
64+
},
65+
},
66+
67+
{
68+
files: ["**/*.js", "**/*.cjs"],
69+
rules: {
70+
"@typescript-eslint/no-require-imports": "off",
71+
},
72+
},
73+
74+
{
75+
rules: {
76+
"@typescript-eslint/no-unused-vars": "warn",
77+
"prefer-const": "warn",
78+
"no-empty": "warn",
79+
},
80+
},
81+
82+
{
83+
files: ["frontend/app/store/services.ts"],
84+
rules: {
85+
"prefer-rest-params": "off",
86+
},
87+
},
88+
89+
eslintConfigPrettier,
90+
];

frontend/app/aipanel/airatelimitstrip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const GetMoreButton = memo(({ variant, showClose = true }: { variant: "yellow" |
1919
? "hover:has-[.close:hover]:bg-red-900/30"
2020
: "";
2121

22-
if (true) {
22+
if (true as boolean) {
2323
// disable now until we have modal
2424
return null;
2525
}

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 : (

0 commit comments

Comments
 (0)