2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 04:22:33 +08:00

feat: update eslint to v9

This commit is contained in:
耗子
2024-11-26 02:18:45 +08:00
parent 7aca6587af
commit 929219e487
10 changed files with 778 additions and 381 deletions

View File

@@ -33,8 +33,6 @@
}
],
"ignoreDeps": [
"eslint",
"@vue/eslint-config-typescript",
"typescript"
]
}

View File

@@ -1,17 +0,0 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')
module.exports = {
root: true,
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting',
'@unocss',
'.eslintrc-auto-import.json'
],
parserOptions: {
ecmaVersion: 'latest'
}
}

View File

@@ -1,7 +1,7 @@
import { DateTime } from 'luxon'
/**
* * 此处定义的是全局常量,启动或打包后将添加到 window 中
* 此处定义的是全局常量,启动或打包后将添加到 window 中
* https://vitejs.cn/config/#define
*/

View File

@@ -1,11 +1,12 @@
import type { PluginOption } from 'vite'
import vue from '@vitejs/plugin-vue'
import unocss from 'unocss/vite'
import vueDevTools from 'vite-plugin-vue-devtools'
import unplugins from './unplugin'
import { setupHtmlPlugin } from './html'
import { setupStaticCopyPlugin } from './copy'
import { setupHtmlPlugin } from './html'
import unplugins from './unplugin'
export function setupVitePlugins(viteEnv: ViteEnv): PluginOption[] {
return [vue(), ...unplugins, unocss(), setupStaticCopyPlugin(), setupHtmlPlugin(viteEnv)]
return [vue(), vueDevTools(), ...unplugins, unocss(), setupStaticCopyPlugin(), setupHtmlPlugin(viteEnv)]
}

38
web/eslint.config.js Normal file
View File

@@ -0,0 +1,38 @@
import { FlatCompat } from '@eslint/eslintrc'
import unocss from '@unocss/eslint-config/flat'
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 'path'
import { fileURLToPath } from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname
})
export default [
...pluginVue.configs['flat/essential'],
...vueTsEslintConfig(),
unocss,
...compat.extends('./.eslintrc-auto-import.json'),
skipFormatting,
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-object-type': 'off'
}
},
{
name: 'app/files-to-ignore',
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**']
}
]

View File

@@ -1,25 +1,26 @@
{
"private": true,
"type": "module",
"repository": {
"url": "https://github.com/TheTNB/panel-frontend"
},
"license": "MIT",
"private": true,
"author": {
"name": "HaoZi Tech",
"email": "admin@haozi.net",
"url": "https://git.haozi.net/org"
},
"license": "MIT",
"repository": {
"url": "https://github.com/TheTNB/panel-frontend"
},
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --fix",
"format": "prettier --write src/"
},
"dependencies": {
"@eslint/eslintrc": "^3.2.0",
"@fontsource-variable/jetbrains-mono": "^5.1.1",
"@guolao/vue-monaco-editor": "^1.5.4",
"@vue-js-cron/naive-ui": "^2.0.9",
@@ -59,10 +60,10 @@
"@unocss/eslint-config": "^0.64.1",
"@vitejs/plugin-vue": "^5.2.0",
"@vue/eslint-config-prettier": "^10.1.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/eslint-config-typescript": "^14.1.3",
"@vue/tsconfig": "^0.6.0",
"colord": "^2.9.3",
"eslint": "^8.57.1",
"eslint": "^9.15.0",
"eslint-plugin-vue": "^9.31.0",
"md-editor-v3": "^5.0.2",
"monaco-editor": "^0.52.0",
@@ -80,6 +81,7 @@
"vite-plugin-html": "^3.2.2",
"vite-plugin-mock": "^3.0.2",
"vite-plugin-static-copy": "^2.1.0",
"vite-plugin-vue-devtools": "^7.6.4",
"vue-tsc": "^2.1.10"
}
}

1028
web/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -82,7 +82,7 @@ export function isEmpty(val: any): boolean {
}
/**
* * 类似mysql的IFNULL函数
* 类似mysql的IFNULL函数
* @description 当第一个参数为null/undefined/'' 则返回第二个参数作为备用值,否则返回第一个参数
*/
export function ifNull(val: any, def: any = '') {
@@ -91,6 +91,6 @@ export function ifNull(val: any, def: any = '') {
export function isUrl(path: string): boolean {
const reg =
/(((^https?:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)$/
/(((^https?:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*(?:#\w*)?)?)$/
return reg.test(path)
}

View File

@@ -1,30 +1,15 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": [
"env.d.ts",
"src/**/*",
"types/**/*.d.ts",
"src/**/*.vue"
],
"exclude": [
"src/**/__tests__/*"
],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"module": "ESNext",
"target": "ESNext",
"lib": [
"DOM",
"ESNext"
],
"strict": true,
"esModuleInterop": true,
"baseUrl": ".",
"module": "ESNext",
"moduleResolution": "node",
"resolveJsonModule": true,
"noUnusedLocals": true,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"~/*": [
"./*"
@@ -33,10 +18,25 @@
"./src/*"
]
},
"resolveJsonModule": true,
"types": [
"node",
"vite/client",
"unplugin-icons/types/vue"
]
}
],
"strict": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
},
"include": [
"env.d.ts",
"src/**/*",
"types/**/*.d.ts",
"src/**/*.vue"
],
"exclude": [
"src/**/__tests__/*"
]
}

View File

@@ -16,6 +16,7 @@
},
"types": [
"node"
]
],
"noEmit": true
}
}