chore: eslint.config.ts
All checks were successful
/ depcheck (push) Successful in 2m12s
/ build-and-deploy-to-vercel (push) Successful in 2m22s
/ surge (push) Successful in 1m53s
/ playwright (push) Successful in 3m18s

This commit is contained in:
mini2024
2025-03-01 18:20:11 +08:00
parent 94b71c5c47
commit c7047146e4
13 changed files with 135 additions and 44 deletions

View File

@ -2,6 +2,7 @@
// node .depcheck.js
import depcheck from 'depcheck';
depcheck(process.cwd(), {
ignorePatterns: ['tsconfig.json'],
}).then((unused) => {

2
.npmrc
View File

@ -2,7 +2,7 @@ registry=https://registry.npmmirror.com/
registry=https://mirrors.cloud.tencent.com/npm/
registry=https://mirrors.huaweicloud.com/repository/npm/
registry=https://registry.npmjs.org/
registry=https://nexus.oo1.dev/repository/npm/
# registry=https://nexus.oo1.dev/repository/npm/
# https://pnpm.io/zh/npmrc#node-mirrorltreleasedir
use-node-version=22.14.0

View File

@ -1,6 +1,7 @@
import { includeIgnoreFile } from '@eslint/compat';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
import pluginImport from 'eslint-plugin-import-x';
import oxlint from 'eslint-plugin-oxlint';
import perfectionist from 'eslint-plugin-perfectionist';
import pluginVue from 'eslint-plugin-vue';
@ -11,8 +12,11 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');
import type { Linter } from 'eslint';
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
import { configureVueProject } from '@vue/eslint-config-typescript';
configureVueProject({ scriptLangs: ['ts', 'tsx', 'js', 'jsx'] });
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
@ -43,18 +47,11 @@ export default defineConfigWithVueTs(
oxlint.configs['flat/recommended'],
skipFormatting,
importPluginConfig(),
{
rules: {
'vue/multi-word-component-names': 'off',
'@typescript-eslint/no-explicit-any': 'off',
// 'vue/block-lang': [
// 'error',
// {
// script: {
// allowNoLang: true,
// },
// },
// ],
'vue/block-order': [
'error',
{
@ -67,7 +64,6 @@ export default defineConfigWithVueTs(
order: ['defineOptions', 'defineProps', 'defineEmits', 'defineSlots'],
},
],
'import/newline-after-import': 'error',
},
},
@ -81,3 +77,24 @@ export default defineConfigWithVueTs(
},
},
);
function importPluginConfig(): Linter.Config[] {
return [
{
plugins: {
// @ts-expect-error - This is a dynamic import
import: pluginImport,
},
rules: {
// 'import/first': 'error',
'import/newline-after-import': 'error',
// 'import/no-duplicates': 'error',
// 'import/no-mutable-exports': 'error',
// 'import/no-named-default': 'error',
// 'import/no-self-import': 'error',
// 'import/no-unresolved': 'off',
// 'import/no-webpack-loader-syntax': 'error',
},
},
];
}

View File

@ -96,6 +96,7 @@
"depcheck": "^1.4.7",
"eruda": "^3.4.1",
"eslint": "^9.19.0",
"eslint-plugin-import-x": "^4.6.1",
"eslint-plugin-oxlint": "^0.15.10",
"eslint-plugin-perfectionist": "^4.8.0",
"eslint-plugin-vue": "^9.32.0",

103
pnpm-lock.yaml generated
View File

@ -182,6 +182,9 @@ importers:
eslint:
specifier: ^9.19.0
version: 9.20.1(jiti@2.4.2)
eslint-plugin-import-x:
specifier: ^4.6.1
version: 4.6.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3)
eslint-plugin-oxlint:
specifier: ^0.15.10
version: 0.15.10
@ -1083,25 +1086,21 @@ packages:
resolution: {integrity: sha512-eEwxY+0Cf76HnQwr1+Qy48qwf4dAebTHaKhzEgxLqLK6szbglnK6SThjY95YHrYWwsH1GujWiFoX51jwZNYfSw==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@oxc-resolver/binding-linux-arm64-musl@3.0.3':
resolution: {integrity: sha512-LdxbLv8qVkzro4/ZoP9MuytIL6NOVsbhoZ5Wl1KXOa/2DSxBiksrAPMSChCTyeLy6P3ebSHxQSb52ku18t1LBA==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@oxc-resolver/binding-linux-x64-gnu@3.0.3':
resolution: {integrity: sha512-bN8elR9AV/DZZPdcteOWWElkz8KyxLtOvmfVl7Dnehcs6f9e+fWYKyqiKvva1jsxG4znGKCPT1gfMhpYW8QuKg==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@oxc-resolver/binding-linux-x64-musl@3.0.3':
resolution: {integrity: sha512-Zy1U49BjriwbAds2ho6CGjZIk2KVn0+lrc/G5bvhQg7UJYxEkAueMGBuA5rULIhx9xVtIPsT9Q+J5Xhb4ffVNw==}
cpu: [x64]
os: [linux]
libc: [musl]
'@oxc-resolver/binding-wasm32-wasi@3.0.3':
resolution: {integrity: sha512-7rteQnn7i5f9nkFZs1VRdBqFhvOx3zWavyKkWjXYVxc9vsSLTg0moh2MRZw5dw5m/bEi1u/p3YAKJ9gdHyBhNQ==}
@ -1132,25 +1131,21 @@ packages:
resolution: {integrity: sha512-fUxOOYlQBXc6Cz7d40zE2G6VG4yhR9vz+P1M8T1NhTe6yFUzfCCWV+zmHxpUPEy9dgGZPIvodIx7bP+kOPEmuA==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@oxlint/linux-arm64-musl@0.15.10':
resolution: {integrity: sha512-JESSO73nplnTftaBpWdgjsOtuSfl7Jeg3I37qJYVtHIxxyJMtHuuUd9g0K0MLbwcue2K7DFCnzlDNlxer2yrgQ==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@oxlint/linux-x64-gnu@0.15.10':
resolution: {integrity: sha512-NS4joBtL8Hg7zPBlPxSzrSRqkxtZfABf+fAY8vNxwYMsG8I8VoQZQdhz7+0p6ecg0+jH3CmIpDQfo73eaUBwoA==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@oxlint/linux-x64-musl@0.15.10':
resolution: {integrity: sha512-zC2eEEe4scfsoUV87YsZFOSfPutxeaAmCI9Ys2G1lQoTyZ+9G9nuxTzBMla/yspX6mQGxonXPxLxYbIlDT24vA==}
cpu: [x64]
os: [linux]
libc: [musl]
'@oxlint/win32-arm64@0.15.10':
resolution: {integrity: sha512-u8nHap9L96zTQvwHYqn1ZcoiHzLR24ifuKDBIwlmwEVYucUgE55tUc+ea8kPUUB4uvfOv0HtAxNFuKr43biPzg==}
@ -1258,61 +1253,51 @@ packages:
resolution: {integrity: sha512-PaMRNBSqCx7K3Wc9QZkFx5+CX27WFpAMxJNiYGAXfmMIKC7jstlr32UhTgK6T07OtqR+wYlWm9IxzennjnvdJg==}
cpu: [arm]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.30.1':
resolution: {integrity: sha512-B8Rcyj9AV7ZlEFqvB5BubG5iO6ANDsRKlhIxySXcF1axXYUyqwBok+XZPgIYGBgs7LDXfWfifxhw0Ik57T0Yug==}
cpu: [arm]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.30.1':
resolution: {integrity: sha512-hqVyueGxAj3cBKrAI4aFHLV+h0Lv5VgWZs9CUGqr1z0fZtlADVV1YPOij6AhcK5An33EXaxnDLmJdQikcn5NEw==}
cpu: [arm64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.30.1':
resolution: {integrity: sha512-i4Ab2vnvS1AE1PyOIGp2kXni69gU2DAUVt6FSXeIqUCPIR3ZlheMW3oP2JkukDfu3PsexYRbOiJrY+yVNSk9oA==}
cpu: [arm64]
os: [linux]
libc: [musl]
'@rollup/rollup-linux-loongarch64-gnu@4.30.1':
resolution: {integrity: sha512-fARcF5g296snX0oLGkVxPmysetwUk2zmHcca+e9ObOovBR++9ZPOhqFUM61UUZ2EYpXVPN1redgqVoBB34nTpQ==}
cpu: [loong64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-powerpc64le-gnu@4.30.1':
resolution: {integrity: sha512-GLrZraoO3wVT4uFXh67ElpwQY0DIygxdv0BNW9Hkm3X34wu+BkqrDrkcsIapAY+N2ATEbvak0XQ9gxZtCIA5Rw==}
cpu: [ppc64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-gnu@4.30.1':
resolution: {integrity: sha512-0WKLaAUUHKBtll0wvOmh6yh3S0wSU9+yas923JIChfxOaaBarmb/lBKPF0w/+jTVozFnOXJeRGZ8NvOxvk/jcw==}
cpu: [riscv64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-s390x-gnu@4.30.1':
resolution: {integrity: sha512-GWFs97Ruxo5Bt+cvVTQkOJ6TIx0xJDD/bMAOXWJg8TCSTEK8RnFeOeiFTxKniTc4vMIaWvCplMAFBt9miGxgkA==}
cpu: [s390x]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.30.1':
resolution: {integrity: sha512-UtgGb7QGgXDIO+tqqJ5oZRGHsDLO8SlpE4MhqpY9Llpzi5rJMvrK6ZGhsRCST2abZdBqIBeXW6WPD5fGK5SDwg==}
cpu: [x64]
os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.30.1':
resolution: {integrity: sha512-V9U8Ey2UqmQsBT+xTOeMzPzwDzyXmnAoO4edZhL7INkwQcaW1Ckv3WJX3qrrp/VHaDkEWIBWhRwP47r8cdrOow==}
cpu: [x64]
os: [linux]
libc: [musl]
'@rollup/rollup-win32-arm64-msvc@4.30.1':
resolution: {integrity: sha512-WabtHWiPaFF47W3PkHnjbmWawnX/aE57K47ZDT1BXTS5GgrBUEpvOzq0FI0V/UYzQJgdb8XlhVNH8/fwV8xDjw==}
@ -1374,6 +1359,9 @@ packages:
'@types/conventional-commits-parser@5.0.1':
resolution: {integrity: sha512-7uz5EHdzz2TqoMfV7ee61Egf5y6NkcO4FB/1iCCQnbeiI1F3xzv3vK5dBCXUCLQgGYS+mUeigK1iKQzvED+QnQ==}
'@types/doctrine@0.0.9':
resolution: {integrity: sha512-eOIHzCUSH7SMfonMG1LsC2f8vxBFtho6NGBznK41R84YzPuvSBzrhEps33IsQiOW9+VL6NQ9DbjQJznk/S4uRA==}
'@types/estree@1.0.6':
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
@ -2501,6 +2489,14 @@ packages:
de-indent@1.0.2:
resolution: {integrity: sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==}
debug@3.2.7:
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
debug@4.3.4:
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
engines: {node: '>=6.0'}
@ -2591,6 +2587,10 @@ packages:
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
engines: {node: '>=0.3.1'}
doctrine@3.0.0:
resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==}
engines: {node: '>=6.0.0'}
dom-align@1.12.4:
resolution: {integrity: sha512-R8LUSEay/68zE5c8/3BDxiTEvgb4xZTF0RKmAHfiEVN3klfIpXfi2/QCoiWPccVQ0J/ZGdz9OjzL4uJEP/MRAw==}
@ -2635,6 +2635,10 @@ packages:
end-of-stream@1.1.0:
resolution: {integrity: sha512-EoulkdKF/1xa92q25PbjuDcgJ9RDHYU2Rs3SCIvs2/dSQ3BpmxneNHmA/M7fe60M3PrV7nNGTTNbkK62l6vXiQ==}
enhanced-resolve@5.18.1:
resolution: {integrity: sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==}
engines: {node: '>=10.13.0'}
entities@4.5.0:
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
engines: {node: '>=0.12'}
@ -2828,6 +2832,15 @@ packages:
peerDependencies:
eslint: '>=7.0.0'
eslint-import-resolver-node@0.3.9:
resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==}
eslint-plugin-import-x@4.6.1:
resolution: {integrity: sha512-wluSUifMIb7UfwWXqx7Yx0lE/SGCcGXECLx/9bCmbY2nneLwvAZ4vkd1IXDjPKFvdcdUgr1BaRnaRpx3k2+Pfw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
peerDependencies:
eslint: ^8.57.0 || ^9.0.0
eslint-plugin-oxlint@0.15.10:
resolution: {integrity: sha512-e8Q1xdvGhmy3jUpszrbLT2dX7X0xl2B2QmPSvkIlU+ozixXDw7EJCj8XsB/zO2wLLE1R73yF4wy5oqQXe5SLKA==}
@ -4638,6 +4651,9 @@ packages:
engines: {node: '>=0.10.0'}
hasBin: true
stable-hash@0.0.4:
resolution: {integrity: sha512-LjdcbuBeLcdETCrPn9i8AYAZ1eCtu4ECAWtP7UleOiZ9LzVxRzzUZEoZ8zB24nhkQnDWyET0I+3sWokSDS3E7g==}
stat-mode@0.3.0:
resolution: {integrity: sha512-QjMLR0A3WwFY2aZdV0okfFEJB5TRjkggXZjxP3A1RsWsNHNu3YPv8btmtc6iCFZ0Rul3FE93OYogvhOUClU+ng==}
@ -4761,6 +4777,10 @@ packages:
resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==}
engines: {node: ^14.18.0 || >=16.0.0}
tapable@2.2.1:
resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==}
engines: {node: '>=6'}
tar@4.4.18:
resolution: {integrity: sha512-ZuOtqqmkV9RE1+4odd+MhBpibmCxNP6PJhH/h2OqNuotTX7/XHPZQJv2pKvWMplFH9SIZZhitehh6vBH6LO8Pg==}
engines: {node: '>=4.5'}
@ -6437,6 +6457,8 @@ snapshots:
'@types/node': 22.13.1
optional: true
'@types/doctrine@0.0.9': {}
'@types/estree@1.0.6': {}
'@types/json-schema@7.0.15': {}
@ -7952,6 +7974,10 @@ snapshots:
de-indent@1.0.2: {}
debug@3.2.7:
dependencies:
ms: 2.1.3
debug@4.3.4:
dependencies:
ms: 2.1.2
@ -8032,6 +8058,10 @@ snapshots:
diff@4.0.2: {}
doctrine@3.0.0:
dependencies:
esutils: 2.0.3
dom-align@1.12.4: {}
dom-scroll-into-view@2.0.1: {}
@ -8078,6 +8108,11 @@ snapshots:
dependencies:
once: 1.3.3
enhanced-resolve@5.18.1:
dependencies:
graceful-fs: 4.2.11
tapable: 2.2.1
entities@4.5.0: {}
env-paths@2.2.1:
@ -8260,6 +8295,34 @@ snapshots:
dependencies:
eslint: 9.20.1(jiti@2.4.2)
eslint-import-resolver-node@0.3.9:
dependencies:
debug: 3.2.7
is-core-module: 2.16.1
resolve: 1.22.10
transitivePeerDependencies:
- supports-color
eslint-plugin-import-x@4.6.1(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3):
dependencies:
'@types/doctrine': 0.0.9
'@typescript-eslint/scope-manager': 8.24.0
'@typescript-eslint/utils': 8.24.0(eslint@9.20.1(jiti@2.4.2))(typescript@5.7.3)
debug: 4.4.0
doctrine: 3.0.0
enhanced-resolve: 5.18.1
eslint: 9.20.1(jiti@2.4.2)
eslint-import-resolver-node: 0.3.9
get-tsconfig: 4.8.1
is-glob: 4.0.3
minimatch: 9.0.5
semver: 7.6.3
stable-hash: 0.0.4
tslib: 2.8.1
transitivePeerDependencies:
- supports-color
- typescript
eslint-plugin-oxlint@0.15.10:
dependencies:
jsonc-parser: 3.3.1
@ -10043,6 +10106,8 @@ snapshots:
safer-buffer: 2.1.2
tweetnacl: 0.14.5
stable-hash@0.0.4: {}
stat-mode@0.3.0: {}
statuses@1.5.0: {}
@ -10187,6 +10252,8 @@ snapshots:
'@pkgr/core': 0.1.1
tslib: 2.8.1
tapable@2.2.1: {}
tar@4.4.18:
dependencies:
chownr: 1.1.4

View File

@ -1,5 +1,6 @@
<script lang="ts">
import type { FileUploadState, FileUploadUploaderEvent } from 'primevue/fileupload';
interface FileExt extends File {
objectURL: string;
}

View File

@ -1,16 +1,8 @@
<script lang="ts">
<script setup lang="ts">
import type { PopconfirmProps } from 'ant-design-vue';
type NotUndefined<T> = T extends undefined ? never : T;
type PopconfirmOnConfirmParameters = Parameters<NotUndefined<PopconfirmProps['onConfirm']>>;
type HPopconfirmProps = {
description: PopconfirmProps['description'];
onConfirm?: (...args: PopconfirmOnConfirmParameters) => Promise<void>;
title: PopconfirmProps['title'];
};
</script>
import type { HPopconfirmProps } from './types';
<script setup lang="ts">
defineOptions({ inheritAttrs: true });
const props = defineProps<HPopconfirmProps>();

View File

@ -0,0 +1,9 @@
import type { PopconfirmProps } from 'ant-design-vue';
type NotUndefined<T> = T extends undefined ? never : T;
type PopconfirmOnConfirmParameters = Parameters<NotUndefined<PopconfirmProps['onConfirm']>>;
export type HPopconfirmProps = {
description: PopconfirmProps['description'];
onConfirm?: (...args: PopconfirmOnConfirmParameters) => Promise<void>;
title: PopconfirmProps['title'];
};

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { message } from 'ant-design-vue';
import HAPopconfirm from './HAPopconfirm.vue';
import HAPopconfirm from './HAPopconfirm/HAPopconfirm.vue';
async function handleConfirmAsync(e: MouseEvent) {
console.debug('handleConfirmAsync', e);

View File

@ -1,6 +1,7 @@
<script setup lang="tsx">
const VITE_BUILD_COMMIT = import.meta.env.VITE_BUILD_COMMIT;
import { routes } from 'vue-router/auto-routes';
definePage({ meta: { title: '首页' } });
useHead({
// Titles

View File

@ -1,5 +1,6 @@
<script setup lang="ts">
import { $enum } from 'ts-enum-util';
enum Direction {
Up = 'UP',
Down = 'DOWN',

View File

@ -3,6 +3,7 @@ import { createGetRoutes, setupLayouts } from 'virtual:meta-layouts';
// import { createGetRoutes, setupLayouts } from 'virtual:generated-layouts';
import { createRouter, createWebHistory } from 'vue-router/auto';
import { handleHotUpdate, routes } from 'vue-router/auto-routes';
const setupLayoutsResult = setupLayouts(routes);
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),

View File

@ -1,6 +1,6 @@
// https://github.dev/unocss/unocss/tree/main/examples/vite-vue3
import { defineConfig, presetAttributify, presetWind3, transformerDirectives, transformerVariantGroup } from 'unocss';
import presetChinese, { chineseTypography } from 'unocss-preset-chinese';
// import presetChinese, { chineseTypography } from 'unocss-preset-chinese';
export default defineConfig({
theme: {
@ -56,10 +56,10 @@ export default defineConfig({
dark: '.app-dark',
},
}),
chineseTypography(),
presetChinese({
chineseType: 'simplified', // 指定文本为简体中文
}),
// chineseTypography(),
// presetChinese({
// chineseType: 'simplified', // 指定文本为简体中文
// }),
// https://unocss.dev/presets/attributify
presetAttributify(),