Skip to content

Commit

Permalink
chore: update deps (#11955)
Browse files Browse the repository at this point in the history
Co-authored-by: Jack-Works <[email protected]>
  • Loading branch information
Jack-Works and Jack-Works authored Nov 28, 2024
1 parent 59db8d6 commit c7ed132
Show file tree
Hide file tree
Showing 109 changed files with 4,197 additions and 5,368 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-node@v4
- run: npx prettier@3.3.2 --write .
- run: npx prettier@3.4.1 --write .
- uses: EndBug/add-and-commit@v9
with:
message: 'fix: prettier'
Expand Down
26 changes: 26 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ const deferPackages = [

const avoidMistakeRules = {
// Libraries
'@tanstack/query/exhaustive-deps': 'error', // avoid unstable results from the hook being deps
'@tanstack/query/stable-query-client': 'error',
'@tanstack/query/infinite-query-property-order': 'warn', // help TypeScript to infer type correctly
'@tanstack/query/no-rest-destructuring': 'error',
'@tanstack/query/no-unstable-deps': 'error', // avoid unstable results from the hook being deps
'@lingui/no-single-tag-to-translate': 'error',
// '@lingui/no-single-variables-to-translate': 'error', // we're mixing two i18n frameworks, a lot of false positive reports
// https://github.com/lingui/eslint-plugin/issues/46
Expand Down Expand Up @@ -100,6 +103,7 @@ const avoidMistakeRules = {
// '@typescript-eslint/no-invalid-void-type': 'warn', // Disallow void type outside of generic or return types
'@typescript-eslint/no-misused-new': 'error', // wrong 'new ()' or 'constructor()' signatures
'@typescript-eslint/no-unsafe-function-type': 'error',
// '@typescript-eslint/no-unsafe-type-assertion': 'error', // bans `expr as T`
'@typescript-eslint/no-wrapper-object-types': 'error',
/// Unicode support
'no-misleading-character-class': 'error', // RegEx
Expand Down Expand Up @@ -477,6 +481,11 @@ const moduleSystemRules = {
from: './packages/mask/shared-ui/',
message: 'Background cannot import Ui specific code.',
},
{
target: './packages/mask/shared/**',
from: './packages/mask/shared-ui/',
message: 'packages/mask/shared cannot import services. Move it to packages/mask/shared-ui instead.',
},
{
target: './packages/mask/!(background)/**',
from: './packages/mask/background/',
Expand Down Expand Up @@ -620,6 +629,23 @@ export default tseslint.config(
'unicorn/consistent-function-scoping': 'off',
},
},
{
files: ['packages/mask/shared/**/*.ts', 'packages/mask/shared/**/*.tsx'],
rules: {
'@typescript-eslint/no-restricted-imports': [
'error',
{
paths: [
{
name: '#services',
message:
'packages/mask/shared cannot import services. Move it to packages/mask/shared-ui instead.',
},
],
},
],
},
},
{
files: ['packages/**/*.ts', 'packages/**/*.tsx'],
ignores: [
Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"lint:ci-report": "pnpm run lint:ci --format=junit --output-file=reports/junit/eslint-results.xml --max-warnings=0",
"prepare": "husky",
"svgo": "svgo packages/icons/*/*.svg",
"test": "vitest --pool=forks",
"test": "vitest",
"spellcheck": "cspell lint --no-must-find-files",
"clean": "npx gulp clean",
"lingui:compile": "npx gulp lingui-compile",
Expand All @@ -36,8 +36,8 @@
"@emotion/react": "11.11.4",
"@emotion/serialize": "1.1.4",
"@emotion/styled": "11.11.5",
"@lingui/core": "^4.12.0",
"@lingui/react": "^4.12.0",
"@lingui/core": "^4.14.0",
"@lingui/react": "^4.14.0",
"@masknet/kit": "0.4.1",
"@mui/base": "5.0.0-beta.40",
"@mui/icons-material": "5.15.21",
Expand All @@ -48,52 +48,52 @@
"@types/masknet__global-types": "workspace:^",
"@types/react": "npm:types-react@beta",
"@types/react-dom": "npm:types-react-dom@beta",
"@typescript/lib-dom": "npm:@types/web@^0.0.171",
"knip": "^5.23.2",
"@typescript/lib-dom": "npm:@types/web@^0.0.183",
"knip": "^5.38.1",
"lodash-es": "^4.17.21",
"react": "0.0.0-experimental-58af67a8f8-20240628",
"react-dom": "0.0.0-experimental-58af67a8f8-20240628",
"ses": "1.9.0",
"ts-results-es": "^4.2.0"
},
"devDependencies": {
"@changesets/cli": "^2.27.6",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@eslint-react/eslint-plugin": "^1.15.0",
"@eslint/compat": "^1.1.1",
"@lingui/cli": "^4.12.0",
"@lingui/macro": "^4.12.0",
"@lingui/swc-plugin": "^4.0.10",
"@changesets/cli": "^2.27.10",
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@eslint-react/eslint-plugin": "^1.17.1",
"@eslint/compat": "^1.2.3",
"@lingui/cli": "^4.14.0",
"@lingui/macro": "^4.14.0",
"@lingui/swc-plugin": "^4.1.0",
"@masknet/cli": "workspace:^",
"@masknet/config": "workspace:^",
"@masknet/eslint-plugin": "^0.3.0",
"@nice-labs/git-rev": "^3.5.1",
"@swc-node/register": "^1.10.9",
"@swc/core": "1.7.35",
"@tanstack/eslint-plugin-query": "^5.59.7",
"@swc/core": "1.9.3",
"@tanstack/eslint-plugin-query": "^5.61.4",
"@types/lodash-es": "^4.17.12",
"@vitest/ui": "^1.6.0",
"cspell": "^8.9.1",
"eslint": "9.12.0",
"@vitest/ui": "^2.1.6",
"cspell": "^8.16.1",
"eslint": "9.15.0",
"eslint-formatter-junit": "^8.40.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-i": "^2.29.1",
"eslint-plugin-lingui": "^0.4.0",
"eslint-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
"eslint-plugin-lingui": "^0.8.1",
"eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-tss-unused-classes": "^1.0.3",
"eslint-plugin-unicorn": "^56.0.0",
"eslint-plugin-unused-imports": "^4.1.4",
"gulp": "^5.0.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"prettier": "^3.3.2",
"lint-staged": "^15.2.10",
"prettier": "^3.4.1",
"svgo": "^3.3.2",
"typescript": "5.7.0-beta",
"typescript-eslint": "^8.8.1",
"vite": "^5.3.2",
"vitest": "^1.6.0"
"typescript": "5.7.2",
"typescript-eslint": "^8.16.0",
"vite": "^5.1.8",
"vitest": "^2.1.6"
},
"pnpm": {
"overrides": {
Expand Down
4 changes: 2 additions & 2 deletions packages/gun-utils/src/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ function createGun() {
{},
)
}
private declare abort: () => void
private declare keepAlive: () => void
declare private abort: () => void
declare private keepAlive: () => void
declare timer: ReturnType<typeof setTimeout> | undefined
override send(data: any) {
this.keepAlive()
Expand Down
2 changes: 1 addition & 1 deletion packages/injected-script/main/Patches/EventTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function normalizeAddEventListenerArgs(
options?: boolean | AddEventListenerOptions | undefined,
): EventListenerDescriptor {
// https://dom.spec.whatwg.org/#event-flatten-more
const capture = $.Boolean(typeof options === 'boolean' ? options : options?.capture ?? false)
const capture = $.Boolean(typeof options === 'boolean' ? options : (options?.capture ?? false))
let once = false
let passive: boolean | null = null
let signal: AbortSignal | null = null
Expand Down
4 changes: 2 additions & 2 deletions packages/injected-script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"start": "rollup -c -w"
},
"devDependencies": {
"rollup": "^4.18.0",
"rollup-plugin-swc3": "^0.11.2"
"rollup": "^4.27.4",
"rollup-plugin-swc3": "^0.12.1"
}
}
6 changes: 3 additions & 3 deletions packages/mask-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
},
"devDependencies": {
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-node-resolve": "^15.3.0",
"async-call-rpc": "^6.4.2",
"rollup": "^4.18.0",
"rollup-plugin-swc3": "^0.11.2"
"rollup": "^4.27.4",
"rollup-plugin-swc3": "^0.12.1"
}
}
6 changes: 0 additions & 6 deletions packages/mask/.webpack/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,17 +350,11 @@ export async function createConfiguration(_inputFlags: BuildFlags): Promise<webp
),
},
output: {
environment: {
module: false,
dynamicImport: true,
},
path: flags.outputPath,
filename: 'entry/[name].js',
chunkFilename: productionLike ? 'bundled/[id].js' : 'bundled/chunk-[name].js',
assetModuleFilename: productionLike ? 'assets/[hash][ext][query]' : 'assets/[name]-[hash][ext][query]',
webassemblyModuleFilename: 'assets/[hash].wasm',
hotUpdateMainFilename: 'hot/[runtime].[fullhash].json',
hotUpdateChunkFilename: 'hot/[id].[fullhash].js',
devtoolModuleFilenameTemplate:
productionLike ?
'webpack://[namespace]/[resource-path]'
Expand Down
4 changes: 2 additions & 2 deletions packages/mask/.webpack/plugins/TrustedTypesPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TrustedTypesRuntimeModule extends RuntimeModule {
return Template.asString('/* TrustedTypesRuntimeModule skipped because compilation is undefined. */')
return Template.asString([
'if (typeof trustedTypes !== "undefined" && location.protocol.includes("extension") && !trustedTypes.defaultPolicy) {',
Template.indent([`trustedTypes.createPolicy('default', { createScriptURL: (string) => string });`]),
Template.indent(`trustedTypes.createPolicy('default', { createScriptURL: String });`),
'}',
])
}
Expand All @@ -21,7 +21,7 @@ export class TrustedTypesPlugin {
compiler.hooks.compilation.tap('TrustedTypes', (compilation) => {
compilation.hooks.afterChunks.tap('TrustedTypes', (chunks) => {
for (const c of chunks) {
if (!c.hasEntryModule()) continue
if (!compilation.chunkGraph.getNumberOfEntryModules(c)) continue
compilation.addRuntimeModule(c, new TrustedTypesRuntimeModule(), compilation.chunkGraph)
}
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { memo, useContext, useEffect, useState } from 'react'
import { attachNextIDToProfile } from '../../../../shared/index.js'
import { attachNextIDToProfile } from '../../../../shared-ui/index.js'
import { AdditionalContent } from '../AdditionalPostContent.js'
import { SelectProfileDialog } from '../SelectPeopleDialog.js'
import { makeStyles } from '@masknet/theme'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function Content(props: ProfileTabContentProps) {
useCollectionByTwitterHandle(profileTabType === ProfileTabs.WEB3 ? currentVisitingUserId : '') ?? EMPTY_LIST

const { data: spaces } = useSnapshotSpacesByTwitterHandle(
profileTabType === ProfileTabs.DAO ? currentVisitingUserId ?? '' : '',
profileTabType === ProfileTabs.DAO ? (currentVisitingUserId ?? '') : '',
)

const [currentTrendingIndex, setCurrentTrendingIndex] = useState(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
type PersonaIdentifier,
} from '@masknet/shared-base'
import { useValueRef, createContainer } from '@masknet/shared-base-ui'
import { useQuery } from '@tanstack/react-query'
import { skipToken, useQuery } from '@tanstack/react-query'
import { useEffect, useMemo, useState } from 'react'
import { activatedSiteAdaptorUI } from '../../../site-adaptor-infra/index.js'
import { useLastRecognizedIdentity } from '../../DataSource/useActivatedUI.js'
Expand All @@ -31,11 +31,9 @@ export function useSetupGuideStepInfo(persona?: PersonaIdentifier) {
refetch,
} = useQuery({
enabled: !!persona?.publicKeyAsHex,
// eslint-disable-next-line @tanstack/query/exhaustive-deps
queryKey: ['query-persona-info', persona?.publicKeyAsHex],
queryFn: async () => {
if (!persona?.publicKeyAsHex) return null
return Services.Identity.queryPersona(persona)
},
queryFn: persona ? async () => Services.Identity.queryPersona(persona) : skipToken,
})
useEffect(() => MaskMessages.events.ownPersonaChanged.on(() => refetch()), [])
const { data: currentTabId } = useQuery({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
Typography,
alpha,
} from '@mui/material'
import { attachNextIDToProfile } from '../../../../shared/index.js'
import { attachNextIDToProfile } from '../../../../shared-ui/index.js'
import { ProfileInList } from './ProfileInList.js'
import { Trans, msg } from '@lingui/macro'
import { useLingui } from '@lingui/react'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,21 @@ function getPostID(node: DOMProxy, root: HTMLElement): null | string {
const postTimeNode1 = root.closest('[role=article]')?.querySelector('[href*="permalink"]')
const postIdMode1 =
postTimeNode1 ?
postTimeNode1
(postTimeNode1
.getAttribute('href')
?.match(/story_fbid=(\d+)/g)?.[0]
.split('=')[1] ?? null
.split('=')[1] ?? null)
: null

if (postIdMode1) return postIdMode1

const postTimeNode2 = root.closest('[role=article]')?.querySelector('[href*="posts"]')
const postIdMode2 =
postTimeNode2 ?
postTimeNode2
(postTimeNode2
.getAttribute('href')
?.match(/posts\/(\w+)/g)?.[0]
.split('/')[1] ?? null
.split('/')[1] ?? null)
: null
if (postIdMode2 && /^-?\w+$/.test(postIdMode2)) return postIdMode2
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function parseNameArea(nameArea: HTMLAnchorElement) {

function postIdParser(node: HTMLElement) {
const idNode = node.querySelector<HTMLAnchorElement>('m-activity__permalink .m-activityPermalink__wrapper--link')
return idNode ? idNode.getAttribute('href')?.split('/')[2] ?? undefined : undefined
return idNode ? (idNode.getAttribute('href')?.split('/')[2] ?? undefined) : undefined
}

function postNameParser(node: HTMLElement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { injectPostReplacer } from '../../../site-adaptor-infra/defaults/inject/

function resolveLangNode(node: HTMLElement) {
return node.hasAttribute('lang') ? node : (
node.querySelector<HTMLDivElement>('[lang]') ?? node.parentElement?.querySelector<HTMLDivElement>('[lang]')
(node.querySelector<HTMLDivElement>('[lang]') ??
node.parentElement?.querySelector<HTMLDivElement>('[lang]'))
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export const Component = memo(function AddDeriveWallet() {
.flatMap((x) => x.data)
.filter((x) => typeof x === 'number') as number[]
return sortBy(uniq([...pathIndexes, ...existedSiblingsIndexes]))
// eslint-disable-next-line @tanstack/query/no-unstable-deps
}, [pathIndexes, existedSiblingQueries, isReset])

const [page, setPage] = useState(0)
Expand Down
1 change: 1 addition & 0 deletions packages/mask/entry-sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"include": ["./"],
"references": [
{ "path": "../utils-pure/tsconfig.json" },
{ "path": "../shared-ui/tsconfig.json" },
{ "path": "../../mask-sdk/server/tsconfig.json" },
{ "path": "../../web3-shared/evm/tsconfig.json" },
{ "path": "../../shared-base/tsconfig.json" },
Expand Down
14 changes: 7 additions & 7 deletions packages/mask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,23 @@
"urlcat": "^3.1.0",
"use-subscription": "^1.8.0",
"wallet.ts": "^1.0.1",
"web3-core-helpers": "1.10.3",
"web3-core-helpers": "1.10.2",
"web3-utils": "1.10.2",
"webextension-polyfill": "^0.12.0",
"zlib-browserify": "^0.0.3",
"zod": "^3.23.8"
},
"devDependencies": {
"@lavamoat/webpack": "0.3.0-beta.0",
"@lavamoat/webpack": "0.7.0-beta.0",
"@nice-labs/emit-file-webpack-plugin": "^1.1.4",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
"@types/color": "^3.0.6",
"@types/react-devtools-inline": "^4.24.8",
"@types/react-window": "^1.8.8",
"babel-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
"babel-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
"copy-webpack-plugin": "^12.0.2",
"devtools-ignore-webpack-plugin": "^0.1.2",
"html-webpack-plugin": "^5.6.0",
"devtools-ignore-webpack-plugin": "^0.2.0",
"html-webpack-plugin": "^5.6.3",
"react-compiler-webpack": "^0.1.2",
"react-devtools-inline": "5.3.0",
"react-refresh": "^0.14.2",
Expand All @@ -165,8 +165,8 @@
"terser-webpack-plugin": "^5.3.10",
"webpack": "Jack-Works/webpack#lazy-import",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"webpack-target-webextension": "^1.1.2"
"webpack-dev-server": "^5.1.0",
"webpack-target-webextension": "^2.0.0"
},
"peerDependencies": {
"tss-react": "^4.9.0"
Expand Down
Loading

0 comments on commit c7ed132

Please sign in to comment.