From 1df154eb7a58f47a1522a76d653807b24f0f85ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlie=20Wang=20=E2=9C=A8?= <18888351756@163.com> Date: Mon, 23 Oct 2023 22:03:29 +0800 Subject: [PATCH] chore(deps): :arrow_up: upgrade deps (#42) * chore(deps): :arrow_up: upgrade deps * chore: update tsconfig.json --- .eslintrc | 10 - .vscode/settings.json | 38 +- auto-imports.d.ts | 12 +- build/mock/createMockServer.js | 9 +- build/mock/getMockData.js | 4 +- build/mock/registerBabel.js | 6 +- components.d.ts | 10 +- eslint.config.js | 3 + package.json | 74 +- plop-templates/component/prompt.js | 15 +- plop-templates/view/prompt.js | 15 +- plopfile.js | 1 + pnpm-lock.yaml | 4673 +++++++++++++++------------- scripts/verifyCommit.js | 7 +- src/App.vue | 6 +- src/components/chart/index.vue | 6 +- src/env.d.ts | 9 +- src/router/index.ts | 2 + src/typing.ts | 1 + src/utils/hooks/useFetchData.ts | 40 +- src/utils/request.ts | 7 +- src/views/charts/index.vue | 3 +- src/views/index.vue | 22 +- src/views/mock/index.vue | 14 +- tests/index.spec.ts | 3 +- tsconfig.json | 28 +- vite.config.ts | 11 +- 27 files changed, 2765 insertions(+), 2264 deletions(-) delete mode 100644 .eslintrc create mode 100644 eslint.config.js diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 98b5fd0..0000000 --- a/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": [ - "@antfu" - ], - - "rules": { - "brace-style": "off", - "@typescript-eslint/brace-style": "off" - } -} diff --git a/.vscode/settings.json b/.vscode/settings.json index cb0d092..c5632ba 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,41 @@ { + // Enable the ESlint flat config support + "eslint.experimental.useFlatConfig": true, + + // Disable the default formatter, use eslint instead "prettier.enable": false, "editor.formatOnSave": false, + + // Auto fix "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - } + "source.fixAll": "explicit", + "source.organizeImports": "never" + }, + + // Silent the stylistic rules in you IDE, but still auto fix them + "eslint.rules.customizations": [ + { "rule": "style/*", "severity": "off" }, + { "rule": "*-indent", "severity": "off" }, + { "rule": "*-spacing", "severity": "off" }, + { "rule": "*-spaces", "severity": "off" }, + { "rule": "*-order", "severity": "off" }, + { "rule": "*-dangle", "severity": "off" }, + { "rule": "*-newline", "severity": "off" }, + { "rule": "*quotes", "severity": "off" }, + { "rule": "*semi", "severity": "off" } + ], + + // Enable eslint for all supported languages + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "html", + "markdown", + "json", + "jsonc", + "yaml" + ] } diff --git a/auto-imports.d.ts b/auto-imports.d.ts index 0e4364a..5c96619 100644 --- a/auto-imports.d.ts +++ b/auto-imports.d.ts @@ -1,4 +1,8 @@ -// Generated by 'unplugin-auto-import' +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] @@ -56,6 +60,7 @@ declare global { const toRaw: typeof import('vue')['toRaw'] const toRef: typeof import('vue')['toRef'] const toRefs: typeof import('vue')['toRefs'] + const toValue: typeof import('vue')['toValue'] const triggerRef: typeof import('vue')['triggerRef'] const unref: typeof import('vue')['unref'] const useAttrs: typeof import('vue')['useAttrs'] @@ -72,3 +77,8 @@ declare global { const watchPostEffect: typeof import('vue')['watchPostEffect'] const watchSyncEffect: typeof import('vue')['watchSyncEffect'] } +// for type re-export +declare global { + // @ts-ignore + export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' +} diff --git a/build/mock/createMockServer.js b/build/mock/createMockServer.js index b3bcea9..be82bdd 100644 --- a/build/mock/createMockServer.js +++ b/build/mock/createMockServer.js @@ -1,11 +1,13 @@ -const { join } = require('path') -const url = require('url') +/* eslint-disable node/prefer-global/process */ +const { join } = require('node:path') +const url = require('node:url') const chokidar = require('chokidar') const signale = require('signale') const { match } = require('path-to-regexp') const { initMock, getMatchMock } = require('./getMockData') const { winPath } = require('./utils') const { configBabelRegister } = require('./registerBabel') + let watcher function getPaths(cwd) { const winCwd = winPath(cwd) @@ -95,7 +97,8 @@ module.exports = function (opts) { let queryParams = {} if (req.url) - // eslint-disable-next-line n/no-deprecated-api + + // eslint-disable-next-line node/no-deprecated-api queryParams = url.parse(req.url, true) const reqUrl = queryParams.pathname diff --git a/build/mock/getMockData.js b/build/mock/getMockData.js index 17445a4..553304f 100644 --- a/build/mock/getMockData.js +++ b/build/mock/getMockData.js @@ -1,9 +1,11 @@ -const path = require('path') +const path = require('node:path') const glob = require('glob') const { pathToRegexp } = require('path-to-regexp') const signale = require('signale') const { winPath } = require('./utils') + let _mockconfig = {} +// eslint-disable-next-line node/prefer-global/process const cwd = process.cwd() let mockList = [] // 获取mock文件列表 diff --git a/build/mock/registerBabel.js b/build/mock/registerBabel.js index c91c6b2..47217ab 100644 --- a/build/mock/registerBabel.js +++ b/build/mock/registerBabel.js @@ -1,6 +1,8 @@ -const { join, isAbsolute } = require('path') -const { existsSync } = require('fs') +/* eslint-disable node/prefer-global/process */ +const { join, isAbsolute } = require('node:path') +const { existsSync } = require('node:fs') const { winPath } = require('./utils') + let files = null function initFiles(cwd) { diff --git a/components.d.ts b/components.d.ts index 23dd6d2..502a166 100644 --- a/components.d.ts +++ b/components.d.ts @@ -1,11 +1,11 @@ -// generated by unplugin-vue-components -// We suggest you to commit this file into source control +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 -import '@vue/runtime-core' - export {} -declare module '@vue/runtime-core' { +declare module 'vue' { export interface GlobalComponents { Chart: typeof import('./src/components/chart/index.vue')['default'] VanButton: typeof import('vant/es')['Button'] diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..c5226d0 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +const antfu = require('@antfu/eslint-config').default + +module.exports = antfu() diff --git a/package.json b/package.json index 873b23d..81069ef 100644 --- a/package.json +++ b/package.json @@ -17,59 +17,59 @@ }, "dependencies": { "@vant/touch-emulator": "^1.4.0", - "@vant/use": "^1.5.1", - "axios": "^1.4.0", - "echarts": "^5.4.2", + "@vant/use": "^1.6.0", + "axios": "^1.5.1", + "echarts": "^5.4.3", "lodash-es": "^4.17.21", "nprogress": "^0.2.0", - "pinia": "^2.1.3", - "pinia-plugin-persistedstate": "^3.1.0", + "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^3.2.0", "resize-detector": "^0.3.0", "store": "^2.0.12", - "vant": "^4.4.1", + "vant": "^4.7.2", "vconsole": "^3.15.1", - "vue": "^3.3.4", - "vue-router": "^4.2.2", + "vue": "^3.3.6", + "vue-router": "^4.2.5", "vue-router-better-scroller": "^0.0.0" }, "devDependencies": { - "@antfu/eslint-config": "^0.33.1", - "@babel/core": "^7.22.1", - "@babel/preset-env": "^7.22.4", - "@babel/preset-typescript": "^7.21.5", - "@babel/register": "^7.21.0", - "@types/lodash-es": "^4.17.7", - "@types/node": "^18.16.16", - "@types/nprogress": "^0.2.0", - "@types/store": "^2.0.2", - "@vitejs/plugin-legacy": "^3.0.2", - "@vitejs/plugin-vue": "^4.2.3", - "@vitejs/plugin-vue-jsx": "^3.0.1", - "autoprefixer": "^10.4.14", - "babel-plugin-module-resolver": "^4.1.0", + "@antfu/eslint-config": "1.0.0-beta.28", + "@babel/core": "^7.23.2", + "@babel/preset-env": "^7.23.2", + "@babel/preset-typescript": "^7.23.2", + "@babel/register": "^7.22.15", + "@types/lodash-es": "^4.17.10", + "@types/node": "^20.8.7", + "@types/nprogress": "^0.2.2", + "@types/store": "^2.0.4", + "@vitejs/plugin-legacy": "^4.1.1", + "@vitejs/plugin-vue": "^4.4.0", + "@vitejs/plugin-vue-jsx": "^3.0.2", + "autoprefixer": "^10.4.16", + "babel-plugin-module-resolver": "^5.0.0", "commitizen": "^4.3.0", - "consola": "^2.15.3", + "consola": "^3.2.3", "cross-env": "^7.0.3", "cz-emoji-chinese": "^0.3.1", - "eslint": "^8.42.0", + "eslint": "^8.52.0", "husky": "^8.0.3", - "less": "^4.1.3", + "less": "^4.2.0", "mockjs": "^1.1.0", "path-to-regexp": "^6.2.1", - "plop": "^3.1.2", - "postcss-mobile-forever": "^3.3.2", - "rollup": "^3.24.0", - "rollup-plugin-visualizer": "^5.9.0", + "plop": "^4.0.0", + "postcss-mobile-forever": "^4.0.0", + "rollup": "^4.1.4", + "rollup-plugin-visualizer": "^5.9.2", "signale": "^1.4.0", "slash2": "^2.0.0", - "terser": "^5.17.7", - "typescript": "^4.9.5", - "unplugin-auto-import": "^0.12.2", - "unplugin-vue-components": "^0.22.12", - "vite": "^4.3.9", - "vite-plugin-vconsole": "^1.3.1", - "vitest": "^0.25.8", - "vue-tsc": "^1.6.5" + "terser": "^5.22.0", + "typescript": "^5.2.2", + "unplugin-auto-import": "^0.16.6", + "unplugin-vue-components": "^0.25.2", + "vite": "^4.5.0", + "vite-plugin-vconsole": "^2.0.1", + "vitest": "^0.34.6", + "vue-tsc": "^1.8.19" }, "pnpm": { "peerDependencyRules": { diff --git a/plop-templates/component/prompt.js b/plop-templates/component/prompt.js index 70c9f6b..09435c0 100644 --- a/plop-templates/component/prompt.js +++ b/plop-templates/component/prompt.js @@ -7,8 +7,7 @@ module.exports = { name: 'name', message: 'component name please', validate: notEmpty('name'), - }, - { + }, { type: 'checkbox', name: 'blocks', message: 'Blocks:', @@ -16,26 +15,22 @@ module.exports = { name: '