mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
refactor: 升级开发依赖, 包含 Vite ESModule Prettier ESLint Typescript 等基础设施
This commit is contained in:
parent
0ab1465391
commit
d60063e15e
7
.editorconfig
Normal file
7
.editorconfig
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue}]
|
||||||
|
charset = utf-8
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
end_of_line = true
|
||||||
|
trim_trailing_whitespace = true
|
@ -1,11 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
public/
|
|
||||||
es/
|
|
||||||
lib/
|
|
||||||
dist/
|
|
||||||
package.json
|
|
||||||
src/assets/
|
|
||||||
plop-templates/
|
|
||||||
handlebars/
|
|
||||||
website/
|
|
||||||
build/
|
|
30
.eslintrc.js
30
.eslintrc.js
@ -1,30 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
parser: 'vue-eslint-parser',
|
|
||||||
globals: {
|
|
||||||
postMessage: true
|
|
||||||
},
|
|
||||||
parserOptions: {
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
sourceType: 'module',
|
|
||||||
ecmaFeatures: {
|
|
||||||
jsx: true,
|
|
||||||
tsx: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
env: {
|
|
||||||
node: true,
|
|
||||||
// The Follow config only works with eslint-plugin-vue v8.0.0+
|
|
||||||
'vue/setup-compiler-macros': true
|
|
||||||
},
|
|
||||||
extends: ['plugin:vue/vue3-essential', 'eslint:recommended'],
|
|
||||||
rules: {
|
|
||||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
||||||
'no-unused-vars': 'off',
|
|
||||||
'vue/no-unused-vars': 'off',
|
|
||||||
'vue/multi-word-component-names': 'off',
|
|
||||||
'vue/valid-template-root': 'off',
|
|
||||||
'vue/no-mutating-props': 'off'
|
|
||||||
}
|
|
||||||
}
|
|
8
.prettierignore
Normal file
8
.prettierignore
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
auto-imports.d.ts
|
||||||
|
components.d.ts
|
||||||
|
pnpm-lock.yaml
|
||||||
|
dist
|
||||||
|
/node_modules/*
|
||||||
|
.workflow
|
||||||
|
src/packages/components/Charts/Maps/MapBase/mapGeojson/*.json
|
||||||
|
store-template
|
60
eslint.config.js
Normal file
60
eslint.config.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import pluginVue from 'eslint-plugin-vue'
|
||||||
|
import vueTsEslintConfig from '@vue/eslint-config-typescript'
|
||||||
|
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
name: 'app/files-to-lint',
|
||||||
|
files: ['**/*.{ts,mts,tsx,vue}']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'app/files-to-ignore',
|
||||||
|
ignores: [
|
||||||
|
'**/dist/**',
|
||||||
|
'**/dist-ssr/**',
|
||||||
|
'**/coverage/**',
|
||||||
|
'node_modules/',
|
||||||
|
'public/',
|
||||||
|
'es/',
|
||||||
|
'lib/',
|
||||||
|
'dist/',
|
||||||
|
'package.json',
|
||||||
|
'src/assets/',
|
||||||
|
'plop-templates/',
|
||||||
|
'handlebars/',
|
||||||
|
'website/',
|
||||||
|
'build/'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
...pluginVue.configs['flat/essential'],
|
||||||
|
...vueTsEslintConfig(),
|
||||||
|
skipFormatting,
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'vue/no-unused-vars': 'off',
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
|
'vue/valid-template-root': 'off',
|
||||||
|
'vue/no-mutating-props': 'off',
|
||||||
|
|
||||||
|
// TODO: 下面的规则后续放开,然后自动修复
|
||||||
|
'no-var': 'off',
|
||||||
|
'prefer-const': 'off',
|
||||||
|
'vue/no-ref-as-operand': 'off',
|
||||||
|
'vue/block-lang': 'off',
|
||||||
|
'vue/no-dupe-keys': 'off',
|
||||||
|
'@typescript-eslint/no-wrapper-object-types': 'off',
|
||||||
|
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
|
||||||
|
'@typescript-eslint/no-empty-object-type': 'off',
|
||||||
|
'@typescript-eslint/no-unsafe-function-type': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-duplicate-enum-values': 'off',
|
||||||
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
|
'@typescript-eslint/no-unused-expressions': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/consistent-type-imports': 'error'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
49
package.json
49
package.json
@ -4,15 +4,19 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.14 <18.0.0"
|
"node": ">=16.14 <18.0.0"
|
||||||
},
|
},
|
||||||
|
"type": "module",
|
||||||
"packageManager": "pnpm@8.15.9",
|
"packageManager": "pnpm@8.15.9",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host",
|
"dev": "vite --host",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "run-p type-check \"build-only {@}\" --",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"new": "plop --plopfile ./plop/plopfile.js",
|
"new": "plop --plopfile ./plop/plopfile.js",
|
||||||
"postinstall": "husky install",
|
"postinstall": "husky install",
|
||||||
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.vue src",
|
"build-only": "vite build",
|
||||||
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx,.vue src --fix"
|
"type-check": "vue-tsc --build --force",
|
||||||
|
"lint": "eslint .",
|
||||||
|
"lint:fix": "eslint . --fix",
|
||||||
|
"format": "prettier --write ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@amap/amap-jsapi-loader": "^1.0.1",
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
||||||
@ -42,7 +46,7 @@
|
|||||||
"pinia": "^2.0.13",
|
"pinia": "^2.0.13",
|
||||||
"screenfull": "^6.0.1",
|
"screenfull": "^6.0.1",
|
||||||
"three": "^0.145.0",
|
"three": "^0.145.0",
|
||||||
"vue": "^3.2.31",
|
"vue": "3.5.13",
|
||||||
"vue-demi": "^0.13.1",
|
"vue-demi": "^0.13.1",
|
||||||
"vue-i18n": "9.2.2",
|
"vue-i18n": "9.2.2",
|
||||||
"vue-router": "4.0.12",
|
"vue-router": "4.0.12",
|
||||||
@ -53,38 +57,37 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^17.0.2",
|
"@commitlint/cli": "^17.0.2",
|
||||||
"@commitlint/config-conventional": "^17.0.2",
|
"@commitlint/config-conventional": "^17.0.2",
|
||||||
"@types/node": "^16.11.26",
|
"@tsconfig/node22": "22.0.0",
|
||||||
|
"@types/node": "22.9.0",
|
||||||
"@types/three": "^0.144.0",
|
"@types/three": "^0.144.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
|
||||||
"@typescript-eslint/parser": "^5.18.0",
|
|
||||||
"@vicons/carbon": "^0.12.0",
|
"@vicons/carbon": "^0.12.0",
|
||||||
"@vicons/ionicons5": "~0.11.0",
|
"@vicons/ionicons5": "~0.11.0",
|
||||||
"@vitejs/plugin-vue": "^4.2.3",
|
"@vitejs/plugin-vue": "5.2.0",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
"@vitejs/plugin-vue-jsx": "4.1.0",
|
||||||
"@vue/compiler-sfc": "^3.2.31",
|
"@vue/eslint-config-prettier": "10.1.0",
|
||||||
|
"@vue/eslint-config-typescript": "14.1.3",
|
||||||
|
"@vue/tsconfig": "0.6.0",
|
||||||
"@vueuse/core": "^7.7.1",
|
"@vueuse/core": "^7.7.1",
|
||||||
"commitlint": "^17.0.2",
|
"commitlint": "^17.0.2",
|
||||||
"default-passive-events": "^2.0.0",
|
"default-passive-events": "^2.0.0",
|
||||||
"echarts": "^5.3.2",
|
"echarts": "^5.3.2",
|
||||||
"eslint": "^8.12.0",
|
"eslint": "9.15.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "9.1.0",
|
||||||
"eslint-plugin-import": "^2.26.0",
|
"eslint-plugin-vue": "9.31.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
|
||||||
"eslint-plugin-vue": "^8.5.0",
|
|
||||||
"husky": "^8.0.1",
|
"husky": "^8.0.1",
|
||||||
"lodash": "~4.17.21",
|
"lodash": "~4.17.21",
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
|
"npm-run-all2": "7.0.1",
|
||||||
"plop": "^3.0.5",
|
"plop": "^3.0.5",
|
||||||
"prettier": "^2.6.2",
|
"prettier": "3.3.3",
|
||||||
"sass": "^1.49.11",
|
"sass-embedded": "1.81.0",
|
||||||
"sass-loader": "^12.6.0",
|
"typescript": "5.6.3",
|
||||||
"typescript": "4.6.3",
|
"vite": "5.4.11",
|
||||||
"vite": "4.3.6",
|
"vite-plugin-compression2": "1.3.1",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
|
||||||
"vite-plugin-importer": "^0.2.5",
|
"vite-plugin-importer": "^0.2.5",
|
||||||
"vite-plugin-mock": "^2.9.6",
|
"vite-plugin-mock": "3.0.2",
|
||||||
"vite-plugin-monaco-editor": "^1.1.0",
|
"vite-plugin-monaco-editor": "^1.1.0",
|
||||||
"vue-echarts": "^6.0.2",
|
"vue-echarts": "^6.0.2",
|
||||||
"vue-tsc": "^0.28.10"
|
"vue-tsc": "2.1.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3585
pnpm-lock.yaml
generated
3585
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,12 @@
|
|||||||
module.exports = {
|
export default {
|
||||||
printWidth: 120,
|
printWidth: 120,
|
||||||
tabWidth: 2,
|
tabWidth: 2,
|
||||||
useTabs: false,
|
useTabs: false,
|
||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
semi: false,
|
semi: false,
|
||||||
trailingComma: "none",
|
trailingComma: 'none',
|
||||||
bracketSpacing: true,
|
bracketSpacing: true,
|
||||||
jsxSingleQuote: true,
|
jsxSingleQuote: true,
|
||||||
jsxBracketSameLine: false,
|
jsxBracketSameLine: false,
|
||||||
arrowParens: "avoid"
|
arrowParens: 'avoid'
|
||||||
}
|
}
|
||||||
|
14
tsconfig.app.json
Normal file
14
tsconfig.app.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||||
|
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "types/**/*"],
|
||||||
|
"exclude": ["src/**/__tests__/*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +1,11 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"files": [],
|
||||||
"target": "esnext",
|
"references": [
|
||||||
"module": "esnext",
|
{
|
||||||
"moduleResolution": "node",
|
"path": "./tsconfig.node.json"
|
||||||
"strict": true,
|
|
||||||
"jsx": "preserve",
|
|
||||||
"baseUrl": ".",
|
|
||||||
"sourceMap": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"lib": ["es6", "ESNext", "dom"],
|
|
||||||
"types": ["vite/client"],
|
|
||||||
"paths": {
|
|
||||||
"@/*": ["src/*"],
|
|
||||||
"/#/*": ["types/*"]
|
|
||||||
},
|
},
|
||||||
"noImplicitAny": true, //不允许使用any
|
{
|
||||||
// "strictNullChecks": true, //不允许使用null
|
"path": "./tsconfig.app.json"
|
||||||
"noImplicitThis": true //不允许往this上面挂属性
|
}
|
||||||
},
|
]
|
||||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "types/**/*"],
|
|
||||||
"exclude": ["node_modules", "dist", "**/*.js"]
|
|
||||||
}
|
}
|
||||||
|
13
tsconfig.node.json
Normal file
13
tsconfig.node.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": "@tsconfig/node22/tsconfig.json",
|
||||||
|
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "nightwatch.conf.*", "playwright.config.*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Bundler",
|
||||||
|
"types": ["node"]
|
||||||
|
}
|
||||||
|
}
|
@ -2,33 +2,22 @@ import { defineConfig } from 'vite'
|
|||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
import { OUTPUT_DIR, brotliSize, chunkSizeWarningLimit, terserOptions, rollupOptions } from './build/constant'
|
import { OUTPUT_DIR, brotliSize, chunkSizeWarningLimit, terserOptions, rollupOptions } from './build/constant'
|
||||||
import viteCompression from 'vite-plugin-compression'
|
import { compression } from 'vite-plugin-compression2'
|
||||||
import { viteMockServe } from 'vite-plugin-mock'
|
import { viteMockServe } from 'vite-plugin-mock'
|
||||||
import monacoEditorPlugin from 'vite-plugin-monaco-editor'
|
import monacoEditorPlugin from 'vite-plugin-monaco-editor'
|
||||||
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
function pathResolve(dir: string) {
|
function pathResolve(dir: string) {
|
||||||
return resolve(process.cwd(), '.', dir)
|
return resolve(process.cwd(), '.', dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: '/',
|
base: process.env.NODE_ENV === 'production' ? './' : '/',
|
||||||
// 路径重定向
|
// 路径重定向
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: [
|
alias: {
|
||||||
{
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
find: /\/#\//,
|
}
|
||||||
replacement: pathResolve('types')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: '@',
|
|
||||||
replacement: pathResolve('src')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: 'vue-i18n',
|
|
||||||
replacement: 'vue-i18n/dist/vue-i18n.cjs.js' //解决i8n警告
|
|
||||||
}
|
|
||||||
],
|
|
||||||
dedupe: ['vue']
|
|
||||||
},
|
},
|
||||||
// 全局 css 注册
|
// 全局 css 注册
|
||||||
css: {
|
css: {
|
||||||
@ -48,7 +37,9 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
monacoEditorPlugin({
|
// monacoEditorPlugin Not is ES Module
|
||||||
|
// @ts-expect-error
|
||||||
|
monacoEditorPlugin.default({
|
||||||
languageWorkers: ['editorWorkerService', 'typescript', 'json', 'html']
|
languageWorkers: ['editorWorkerService', 'typescript', 'json', 'html']
|
||||||
}),
|
}),
|
||||||
viteMockServe({
|
viteMockServe({
|
||||||
@ -63,13 +54,7 @@ export default defineConfig({
|
|||||||
watchFiles: true
|
watchFiles: true
|
||||||
}),
|
}),
|
||||||
// 压缩
|
// 压缩
|
||||||
viteCompression({
|
compression({})
|
||||||
verbose: true,
|
|
||||||
disable: false,
|
|
||||||
threshold: 10240,
|
|
||||||
algorithm: 'gzip',
|
|
||||||
ext: '.gz'
|
|
||||||
})
|
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
target: 'es2015',
|
target: 'es2015',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user