Compare commits

...

2 Commits

Author SHA1 Message Date
xiaoxian521
1daeea0cbb Merge branch 'main' into refactor/tailwindcss 2025-04-09 07:32:08 +08:00
xiaoxian521
583feae7b7 chore: 更新eslint相关依赖并作兼容处理 2025-04-09 05:49:15 +08:00
23 changed files with 806 additions and 830 deletions

View File

@ -1,11 +1,10 @@
import js from "@eslint/js"; import js from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue"; import pluginVue from "eslint-plugin-vue";
import * as parserVue from "vue-eslint-parser"; import * as parserVue from "vue-eslint-parser";
import configPrettier from "eslint-config-prettier"; import configPrettier from "eslint-config-prettier";
import pluginPrettier from "eslint-plugin-prettier"; import pluginPrettier from "eslint-plugin-prettier";
import { defineConfig, globalIgnores } from "eslint/config"; import { defineConfig, globalIgnores } from "eslint/config";
import * as parserTypeScript from "@typescript-eslint/parser";
import pluginTypeScript from "@typescript-eslint/eslint-plugin";
export default defineConfig([ export default defineConfig([
globalIgnores([ globalIgnores([
@ -20,7 +19,7 @@ export default defineConfig([
...js.configs.recommended, ...js.configs.recommended,
languageOptions: { languageOptions: {
globals: { globals: {
// index.d.ts // types/index.d.ts
RefType: "readonly", RefType: "readonly",
EmitType: "readonly", EmitType: "readonly",
TargetContext: "readonly", TargetContext: "readonly",
@ -73,21 +72,10 @@ export default defineConfig([
] ]
} }
}, },
{ ...tseslint.config({
extends: [...tseslint.configs.recommended],
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"], files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
languageOptions: {
parser: parserTypeScript,
parserOptions: {
sourceType: "module",
warnOnUnsupportedTypeScriptVersion: false
}
},
plugins: {
"@typescript-eslint": pluginTypeScript
},
rules: { rules: {
...pluginTypeScript.configs.strict.rules,
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-redeclare": "error", "@typescript-eslint/no-redeclare": "error",
"@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
@ -114,20 +102,20 @@ export default defineConfig([
} }
] ]
} }
}, }),
{ {
files: ["**/*.d.ts"], files: ["**/*.d.ts"],
rules: { rules: {
"eslint-comments/no-unlimited-disable": "off", "eslint-comments/no-unlimited-disable": "off",
"import/no-duplicates": "off", "import/no-duplicates": "off",
"no-restricted-syntax": "off",
"unused-imports/no-unused-vars": "off" "unused-imports/no-unused-vars": "off"
} }
}, },
{ {
files: ["**/*.?([cm])js"], files: ["**/*.?([cm])js"],
rules: { rules: {
"@typescript-eslint/no-require-imports": "off", "@typescript-eslint/no-require-imports": "off"
"@typescript-eslint/no-var-requires": "off"
} }
}, },
{ {
@ -148,18 +136,19 @@ export default defineConfig([
jsx: true jsx: true
}, },
extraFileExtensions: [".vue"], extraFileExtensions: [".vue"],
parser: "@typescript-eslint/parser", parser: tseslint.parser,
sourceType: "module" sourceType: "module"
} }
}, },
plugins: { plugins: {
"@typescript-eslint": tseslint.plugin,
vue: pluginVue vue: pluginVue
}, },
processor: pluginVue.processors[".vue"], processor: pluginVue.processors[".vue"],
rules: { rules: {
...pluginVue.configs.base.rules, ...pluginVue.configs.base.rules,
...pluginVue.configs["vue3-essential"].rules, ...pluginVue.configs.essential.rules,
...pluginVue.configs["vue3-recommended"].rules, ...pluginVue.configs.recommended.rules,
"no-undef": "off", "no-undef": "off",
"no-unused-vars": "off", "no-unused-vars": "off",
"vue/no-v-html": "off", "vue/no-v-html": "off",

View File

@ -25,7 +25,7 @@ export default defineFakeRoute([
url: "/mine-logs", url: "/mine-logs",
method: "get", method: "get",
response: () => { response: () => {
let list = [ const list = [
{ {
id: 1, id: 1,
ip: faker.internet.ipv4(), ip: faker.internet.ipv4(),

View File

@ -117,7 +117,7 @@
"@commitlint/cli": "^19.8.0", "@commitlint/cli": "^19.8.0",
"@commitlint/config-conventional": "^19.8.0", "@commitlint/config-conventional": "^19.8.0",
"@commitlint/types": "^19.8.0", "@commitlint/types": "^19.8.0",
"@eslint/js": "^9.23.0", "@eslint/js": "^9.24.0",
"@faker-js/faker": "^9.6.0", "@faker-js/faker": "^9.6.0",
"@iconify/json": "^2.2.321", "@iconify/json": "^2.2.321",
"@iconify/vue": "4.2.0", "@iconify/vue": "4.2.0",
@ -133,18 +133,16 @@
"@types/qrcode": "^1.5.5", "@types/qrcode": "^1.5.5",
"@types/qs": "^6.9.18", "@types/qs": "^6.9.18",
"@types/sortablejs": "^1.15.8", "@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^8.28.0",
"@typescript-eslint/parser": "^8.28.0",
"@vitejs/plugin-vue": "^5.2.3", "@vitejs/plugin-vue": "^5.2.3",
"@vitejs/plugin-vue-jsx": "^4.1.2", "@vitejs/plugin-vue-jsx": "^4.1.2",
"boxen": "^8.0.1", "boxen": "^8.0.1",
"code-inspector-plugin": "^0.20.7", "code-inspector-plugin": "^0.20.7",
"cssnano": "^7.0.6", "cssnano": "^7.0.6",
"dagre": "^0.8.5", "dagre": "^0.8.5",
"eslint": "^9.23.0", "eslint": "^9.24.0",
"eslint-config-prettier": "^10.1.1", "eslint-config-prettier": "^10.1.1",
"eslint-plugin-prettier": "^5.2.5", "eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-vue": "^9.33.0", "eslint-plugin-vue": "^10.0.0",
"gradient-string": "^3.0.0", "gradient-string": "^3.0.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"lint-staged": "^15.5.0", "lint-staged": "^15.5.0",
@ -164,6 +162,7 @@
"svgo": "^3.3.2", "svgo": "^3.3.2",
"tailwindcss": "^4.1.3", "tailwindcss": "^4.1.3",
"typescript": "^5.8.2", "typescript": "^5.8.2",
"typescript-eslint": "^8.29.1",
"unplugin-icons": "^22.1.0", "unplugin-icons": "^22.1.0",
"vite": "^6.2.3", "vite": "^6.2.3",
"vite-plugin-cdn-import": "^1.0.1", "vite-plugin-cdn-import": "^1.0.1",
@ -172,7 +171,7 @@
"vite-plugin-remove-console": "^2.2.0", "vite-plugin-remove-console": "^2.2.0",
"vite-plugin-router-warn": "^1.0.0", "vite-plugin-router-warn": "^1.0.0",
"vite-svg-loader": "^5.1.0", "vite-svg-loader": "^5.1.0",
"vue-eslint-parser": "^9.4.3", "vue-eslint-parser": "^10.1.3",
"vue-tsc": "^2.2.8" "vue-tsc": "^2.2.8"
}, },
"engines": { "engines": {
@ -194,11 +193,6 @@
"abab": "*", "abab": "*",
"glob": "*" "glob": "*"
}, },
"peerDependencyRules": {
"allowedVersions": {
"eslint": "9"
}
},
"onlyBuiltDependencies": [ "onlyBuiltDependencies": [
"@parcel/watcher", "@parcel/watcher",
"core-js", "core-js",

1538
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ import { ref, unref, onMounted } from "vue";
import { LogicFlow } from "@logicflow/core"; import { LogicFlow } from "@logicflow/core";
interface Props { interface Props {
lf: LogicFlow; lf?: LogicFlow;
catTurboData?: boolean; catTurboData?: boolean;
} }

View File

@ -9,8 +9,8 @@ type nodeListType = {
}; };
interface Props { interface Props {
lf: LogicFlow; lf?: LogicFlow;
nodeList: Array<nodeListType>; nodeList?: Array<nodeListType>;
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {

View File

@ -60,12 +60,15 @@ export function copyObj() {
copyIsArray, copyIsArray,
clone, clone,
i = 1, i = 1,
// eslint-disable-next-line prefer-rest-params
target = arguments[0] || {}, // 使用||运算符排除隐式强制类型转换为false的数据类型 target = arguments[0] || {}, // 使用||运算符排除隐式强制类型转换为false的数据类型
deep = false, deep = false,
// eslint-disable-next-line prefer-const
len = arguments.length; len = arguments.length;
if (typeof target === "boolean") { if (typeof target === "boolean") {
deep = target; deep = target;
// eslint-disable-next-line prefer-rest-params
target = arguments[1] || {}; target = arguments[1] || {};
i++; i++;
} }
@ -79,6 +82,7 @@ export function copyObj() {
for (; i < len; i++) { for (; i < len; i++) {
//所以如果源对象中数据类型为Undefined或Null那么就会跳过本次循环接着循环下一个源对象 //所以如果源对象中数据类型为Undefined或Null那么就会跳过本次循环接着循环下一个源对象
// eslint-disable-next-line prefer-rest-params
if ((options = arguments[i]) != null) { if ((options = arguments[i]) != null) {
// 如果遇到源对象的数据类型为Boolean, Number for in循环会被跳过不执行for in循环// src用于判断target对象是否存在name属性 // 如果遇到源对象的数据类型为Boolean, Number for in循环会被跳过不执行for in循环// src用于判断target对象是否存在name属性
for (name in options) { for (name in options) {

View File

@ -32,8 +32,8 @@ const calculate = (
const offset = el.getBoundingClientRect(); const offset = el.getBoundingClientRect();
// 获取点击位置距离 el 的垂直和水平距离 // 获取点击位置距离 el 的垂直和水平距离
let localX = e.clientX - offset.left; const localX = e.clientX - offset.left;
let localY = e.clientY - offset.top; const localY = e.clientY - offset.top;
let radius = 0; let radius = 0;
let scale = 0.3; let scale = 0.3;

View File

@ -6,7 +6,7 @@ import EnterOutlined from "@/assets/svg/enter_outlined.svg?component";
import ArrowUpLine from "~icons/ri/arrow-up-line"; import ArrowUpLine from "~icons/ri/arrow-up-line";
import ArrowDownLine from "~icons/ri/arrow-down-line"; import ArrowDownLine from "~icons/ri/arrow-down-line";
withDefaults(defineProps<{ total: number }>(), { withDefaults(defineProps<{ total?: number }>(), {
total: 0 total: 0
}); });

View File

@ -7,7 +7,7 @@ import { useNav } from "@/layout/hooks/useNav";
import ArrowLeft from "~icons/ri/arrow-left-double-fill"; import ArrowLeft from "~icons/ri/arrow-left-double-fill";
interface Props { interface Props {
isActive: boolean; isActive?: boolean;
} }
withDefaults(defineProps<Props>(), { withDefaults(defineProps<Props>(), {

View File

@ -7,7 +7,7 @@ import { useNav } from "@/layout/hooks/useNav";
import MenuFold from "~icons/ri/menu-fold-fill"; import MenuFold from "~icons/ri/menu-fold-fill";
interface Props { interface Props {
isActive: boolean; isActive?: boolean;
} }
withDefaults(defineProps<Props>(), { withDefaults(defineProps<Props>(), {

View File

@ -4,7 +4,7 @@ import MenuFold from "~icons/ri/menu-fold-fill";
import MenuUnfold from "~icons/ri/menu-unfold-fill"; import MenuUnfold from "~icons/ri/menu-unfold-fill";
interface Props { interface Props {
isActive: boolean; isActive?: boolean;
} }
withDefaults(defineProps<Props>(), { withDefaults(defineProps<Props>(), {

View File

@ -10,7 +10,7 @@ import zhLocale from "element-plus/es/locale/lang/zh-cn";
const siphonI18n = (function () { const siphonI18n = (function () {
// 仅初始化一次国际化配置 // 仅初始化一次国际化配置
let cache = Object.fromEntries( const cache = Object.fromEntries(
Object.entries( Object.entries(
import.meta.glob("../../locales/*.y(a)?ml", { eager: true }) import.meta.glob("../../locales/*.y(a)?ml", { eager: true })
).map(([key, value]: any) => { ).map(([key, value]: any) => {

View File

@ -140,8 +140,10 @@ Print.prototype = {
"position:absolute;width:0;height:0;top:-10px;left:-10px;" "position:absolute;width:0;height:0;top:-10px;left:-10px;"
); );
// eslint-disable-next-line prefer-const
w = f.contentWindow || f.contentDocument; w = f.contentWindow || f.contentDocument;
// eslint-disable-next-line prefer-const
doc = f.contentDocument || f.contentWindow.document; doc = f.contentDocument || f.contentWindow.document;
doc.open(); doc.open();
doc.write(content); doc.write(content);

View File

@ -3,7 +3,7 @@ import { ref } from "vue";
// props // props
export interface FormProps { export interface FormProps {
formInline: { formInline?: {
user: string; user: string;
region: string; region: string;
}; };

View File

@ -3,7 +3,7 @@ import { useVModel } from "@vueuse/core";
// props // props
export interface FormProps { export interface FormProps {
data: string; data?: string;
} }
// props // props

View File

@ -3,7 +3,7 @@ import { ref } from "vue";
// props // props
export interface FormProps { export interface FormProps {
formInline: { formInline?: {
user: string; user: string;
region: string; region: string;
}; };

View File

@ -3,7 +3,7 @@ import { useVModel } from "@vueuse/core";
// props // props
export interface FormProps { export interface FormProps {
data: string; data?: string;
} }
// props // props

View File

@ -73,7 +73,7 @@ export function useColumns(selectRef: Ref, formRef: Ref, tableRef: Ref) {
const onSearch = () => { const onSearch = () => {
tableData.value = cloneTableData; tableData.value = cloneTableData;
if (!isAllEmpty(searchForm.sexValue)) { if (!isAllEmpty(searchForm.sexValue)) {
let sex = sexOptions const sex = sexOptions
.map(sex => sex.value === Number(searchForm.sexValue) && sex.label) .map(sex => sex.value === Number(searchForm.sexValue) && sex.label)
.filter(Boolean)[0]; .filter(Boolean)[0];
tableData.value = tableData.value.filter(data => data.sex === sex); tableData.value = tableData.value.filter(data => data.sex === sex);

2
types/index.d.ts vendored
View File

@ -75,8 +75,6 @@ interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
$el: T; $el: T;
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function parseInt(s: string | number, radix?: number): number; function parseInt(s: string | number, radix?: number): number;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function parseFloat(string: string | number): number; function parseFloat(string: string | number): number;

2
types/router.d.ts vendored
View File

@ -104,6 +104,6 @@ declare global {
// https://router.vuejs.org/zh/guide/advanced/meta.html#typescript // https://router.vuejs.org/zh/guide/advanced/meta.html#typescript
declare module "vue-router" { declare module "vue-router" {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type // eslint-disable-next-line
interface RouteMeta extends CustomizeRouteMeta {} interface RouteMeta extends CustomizeRouteMeta {}
} }

View File

@ -1,4 +1,4 @@
import Vue, { VNode } from "vue"; import type Vue, { type VNode } from "vue";
declare module "*.tsx" { declare module "*.tsx" {
import Vue from "compatible-vue"; import Vue from "compatible-vue";
@ -7,7 +7,9 @@ declare module "*.tsx" {
declare global { declare global {
namespace JSX { namespace JSX {
// eslint-disable-next-line
interface Element extends VNode {} interface Element extends VNode {}
// eslint-disable-next-line
interface ElementClass extends Vue {} interface ElementClass extends Vue {}
interface ElementAttributesProperty { interface ElementAttributesProperty {
$props: any; $props: any;

View File

@ -1,5 +1,6 @@
declare module "*.vue" { declare module "*.vue" {
import type { DefineComponent } from "vue"; import type { DefineComponent } from "vue";
// eslint-disable-next-line
const component: DefineComponent<{}, {}, any>; const component: DefineComponent<{}, {}, any>;
export default component; export default component;
} }