feat: 添加 .editorconfig 文件,更新 ESLint 配置,修改 TypeScript 配置以支持 Node 22,优化依赖项版本
All checks were successful
/ depcheck (push) Successful in 1m31s
/ build-and-deploy-to-vercel (push) Successful in 2m6s
/ playwright (push) Successful in 2m27s

This commit is contained in:
严浩
2025-01-02 22:22:51 +08:00
parent d132ae7484
commit 78ec619f23
9 changed files with 40 additions and 59 deletions

6
.editorconfig Normal file
View File

@ -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

View File

@ -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',

View File

@ -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,
];

View File

@ -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",

24
pnpm-lock.yaml generated
View File

@ -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

View File

@ -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"]
// }
}

View File

@ -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",

View File

@ -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';