From de0181e0d9202bff924246658cc170ecb7dc56eb Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Fri, 13 Mar 2026 20:58:07 +0800 Subject: [PATCH] fix: lint --- .vscode/settings.json | 2 +- docs/.vitepress/config/plugins/demo-preview.ts | 1 - packages/effects/access/src/accessible.ts | 5 ++++- .../captcha/slider-rotate-captcha/index.vue | 6 +++--- packages/effects/plugins/src/vxe-table/init.ts | 13 ++++++++++--- packages/stores/src/setup.ts | 1 - 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 34058f5ec..7390c1aee 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -39,7 +39,7 @@ // lint && format "oxc.enable": true, "oxc.typeAware": true, - "oxc.fmt.configPath": ".oxfmtrc.json", + "oxc.fmt.configPath": "oxlint.config.ts", "editor.codeActionsOnSave": { "source.fixAll.oxc": "explicit", "source.fixAll.stylelint": "explicit", diff --git a/docs/.vitepress/config/plugins/demo-preview.ts b/docs/.vitepress/config/plugins/demo-preview.ts index ba3863b0b..84f9c9b5d 100644 --- a/docs/.vitepress/config/plugins/demo-preview.ts +++ b/docs/.vitepress/config/plugins/demo-preview.ts @@ -5,7 +5,6 @@ import { readdirSync } from 'node:fs'; import { join } from 'node:path'; export const rawPathRegexp = - // eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/strict /^(.+?(?:\.([\da-z]+))?)(#[\w-]+)?(?: ?{(\d+(?:[,-]\d+)*)? ?(\S+)?})? ?(?:\[(.+)])?$/; function rawPathToToken(rawPath: string) { diff --git a/packages/effects/access/src/accessible.ts b/packages/effects/access/src/accessible.ts index 24cd9fa3d..fc0873657 100644 --- a/packages/effects/access/src/accessible.ts +++ b/packages/effects/access/src/accessible.ts @@ -182,7 +182,10 @@ function mergeRoutesByName( isString(route.name) && routeMap.has(route.name as string) ) { - const existing = routeMap.get(route.name as string)!; + const existing = routeMap.get(route.name as string); + if (!existing) { + continue; + } const existingChildren = existing.children ?? []; const routeChildren = route.children ?? []; diff --git a/packages/effects/common-ui/src/components/captcha/slider-rotate-captcha/index.vue b/packages/effects/common-ui/src/components/captcha/slider-rotate-captcha/index.vue index 23eeac2a4..1e2297895 100644 --- a/packages/effects/common-ui/src/components/captcha/slider-rotate-captcha/index.vue +++ b/packages/effects/common-ui/src/components/captcha/slider-rotate-captcha/index.vue @@ -84,12 +84,12 @@ function handleDragBarMove(data: SliderRotateVerifyPassingData) { state.dragging = true; const { imageSize, maxDegree } = props; const { moveX } = data; - const denominator = imageSize!; + const denominator = imageSize; if (denominator === 0) { return; } const currentRotate = Math.ceil( - (moveX / denominator) * 1.5 * maxDegree! * unref(getFactorRef), + (moveX / denominator) * 1.5 * maxDegree * unref(getFactorRef), ); state.currentRotate = currentRotate; setImgRotate(state.randomRotate - currentRotate); @@ -98,7 +98,7 @@ function handleDragBarMove(data: SliderRotateVerifyPassingData) { function handleImgOnLoad() { const { maxDegree, minDegree } = props; const ranRotate = Math.floor( - minDegree! + Math.random() * (maxDegree! - minDegree!), + minDegree + Math.random() * (maxDegree - minDegree), ); // 生成随机角度 state.randomRotate = ranRotate; setImgRotate(ranRotate); diff --git a/packages/effects/plugins/src/vxe-table/init.ts b/packages/effects/plugins/src/vxe-table/init.ts index 00e9d8abe..e28a1de15 100644 --- a/packages/effects/plugins/src/vxe-table/init.ts +++ b/packages/effects/plugins/src/vxe-table/init.ts @@ -50,8 +50,15 @@ import { extendsDefaultFormatter } from './extends'; // 是否加载过 let isInit = false; -// eslint-disable-next-line import/no-mutable-exports -export let useTableForm: typeof useVbenForm; +let tableFormFactory: typeof useVbenForm | undefined; + +export const useTableForm: typeof useVbenForm = ((...args) => { + if (!tableFormFactory) { + throw new Error('useTableForm is not initialized'); + } + + return tableFormFactory(...args); +}) as typeof useVbenForm; // 部分组件,如果没注册,vxe-table 会报错,这里实际没用组件,只是为了不报错,同时可以减少打包体积 const createVirtualComponent = (name = '') => { @@ -104,7 +111,7 @@ export function setupVbenVxeTable(setupOptions: SetupVxeTable) { const { configVxeTable, useVbenForm } = setupOptions; initVxeTable(); - useTableForm = useVbenForm; + tableFormFactory = useVbenForm; const { isDark, locale } = usePreferences(); diff --git a/packages/stores/src/setup.ts b/packages/stores/src/setup.ts index 9dd948cec..36b3a701c 100644 --- a/packages/stores/src/setup.ts +++ b/packages/stores/src/setup.ts @@ -47,7 +47,6 @@ export async function initStores(app: App, options: InitStoreOptions) { encodingType: 'aes', encryptionSecret: import.meta.env.VITE_APP_STORE_SECURE_KEY, isCompression: true, - // @ts-ignore secure-ls does not have a type definition for this metaKey: `${namespace}-secure-meta`, }); pinia.use(