Skip to content

Commit 910f35f

Browse files
authored
chore: update eslint (#12226)
1 parent 7200ff6 commit 910f35f

File tree

92 files changed

+2450
-1382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2450
-1382
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@dimensiondev:registry=https://npm.pkg.github.com/

eslint.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const avoidMistakeRules = {
4141
'@tanstack/query/infinite-query-property-order': 'warn', // help TypeScript to infer type correctly
4242
'@tanstack/query/no-rest-destructuring': 'error',
4343
'@tanstack/query/no-unstable-deps': 'error', // avoid unstable results from the hook being deps
44+
'@tanstack/query/no-void-query-fn': 'error', // query function should always return something
4445
'@lingui/no-single-tag-to-translate': 'error',
4546
// '@lingui/no-single-variables-to-translate': 'error', // we're mixing two i18n frameworks, a lot of false positive reports
4647
// https://github.com/lingui/eslint-plugin/issues/46
@@ -220,7 +221,8 @@ const avoidMistakeRules = {
220221
'react/no-comment-textnodes': 'warn', // <div>// comment</div> will render text!
221222
// 'react/no-duplicate-key': 'warn', // <div key={1} /> <div key={1} /> this rule has bug?
222223
'react/no-leaked-conditional-rendering': 'error', // <div>{0 && <Something />}</div> will render "0"!
223-
'react/no-nested-components': 'error', // rerender bugs
224+
'react/no-nested-component-definitions': 'error', // rerender bugs
225+
'react/no-nested-lazy-component-declarations': 'error', // rerender bugs
224226
'react-hooks/rules-of-hooks': 'error', // react hooks
225227
'@typescript-eslint/no-base-to-string': 'error', // prevent buggy .toString() call
226228
'@typescript-eslint/no-loop-func': 'warn', // capture a loop variable might be a bug
@@ -373,20 +375,22 @@ const codeStyleRules = {
373375
'prefer-regex-literals': 'warn', // RegEx
374376
'spaced-comment': ['warn', 'always', { line: { markers: ['/'] } }],
375377
// 'unicorn/no-array-reduce': 'warn',
376-
// 'unicorn/no-array-push-push': 'warn',
377378
// 'unicorn/no-lonely-if': 'warn', // else if (a) { if (b) expr }
378379
// 'unicorn/no-negated-condition': 'warn', // if (!a) else
379380
// 'unicorn/no-nested-ternary': 'warn', // a ? b : c ? d : e
380381
// 'unicorn/no-typeof-undefined': 'warn', // typeof expr !== 'undefined'
381382
// 'unicorn/no-unreadable-array-destructuring': 'warn', // [,, foo] = parts
382383
'unicorn/no-unreadable-iife': 'warn', // (bar => (bar ? bar.baz : baz))(getBar())
384+
'unicorn/prefer-import-meta-properties': 'warn',
383385
// 'unicorn/prefer-negative-index': 'warn',
386+
'unicorn/prefer-single-call': 'warn',
384387
'unicorn/throw-new-error': 'warn',
385388
// 'unicorn/prefer-logical-operator-over-ternary': 'warn', // prefer ?? and ||
386389
// 'unicorn/prefer-optional-catch-binding': 'warn', // prefer to omit catch binding
387390
'react/prefer-shorthand-boolean': 'warn',
388391
'react/prefer-shorthand-fragment': 'warn',
389392
'@typescript-eslint/prefer-as-const': 'warn',
393+
// '@typescript-eslint/no-unnecessary-type-conversion': 'warn', // for code like str.toString()
390394

391395
// Consistency
392396
'no-irregular-whitespace': 'warn', // unusual but safe

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
"@changesets/cli": "^2.28.1",
6262
"@commitlint/cli": "^19.7.1",
6363
"@commitlint/config-conventional": "^19.7.1",
64-
"@eslint-react/eslint-plugin": "^1.30.2",
65-
"@eslint/compat": "^1.2.7",
64+
"@eslint-react/eslint-plugin": "^1.49.0",
65+
"@eslint/compat": "^1.2.9",
6666
"@lingui/cli": "^5.2.0",
6767
"@lingui/swc-plugin": "^5.4.0",
6868
"@masknet/cli": "workspace:^",
@@ -71,19 +71,19 @@
7171
"@masknet/typescript-plugin": "workspace:^",
7272
"@nice-labs/git-rev": "^3.5.1",
7373
"@swc/core": "1.11.7",
74-
"@tanstack/eslint-plugin-query": "^5.66.1",
74+
"@tanstack/eslint-plugin-query": "^5.74.7",
7575
"@types/lodash-es": "^4.17.12",
7676
"@vitest/ui": "^3.0.7",
7777
"cspell": "^8.17.5",
78-
"eslint": "9.21.0",
78+
"eslint": "9.26.0",
7979
"eslint-formatter-junit": "^8.40.0",
80-
"eslint-import-resolver-typescript": "^3.8.3",
80+
"eslint-import-resolver-typescript": "^4.3.4",
8181
"eslint-plugin-i": "^2.29.1",
82-
"eslint-plugin-lingui": "^0.10.0",
83-
"eslint-plugin-react-compiler": "19.0.0-beta-714736e-20250131",
82+
"eslint-plugin-lingui": "^0.10.1",
83+
"eslint-plugin-react-compiler": "19.1.0-rc.1",
8484
"eslint-plugin-react-hooks": "^5.2.0",
8585
"eslint-plugin-tss-unused-classes": "^1.0.3",
86-
"eslint-plugin-unicorn": "^57.0.0",
86+
"eslint-plugin-unicorn": "^59.0.1",
8787
"eslint-plugin-unused-imports": "^4.1.4",
8888
"gulp": "^5.0.0",
8989
"husky": "^9.1.7",
@@ -92,7 +92,7 @@
9292
"prettier": "^3.5.3",
9393
"svgo": "^3.3.2",
9494
"typescript": "5.8.2",
95-
"typescript-eslint": "^8.26.0",
95+
"typescript-eslint": "^8.32.1",
9696
"vite": "^6.2.0",
9797
"vitest": "^3.0.7"
9898
}

packages/backup-format/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dependencies": {
1515
"@masknet/shared-base": "workspace:^",
1616
"@msgpack/msgpack": "^3.0.0-beta2",
17-
"elliptic": "^6.6.1",
17+
"elliptic": "6.6.1",
1818
"pvtsutils": "^1.3.5"
1919
},
2020
"devDependencies": {

packages/gun-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"gun": "0.2020.1234"
2020
},
2121
"devDependencies": {
22-
"@swc/core": "1.9.3"
22+
"@swc/core": "1.11.7"
2323
}
2424
}

packages/mask/content-script/components/CompositionDialog/CompositionUI.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export function CompositionDialogUI({ ref, ...props }: CompositionProps) {
154154
const refItem = useMemo(
155155
(): CompositionRef => ({
156156
setMessage: (msg) => {
157+
// eslint-disable-next-line react-compiler/react-compiler
157158
if (Editor) Editor.value = msg
158159
},
159160
setEncryptionKind,

packages/mask/content-script/components/DataSource/useActivatedUI.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { IdentityResolved } from '@masknet/plugin-infra'
2-
import { MaskMessages, ValueRef, type ProfileInformation } from '@masknet/shared-base'
2+
import { MaskMessages, ValueRef, type NextIDPersonaBindings, type ProfileInformation } from '@masknet/shared-base'
33
import { useValueRef } from '@masknet/shared-base-ui'
44
import { NextIDProof } from '@masknet/web3-providers'
55
import { FontSize, ThemeColor, ThemeMode, type ThemeSettings } from '@masknet/web3-shared-base'
@@ -60,11 +60,16 @@ export function useCurrentVisitingIdentity() {
6060
)
6161
}
6262

63+
interface SocialIdentity extends IdentityResolved {
64+
publicKey?: string
65+
hasBinding?: boolean
66+
binding?: NextIDPersonaBindings
67+
}
6368
/**
6469
* Get the social identity of the given identity
6570
*/
6671
export function useSocialIdentity(identity: IdentityResolved | null | undefined) {
67-
const result = useQuery({
72+
const result = useQuery<SocialIdentity | null>({
6873
enabled: !!identity,
6974
queryKey: ['social-identity', identity],
7075
queryFn: async () => {
@@ -86,7 +91,7 @@ export function useSocialIdentity(identity: IdentityResolved | null | undefined)
8691
binding: first(personaBindings),
8792
}
8893
} catch {
89-
return identity
94+
return identity || null
9095
}
9196
},
9297
})
@@ -101,7 +106,7 @@ export function useSocialIdentityByUserId(userId?: string) {
101106
queryKey: ['social-identity', 'by-id', userId],
102107
enabled: !!userId,
103108
queryFn: async () => {
104-
return activatedSiteAdaptorUI!.utils.getUserIdentity?.(userId!)
109+
return (await activatedSiteAdaptorUI!.utils.getUserIdentity?.(userId!)) || null
105110
},
106111
networkMode: 'always',
107112
})

packages/mask/content-script/components/InjectedComponents/SetupGuide/SetupGuideContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function useSetupGuideStepInfo(persona?: PersonaIdentifier) {
3838
useEffect(() => MaskMessages.events.ownPersonaChanged.on(() => refetch()), [])
3939
const { data: currentTabId } = useQuery({
4040
queryKey: ['current-tab-id'],
41-
queryFn: async () => Services.Helper.getActiveTab().then((x) => x?.id),
41+
queryFn: async () => Services.Helper.getActiveTab().then((x) => x?.id || null),
4242
refetchOnWindowFocus: true,
4343
})
4444
const { networkIdentifier: site, configuration } = activatedSiteAdaptorUI!

packages/mask/content-script/site-adaptor-infra/utils/create-post-context.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ export function createSiteAdaptorSpecializedPostContext(site: EnhanceableSite, a
124124
hasMaskPayload.value = actions.hasPayloadLike(msg)
125125
}
126126
evaluate()
127-
cancel.push(linksSubscribe.subscribe(evaluate))
128-
cancel.push(opt.rawMessage.subscribe(evaluate))
127+
cancel.push(linksSubscribe.subscribe(evaluate), opt.rawMessage.subscribe(evaluate))
129128
return createSubscriptionFromValueRef(hasMaskPayload)
130129
})(),
131130
postIVIdentifier: createSubscriptionFromValueRef(postIVIdentifier),

packages/mask/content-script/site-adaptors/twitter.com/injection/ProfileCard/useControlProfileCard.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export function useControlProfileCard(holderRef: RefObject<HTMLDivElement | null
2121
const hasDialogRef = useRef(false)
2222
const { stack } = useDialogStacking()
2323
// TODO: is this the best we can have?
24-
// eslint-disable-next-line react-compiler/react-compiler
2524
hasDialogRef.current = stack.length > 0
2625

2726
const hideProfileCard = useCallback((byClick?: boolean) => {
@@ -44,7 +43,6 @@ export function useControlProfileCard(holderRef: RefObject<HTMLDivElement | null
4443
}, [])
4544

4645
// TODO: is this the best we can have?
47-
// eslint-disable-next-line react-compiler/react-compiler
4846
if (!holderRef.current) hideProfileCard()
4947

5048
useEffect(() => {

0 commit comments

Comments
 (0)