diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ecea360 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}] +charset = utf-8 +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.prettierignore b/.prettierignore.off similarity index 100% rename from .prettierignore rename to .prettierignore.off diff --git a/eslint.config.js b/eslint.config.js index 9fb21cc..95a68e5 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -28,12 +28,15 @@ export default [ ...pluginVue.configs['flat/essential'], ...vueTsEslintConfig({ supportedScriptLangs: { ts: true, tsx: true } }), + { ...pluginVitest.configs.recommended, files: ['src/**/__tests__/*'], }, + oxlint.configs['flat/recommended'], skipFormatting, + { rules: { 'vue/multi-word-component-names': 'off', diff --git a/eslint.config.mjs.bak b/eslint.config.mjs.bak deleted file mode 100644 index 86cdbad..0000000 --- a/eslint.config.mjs.bak +++ /dev/null @@ -1,37 +0,0 @@ -import { includeIgnoreFile } from '@eslint/compat'; -import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'; -import vueTsEslintConfig from '@vue/eslint-config-typescript'; -import pluginVue from 'eslint-plugin-vue'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const gitignorePath = path.resolve(__dirname, '.gitignore'); - -/** - * @type import('eslint').Linter.Config[] - */ -export default [ - // --ignore-path .gitignore - includeIgnoreFile(gitignorePath), - { - name: 'app/files-to-lint', - files: ['**/*.{ts,mts,tsx,vue}'], - }, - - { - name: 'app/files-to-ignore', - ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'], - }, - - ...pluginVue.configs['flat/essential'], - ...vueTsEslintConfig({ - supportedScriptLangs: { - ts: true, - tsx: true, - }, - }), - - skipFormatting, -]; diff --git a/package.json b/package.json index bcb2d9a..0adc833 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "private": true, "type": "module", "scripts": { - "dev": "vite", + "dev": "vite --port 4730", "all": "run-p build-only format type-check lint", "build": "run-p type-check \"build-only {@}\" --", "build-only": "vite build", @@ -77,8 +77,9 @@ "@iconify/utils": "^2.2.1", "@playwright/test": "^1.49.1", "@primevue/auto-import-resolver": "^4.2.5", - "@tsconfig/node20": "^20.1.4", + "@tsconfig/node22": "^22.0.0", "@types/jsdom": "^21.1.7", + "@types/mockjs": "^1.0.10", "@types/node": "^22.10.3", "@types/nprogress": "^0.2.3", "@unocss/preset-rem-to-px": "^0.65.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b7d2ded..9c6f761 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -129,12 +129,15 @@ importers: '@primevue/auto-import-resolver': specifier: ^4.2.5 version: 4.2.5 - '@tsconfig/node20': - specifier: ^20.1.4 - version: 20.1.4 + '@tsconfig/node22': + specifier: ^22.0.0 + version: 22.0.0 '@types/jsdom': specifier: ^21.1.7 version: 21.1.7 + '@types/mockjs': + specifier: ^1.0.10 + version: 1.0.10 '@types/node': specifier: ^22.10.3 version: 22.10.3 @@ -1308,8 +1311,8 @@ packages: '@tsconfig/node16@1.0.4': resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - '@tsconfig/node20@20.1.4': - resolution: {integrity: sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==} + '@tsconfig/node22@22.0.0': + resolution: {integrity: sha512-twLQ77zevtxobBOD4ToAtVmuYrpeYUh3qh+TEp+08IWhpsrIflVHqQ1F1CiPxQGL7doCdBIOOCF+1Tm833faNg==} '@tybys/wasm-util@0.9.0': resolution: {integrity: sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==} @@ -1338,6 +1341,9 @@ packages: '@types/minimatch@3.0.5': resolution: {integrity: sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==} + '@types/mockjs@1.0.10': + resolution: {integrity: sha512-SXgrhajHG7boLv6oU93CcmdDm0HYRiceuz6b+7z+/2lCJPTWDv0V5YiwFHT2ejE4bQqgSXQiVPQYPWv7LGsK1g==} + '@types/node@16.18.11': resolution: {integrity: sha512-3oJbGBUWuS6ahSnEq1eN2XrCyf4YsWI8OyCvo7c64zQJNplk3mO84t53o8lfTk+2ji59g5ycfc6qQ3fdHliHuA==} @@ -6313,7 +6319,7 @@ snapshots: '@tsconfig/node16@1.0.4': {} - '@tsconfig/node20@20.1.4': {} + '@tsconfig/node22@22.0.0': {} '@tybys/wasm-util@0.9.0': dependencies: @@ -6346,6 +6352,8 @@ snapshots: '@types/minimatch@3.0.5': {} + '@types/mockjs@1.0.10': {} + '@types/node@16.18.11': {} '@types/node@22.10.3': @@ -7789,7 +7797,7 @@ snapshots: debug@4.1.1: dependencies: - ms: 2.1.1 + ms: 2.1.3 debug@4.4.0: dependencies: @@ -10186,7 +10194,7 @@ snapshots: dependencies: '@rollup/pluginutils': 5.1.4(rollup@4.29.1) '@volar/language-core': 2.4.11 - '@vue/language-core': 2.1.10(typescript@5.7.2) + '@vue/language-core': 2.2.0(typescript@5.7.2) muggle-string: 0.4.1 transitivePeerDependencies: - rollup diff --git a/tsconfig.app.json b/tsconfig.app.json index f844015..eb815b3 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -11,26 +11,25 @@ ], "exclude": ["src/**/__tests__/*"], "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", "types": [ - // "vitest", "vite/client", + // "vitest", + "vite-plugin-vue-layouts/client", + "vite-plugin-vue-meta-layouts/client", // "vite-plugin-pwa/client", "unplugin-vue-macros/macros-global", "unplugin-vue-router/client", - "vite-plugin-vue-meta-layouts/client", "unplugin-icons/types/vue", "@intlify/unplugin-vue-i18n/messages" ], - "composite": true, - "moduleResolution": "Bundler", - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", - "baseUrl": ".", "paths": { "@/*": ["./src/*"] } - }, - "vueCompilerOptions": { - "plugins": ["unplugin-vue-macros/volar"] } + // // https://vue-macros.dev/zh-CN/guide/bundler-integration.html#typescript-支持 + // "vueCompilerOptions": { + // "plugins": ["unplugin-vue-macros/volar"] + // } } diff --git a/tsconfig.node.json b/tsconfig.node.json index f094063..23dc176 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,14 +1,14 @@ { - "extends": "@tsconfig/node20/tsconfig.json", + "extends": "@tsconfig/node22/tsconfig.json", "include": [ "vite.config.*", "vitest.config.*", "cypress.config.*", "nightwatch.conf.*", - "playwright.config.*" + "playwright.config.*", + "fake/**/*" ], "compilerOptions": { - "composite": true, "noEmit": true, "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", diff --git a/vite.config.ts b/vite.config.ts index 86a171a..504d088 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,5 @@ import { fileURLToPath, URL } from 'node:url'; + // import { createSplitChunkOutput } from 'utils4u/rollup'; import { createViteProxy } from 'utils4u/vite'; import { defineConfig, loadEnv } from 'vite';