Skip to content

Commit 4d6a554

Browse files
authored
fix!: upgrade eslint version to 9.12.0 (#1706)
* upgrade eslint version to 9.12.0 * fix new linter version errors * linter fix
1 parent ca19400 commit 4d6a554

10 files changed

Lines changed: 283 additions & 199 deletions

File tree

.eslintignore

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

.eslintrc.js

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

eslint.config.mjs

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
2+
import react from 'eslint-plugin-react'
3+
import typescriptEslint from '@typescript-eslint/eslint-plugin'
4+
import globals from 'globals'
5+
import tsParser from '@typescript-eslint/parser'
6+
import path from 'node:path'
7+
import { fileURLToPath } from 'node:url'
8+
import js from '@eslint/js'
9+
import { FlatCompat } from '@eslint/eslintrc'
10+
11+
const __filename = fileURLToPath(import.meta.url)
12+
const __dirname = path.dirname(__filename)
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
allConfig: js.configs.all
17+
})
18+
19+
export default [
20+
{
21+
ignores: [
22+
'**/.*',
23+
'**/*.js',
24+
'**/*.json',
25+
'**/node_modules',
26+
'**/dist',
27+
'**/coverage',
28+
'**/.DS_Store',
29+
'**/node_modules',
30+
'build',
31+
'dist',
32+
'.next',
33+
'**/.env',
34+
'**/.env.*',
35+
'**/generated',
36+
'**/pnpm-lock.yaml'
37+
]
38+
},
39+
...fixupConfigRules(
40+
compat.extends(
41+
'eslint:recommended',
42+
'plugin:react/recommended',
43+
'plugin:react-hooks/recommended',
44+
'plugin:@typescript-eslint/recommended',
45+
'prettier'
46+
)
47+
),
48+
{
49+
plugins: {
50+
'react': fixupPluginRules(react),
51+
'@typescript-eslint': fixupPluginRules(typescriptEslint)
52+
},
53+
54+
languageOptions: {
55+
globals: {
56+
...globals.browser,
57+
...globals.node
58+
},
59+
60+
parser: tsParser,
61+
ecmaVersion: 2020,
62+
sourceType: 'commonjs',
63+
64+
parserOptions: {
65+
ecmaFeatures: {
66+
jsx: true
67+
}
68+
}
69+
},
70+
71+
settings: {
72+
react: {
73+
version: 'detect'
74+
},
75+
76+
next: {
77+
rootDir: './packages/wallet/frontend/src'
78+
}
79+
},
80+
81+
rules: {
82+
'react/prop-types': 'off',
83+
'react/react-in-jsx-scope': 'off',
84+
85+
'@typescript-eslint/no-unused-vars': [
86+
'warn',
87+
{
88+
argsIgnorePattern: '^_',
89+
destructuredArrayIgnorePattern: '^_'
90+
}
91+
],
92+
'no-redeclare': ['error', { builtinGlobals: false }]
93+
}
94+
}
95+
]

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"clean:modules": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +",
1919
"dev": "pnpm localenv:start && concurrently -n 'WALLET,BOUTIQUE' -c blue.bold,red.bold 'pnpm wallet:frontend dev' 'pnpm boutique:frontend dev'",
2020
"format": "pnpm prettier:write && pnpm lint:fix",
21-
"lint:check": "eslint -c '.eslintrc.js' --max-warnings=0 .",
22-
"lint:fix": "eslint -c '.eslintrc.js' --max-warnings=0 --fix .",
21+
"lint:check": "eslint --max-warnings=0 .",
22+
"lint:fix": "eslint --max-warnings=0 --fix .",
2323
"compose": "docker compose -f ./docker/dev/docker-compose.yml",
2424
"compose:prod": "docker compose -f ./docker/prod/docker-compose.yml",
2525
"localenv:start": "pnpm compose up -d --build",
@@ -33,13 +33,17 @@
3333
"wallet:frontend": "pnpm --filter @wallet/frontend --"
3434
},
3535
"devDependencies": {
36+
"@eslint/compat": "^1.2.0",
37+
"@eslint/eslintrc": "^3.1.0",
38+
"@eslint/js": "^9.12.0",
3639
"@typescript-eslint/eslint-plugin": "^7.18.0",
3740
"@typescript-eslint/parser": "^7.18.0",
3841
"concurrently": "^9.0.1",
39-
"eslint": "^8.57.1",
42+
"eslint": "^9.12.0",
4043
"eslint-config-prettier": "^9.1.0",
4144
"eslint-plugin-react": "^7.37.1",
4245
"eslint-plugin-react-hooks": "^4.6.2",
46+
"globals": "^15.10.0",
4347
"only-allow": "^1.2.1",
4448
"prettier": "^3.3.3",
4549
"prettier-plugin-tailwindcss": "^0.6.8",

packages/boutique/frontend/src/hooks/use-custom-mutation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
} from '@tanstack/react-query'
88
import { z } from 'zod'
99

10-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1110
interface FetcherOptions {
1211
endpoint: string
1312
method?: string

packages/boutique/frontend/src/lib/fetcher.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ export async function fetcher<JSON = any>(
3333
const json = await response.json()
3434
if (!response.ok) {
3535
const error = json as ErrorResponse
36-
throw new APIError(
37-
error.message,
38-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
39-
error.errors as unknown as Errors
40-
)
36+
throw new APIError(error.message, error.errors as unknown as Errors)
4137
}
4238

4339
return json

packages/wallet/frontend/src/components/layouts/AuthLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const IMAGES = {
1313
PeopleDark: 'people-dark.webp'
1414
} as const
1515

16-
type Image = keyof typeof IMAGES
16+
type ImageKey = keyof typeof IMAGES
1717

1818
type AuthLayoutProps = {
1919
image: string
@@ -23,7 +23,7 @@ type AuthLayoutProps = {
2323
const AuthLayout = ({ image, children }: AuthLayoutProps) => {
2424
const theme = useTheme()
2525
const imageName = theme.theme === 'dark' ? `${image}Dark` : `${image}Light`
26-
const imageSrc = `/${IMAGES[imageName as Image]}`
26+
const imageSrc = `/${IMAGES[imageName as ImageKey]}`
2727
return (
2828
<>
2929
<div className="flex min-h-full w-screen">
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createContext } from 'react'
22
import { DialogDispatch, DialogState } from '../types/dialog'
33

4-
type DialogContext = {
4+
type DialogContextType = {
55
state: DialogState
66
dispatch: DialogDispatch
77
}
@@ -11,7 +11,7 @@ export const dialogInitialState = {
1111
dialog: null
1212
} satisfies DialogState
1313

14-
export const DialogContext = createContext<DialogContext>({
14+
export const DialogContext = createContext<DialogContextType>({
1515
state: dialogInitialState,
1616
dispatch: () => void 0
1717
})

packages/wallet/frontend/src/pages/transactions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ const TransactionsPage: NextPageWithLayout<TransactionsPageProps> = ({
323323
{trx.type === 'INCOMING' ? '+' : '-'}
324324
{
325325
formatAmount({
326-
value: String(trx.value) ?? 0,
326+
value: String(trx.value) || '0',
327327
assetCode: trx.assetCode,
328328
assetScale: trx.assetScale
329329
}).amount

0 commit comments

Comments
 (0)