Skip to content

Commit 58ac083

Browse files
authored
chore: migrate to eslint v10 (#2091)
* chore: migrate to eslint v10 * fix: linting issues
1 parent 468666a commit 58ac083

File tree

12 files changed

+290
-305
lines changed

12 files changed

+290
-305
lines changed

frontend/eslint.config.mjs

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
1-
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2-
import { FlatCompat } from "@eslint/eslintrc";
3-
import js from "@eslint/js";
4-
import typescriptEslint from "@typescript-eslint/eslint-plugin";
1+
import eslint from "@eslint/js";
52
import tsParser from "@typescript-eslint/parser";
3+
import eslintConfigPrettier from "eslint-config-prettier/flat";
4+
import reactHooks from "eslint-plugin-react-hooks";
65
import reactRefresh from "eslint-plugin-react-refresh";
76
import globals from "globals";
8-
import path from "node:path";
9-
import { fileURLToPath } from "node:url";
10-
const __filename = fileURLToPath(import.meta.url);
11-
const __dirname = path.dirname(__filename);
12-
13-
const compat = new FlatCompat({
14-
baseDirectory: __dirname,
15-
recommendedConfig: js.configs.recommended,
16-
allConfig: js.configs.all,
17-
});
7+
import tseslint from "typescript-eslint";
188

199
export default [
2010
{
@@ -25,20 +15,12 @@ export default [
2515
"src/components/ui/navigation-menu.tsx",
2616
],
2717
},
28-
...fixupConfigRules(
29-
compat.extends(
30-
"eslint:recommended",
31-
"plugin:@typescript-eslint/recommended",
32-
"plugin:react-hooks/recommended",
33-
"prettier"
34-
)
35-
),
18+
eslint.configs.recommended,
19+
...tseslint.configs.recommended,
20+
reactRefresh.configs.vite,
21+
reactHooks.configs.flat["recommended-latest"],
22+
eslintConfigPrettier,
3623
{
37-
plugins: {
38-
"react-refresh": reactRefresh,
39-
"@typescript-eslint": fixupPluginRules(typescriptEslint),
40-
},
41-
4224
languageOptions: {
4325
globals: {
4426
...globals.browser,
@@ -48,20 +30,6 @@ export default [
4830
},
4931
files: ["**/*.ts", "**/*.tsx"],
5032
rules: {
51-
"react-refresh/only-export-components": [
52-
"warn",
53-
{
54-
allowConstantExport: true,
55-
},
56-
],
57-
58-
"@typescript-eslint/ban-ts-comment": [
59-
"error",
60-
{
61-
"ts-ignore": "allow-with-description",
62-
},
63-
],
64-
6533
"@typescript-eslint/no-unused-vars": [
6634
"warn",
6735
{

frontend/package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@
6666
"devDependencies": {
6767
"@commitlint/cli": "^19.3.0",
6868
"@commitlint/config-conventional": "^20.0.0",
69-
"@eslint/compat": "^1.0.3",
70-
"@eslint/eslintrc": "^3.1.0",
71-
"@eslint/js": "^9.4.0",
69+
"@eslint/eslintrc": "^3.3.4",
70+
"@eslint/js": "^10.0.1",
7271
"@tailwindcss/aspect-ratio": "^0.4.2",
7372
"@tailwindcss/forms": "^0.5.7",
7473
"@tailwindcss/typography": "^0.5.19",
@@ -77,20 +76,19 @@
7776
"@types/react": "^18.2.15",
7877
"@types/react-dom": "^18.2.7",
7978
"@types/react-lottie": "^1.2.10",
80-
"@typescript-eslint/eslint-plugin": "^7.11.0",
81-
"@typescript-eslint/parser": "^7.11.0",
8279
"@vitejs/plugin-react-swc": "^3.3.2",
83-
"eslint": "^9.4.0",
80+
"eslint": "^10.0.2",
8481
"eslint-config-prettier": "^10.1.8",
8582
"eslint-plugin-react-hooks": "^7.0.1",
86-
"eslint-plugin-react-refresh": "^0.4.3",
83+
"eslint-plugin-react-refresh": "^0.5.2",
8784
"globals": "^15.4.0",
8885
"husky": "^9.0.11",
8986
"lint-staged": "^15.2.5",
9087
"prettier": "3.6.2",
9188
"shx": "^0.4.0",
9289
"tailwindcss": "^4.1.16",
9390
"typescript": "^5.9.3",
91+
"typescript-eslint": "^8.56.1",
9492
"vite": "^5.4.0",
9593
"vite-plugin-pwa": "^1.2.0",
9694
"vite-tsconfig-paths": "^6.1.1"

frontend/src/components/ExecuteCustomNodeCommandDialogContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function ExecuteCustomNodeCommandDialogContent({
3232
null,
3333
2
3434
);
35-
} catch (error) {
35+
} catch {
3636
// ignore unexpected json
3737
}
3838

frontend/src/components/home/widgets/AppOfTheDayWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { LinkButton } from "src/components/ui/custom/link-button";
1212

1313
export function AppOfTheDayWidget() {
1414
function seededRandom(seed: number) {
15-
const x = Math.sin(seed++) * 10000;
15+
const x = Math.sin(seed) * 10000;
1616
return x - Math.floor(x);
1717
}
1818

frontend/src/components/layouts/SettingsLayout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default function SettingsLayout() {
134134
);
135135
}
136136

137-
const MenuItem = ({
137+
export const MenuItem = ({
138138
to,
139139
children,
140140
}: {
@@ -159,5 +159,3 @@ const MenuItem = ({
159159
</NavLink>
160160
</>
161161
);
162-
163-
MenuItem;

frontend/src/components/ui/theme-provider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createContext, useContext, useEffect, useState } from "react";
22

33
export type DarkMode = "system" | "light" | "dark";
4+
// eslint-disable-next-line react-refresh/only-export-components
45
export const Themes = [
56
"default",
67
"alby",
@@ -71,7 +72,7 @@ export function ThemeProvider({
7172

7273
classList.add(`theme-${theme}`);
7374

74-
let prefersDark = false;
75+
let prefersDark;
7576
if (darkMode == "system") {
7677
prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
7778
} else {

frontend/src/lib/clipboard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function copyToClipboard(content: string) {
2727
try {
2828
await copyPromise;
2929
toast.success("Copied to clipboard");
30-
} catch (e) {
30+
} catch {
3131
toast.error("Failed to copy to clipboard");
3232
}
3333
}

frontend/src/screens/channels/Channels.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default function Channels() {
134134
id: channel.id,
135135
message: "Unconfirmed for " + unconfirmedHours + " hours",
136136
});
137-
} catch (error) {
137+
} catch {
138138
_longUnconfirmedZeroConfChannels.push({
139139
id: channel.id,
140140
message: "Channel transaction not in the mempool yet",

frontend/src/screens/internal-apps/Bitrefill.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function Bitrefill() {
3434
const invoice = new Invoice({ pr: parsedData.paymentAddress });
3535
setInvoice(invoice);
3636
}
37-
} catch (e) {
37+
} catch {
3838
/* empty */
3939
}
4040
}

frontend/src/screens/settings/Backup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function Backup() {
6363

6464
setDecryptedMnemonic(result?.mnemonic ?? "");
6565
setIsDialogOpen(true);
66-
} catch (error) {
66+
} catch {
6767
toast.error("Incorrect password", {
6868
description: "Failed to decrypt recovery phrase.",
6969
});

0 commit comments

Comments
 (0)