mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 00:02:51 +08:00
fix: 添加lint规则运行脚本,修复lint错误
This commit is contained in:
parent
d4ba828d08
commit
628d66e80e
@ -20,6 +20,10 @@ module.exports = {
|
|||||||
extends: ['plugin:vue/vue3-essential', 'eslint:recommended'],
|
extends: ['plugin:vue/vue3-essential', 'eslint:recommended'],
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
|
'vue/valid-template-root': 'off',
|
||||||
|
'vue/no-mutating-props': 'off'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"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",
|
||||||
|
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx,.vue src --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/color": "^3.0.3",
|
"@types/color": "^3.0.3",
|
||||||
|
@ -87,7 +87,7 @@ export const http = (type?: RequestHttpEnum) => {
|
|||||||
* @param globalParams 全局参数
|
* @param globalParams 全局参数
|
||||||
*/
|
*/
|
||||||
export const customizeHttp = (targetParams: RequestConfigType, globalParams: RequestGlobalConfigType) => {
|
export const customizeHttp = (targetParams: RequestConfigType, globalParams: RequestGlobalConfigType) => {
|
||||||
if(!targetParams || !globalParams) {
|
if (!targetParams || !globalParams) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
|
|||||||
// 处理头部
|
// 处理头部
|
||||||
const headers: RequestParamsObjType = {
|
const headers: RequestParamsObjType = {
|
||||||
...globalRequestParams.Header,
|
...globalRequestParams.Header,
|
||||||
...targetRequestParams.Header,
|
...targetRequestParams.Header
|
||||||
}
|
}
|
||||||
|
|
||||||
// data 参数
|
// data 参数
|
||||||
@ -155,15 +155,16 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
|
|||||||
data = targetRequestParams.Body['xml']
|
data = targetRequestParams.Body['xml']
|
||||||
break
|
break
|
||||||
|
|
||||||
case RequestBodyEnum.X_WWW_FORM_URLENCODED:
|
case RequestBodyEnum.X_WWW_FORM_URLENCODED: {
|
||||||
headers['Content-Type'] = ContentTypeEnum.FORM_URLENCODED
|
headers['Content-Type'] = ContentTypeEnum.FORM_URLENCODED
|
||||||
const bodyFormData = targetRequestParams.Body['x-www-form-urlencoded']
|
const bodyFormData = targetRequestParams.Body['x-www-form-urlencoded']
|
||||||
for (const i in bodyFormData) formData.set(i, bodyFormData[i])
|
for (const i in bodyFormData) formData.set(i, bodyFormData[i])
|
||||||
// FormData 赋值给 data
|
// FormData 赋值给 data
|
||||||
data = formData
|
data = formData
|
||||||
break
|
break
|
||||||
|
}
|
||||||
|
|
||||||
case RequestBodyEnum.FORM_DATA:
|
case RequestBodyEnum.FORM_DATA: {
|
||||||
headers['Content-Type'] = ContentTypeEnum.FORM_DATA
|
headers['Content-Type'] = ContentTypeEnum.FORM_DATA
|
||||||
const bodyFormUrlencoded = targetRequestParams.Body['form-data']
|
const bodyFormUrlencoded = targetRequestParams.Body['form-data']
|
||||||
for (const i in bodyFormUrlencoded) {
|
for (const i in bodyFormUrlencoded) {
|
||||||
@ -173,6 +174,7 @@ export const customizeHttp = (targetParams: RequestConfigType, globalParams: Req
|
|||||||
data = formData
|
data = formData
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sql 处理
|
// sql 处理
|
||||||
if (requestContentType === RequestContentTypeEnum.SQL) {
|
if (requestContentType === RequestContentTypeEnum.SQL) {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<!-- eslint-disable vue/valid-template-root -->
|
||||||
<template></template>
|
<template></template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
<!-- eslint-disable vue/valid-template-root -->
|
||||||
<template></template>
|
<template></template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useDialog } from 'naive-ui';
|
import { useDialog } from 'naive-ui'
|
||||||
//挂载在 window 方便与在js中使用
|
//挂载在 window 方便与在js中使用
|
||||||
window['$dialog'] = useDialog();
|
window['$dialog'] = useDialog()
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
<!-- eslint-disable vue/valid-template-root -->
|
||||||
<template></template>
|
<template></template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
<!-- eslint-disable vue/valid-template-root -->
|
||||||
<template></template>
|
<template></template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useMessage } from 'naive-ui';
|
import { useMessage } from 'naive-ui'
|
||||||
//挂载在 window 方便与在js中使用
|
//挂载在 window 方便与在js中使用
|
||||||
window['$message'] = useMessage();
|
window['$message'] = useMessage()
|
||||||
</script>
|
</script>
|
||||||
|
@ -88,6 +88,7 @@ export const useChartDataFetch = (
|
|||||||
// 开启轮询
|
// 开启轮询
|
||||||
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
if (time) fetchInterval = setInterval(fetchFn, intervalUnitHandle(time, unit))
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-empty
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,38 +1,40 @@
|
|||||||
import type { RouteRecordRaw, RouteMeta } from 'vue-router';
|
import type { RouteRecordRaw, RouteMeta } from 'vue-router'
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue'
|
||||||
|
|
||||||
|
declare type Recordable<T = any> = Record<string, T>
|
||||||
|
|
||||||
export type Component<T extends any = any> =
|
export type Component<T extends any = any> =
|
||||||
| ReturnType<typeof defineComponent>
|
| ReturnType<typeof defineComponent>
|
||||||
| (() => Promise<typeof import('*.vue')>)
|
| (() => Promise<typeof import('*.vue')>)
|
||||||
| (() => Promise<T>);
|
| (() => Promise<T>)
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
|
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
|
||||||
name: string;
|
name: string
|
||||||
meta: RouteMeta;
|
meta: RouteMeta
|
||||||
component?: Component | string;
|
component?: Component | string
|
||||||
components?: Component;
|
components?: Component
|
||||||
children?: AppRouteRecordRaw[];
|
children?: AppRouteRecordRaw[]
|
||||||
props?: Recordable;
|
props?: Recordable
|
||||||
fullPath?: string;
|
fullPath?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Meta {
|
export interface Meta {
|
||||||
// 名称
|
// 名称
|
||||||
title: string;
|
title: string
|
||||||
// 是否忽略权限
|
// 是否忽略权限
|
||||||
ignoreAuth?: boolean;
|
ignoreAuth?: boolean
|
||||||
permissions?: string[];
|
permissions?: string[]
|
||||||
// 是否不缓存
|
// 是否不缓存
|
||||||
noKeepAlive?: boolean;
|
noKeepAlive?: boolean
|
||||||
// 是否固定在tab上
|
// 是否固定在tab上
|
||||||
affix?: boolean;
|
affix?: boolean
|
||||||
// tab上的图标
|
// tab上的图标
|
||||||
icon?: string;
|
icon?: string
|
||||||
// 跳转地址
|
// 跳转地址
|
||||||
frameSrc?: string;
|
frameSrc?: string
|
||||||
// 外链跳转地址
|
// 外链跳转地址
|
||||||
externalLink?: string;
|
externalLink?: string
|
||||||
//隐藏
|
//隐藏
|
||||||
hidden?: boolean;
|
hidden?: boolean
|
||||||
}
|
}
|
@ -93,6 +93,7 @@ export interface EditCanvasConfigType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 坐标轴信息
|
// 坐标轴信息
|
||||||
|
// eslint-disable-next-line no-redeclare
|
||||||
export enum EditCanvasTypeEnum {
|
export enum EditCanvasTypeEnum {
|
||||||
START_X = 'startX',
|
START_X = 'startX',
|
||||||
START_Y = 'startY',
|
START_Y = 'startY',
|
||||||
|
@ -600,7 +600,7 @@ export const useChartEditStore = defineStore({
|
|||||||
ids.push(item.id)
|
ids.push(item.id)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
;(historyData[0] as CreateComponentGroupType).groupList.forEach(item => {
|
(historyData[0] as CreateComponentGroupType).groupList.forEach(item => {
|
||||||
ids.push(item.id)
|
ids.push(item.id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* * 存储本地会话数据
|
* * 存储本地会话数据
|
||||||
* @param k 键名
|
* @param k 键名
|
||||||
* @param v 键值(无需stringiiy)
|
* @param v 键值(无需stringiiy)
|
||||||
* @returns RemovableRef
|
* @returns RemovableRef
|
||||||
*/
|
*/
|
||||||
export const setLocalStorage = <T>(k: string, v: T) => {
|
export const setLocalStorage = <T>(k: string, v: T) => {
|
||||||
try {
|
try {
|
||||||
window.localStorage.setItem(k, JSON.stringify(v))
|
window.localStorage.setItem(k, JSON.stringify(v))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -18,7 +17,7 @@
|
|||||||
* @param k 键名
|
* @param k 键名
|
||||||
* @returns any
|
* @returns any
|
||||||
*/
|
*/
|
||||||
export const getLocalStorage = (k: string) => {
|
export const getLocalStorage = (k: string) => {
|
||||||
const item = window.localStorage.getItem(k)
|
const item = window.localStorage.getItem(k)
|
||||||
try {
|
try {
|
||||||
return item ? JSON.parse(item) : item
|
return item ? JSON.parse(item) : item
|
||||||
@ -31,7 +30,7 @@
|
|||||||
* * 清除本地会话数据
|
* * 清除本地会话数据
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
export const clearLocalStorage = (name: string) => {
|
export const clearLocalStorage = (name: string) => {
|
||||||
window.localStorage.removeItem(name)
|
window.localStorage.removeItem(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,11 +135,13 @@ export const fileTobase64 = (file: File, callback: Function) => {
|
|||||||
/**
|
/**
|
||||||
* * 挂载监听
|
* * 挂载监听
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
export const addEventListener = <K extends keyof WindowEventMap>(
|
export const addEventListener = <K extends keyof WindowEventMap>(
|
||||||
target: HTMLElement | Document,
|
target: HTMLElement | Document,
|
||||||
type: K,
|
type: K,
|
||||||
listener: any,
|
listener: any,
|
||||||
delay?: number,
|
delay?: number,
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
options?: boolean | AddEventListenerOptions | undefined
|
options?: boolean | AddEventListenerOptions | undefined
|
||||||
) => {
|
) => {
|
||||||
if (!target) return
|
if (!target) return
|
||||||
@ -156,6 +158,7 @@ export const addEventListener = <K extends keyof WindowEventMap>(
|
|||||||
/**
|
/**
|
||||||
* * 卸载监听
|
* * 卸载监听
|
||||||
*/
|
*/
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
export const removeEventListener = <K extends keyof WindowEventMap>(
|
export const removeEventListener = <K extends keyof WindowEventMap>(
|
||||||
target: HTMLElement | Document,
|
target: HTMLElement | Document,
|
||||||
type: K,
|
type: K,
|
||||||
@ -249,7 +252,7 @@ export const intervalUnitHandle = (num: number, unit: RequestHttpIntervalEnum) =
|
|||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
export const objToCookie = (obj: RequestParamsObjType) => {
|
export const objToCookie = (obj: RequestParamsObjType) => {
|
||||||
if(!obj) return ''
|
if (!obj) return ''
|
||||||
|
|
||||||
let str = ''
|
let str = ''
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
|
@ -24,14 +24,12 @@ import { ConfigType } from '@/packages/index.d'
|
|||||||
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
||||||
import { loadAsyncComponent } from '@/utils'
|
import { loadAsyncComponent } from '@/utils'
|
||||||
|
|
||||||
const ChartsItemBox = loadAsyncComponent(() =>
|
const ChartsItemBox = loadAsyncComponent(() => import('../ChartsItemBox/index.vue'))
|
||||||
import('../ChartsItemBox/index.vue')
|
|
||||||
)
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
selectOptions: {
|
selectOptions: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => []
|
default: () => {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -138,9 +138,11 @@ const filterRes = computed(() => {
|
|||||||
try {
|
try {
|
||||||
const fn = new Function('data', filter.value)
|
const fn = new Function('data', filter.value)
|
||||||
const res = fn(cloneDeep(sourceData.value))
|
const res = fn(cloneDeep(sourceData.value))
|
||||||
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
errorFlag.value = false
|
errorFlag.value = false
|
||||||
return toString(res)
|
return toString(res)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
errorFlag.value = true
|
errorFlag.value = true
|
||||||
return '过滤函数错误'
|
return '过滤函数错误'
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,7 @@ const selectTarget = computed(() => {
|
|||||||
if (selectId.length !== 1) return undefined
|
if (selectId.length !== 1) return undefined
|
||||||
const target = chartEditStore.componentList[chartEditStore.fetchTargetIndex()]
|
const target = chartEditStore.componentList[chartEditStore.fetchTargetIndex()]
|
||||||
if (target?.isGroup) {
|
if (target?.isGroup) {
|
||||||
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
tabsSelect.value = TabsEnum.CHART_SETTING
|
tabsSelect.value = TabsEnum.CHART_SETTING
|
||||||
}
|
}
|
||||||
return target
|
return target
|
||||||
|
@ -50,16 +50,16 @@ const fetchProhectInfoById = () => {
|
|||||||
|
|
||||||
const title = ref<string>(fetchProhectInfoById() || '')
|
const title = ref<string>(fetchProhectInfoById() || '')
|
||||||
|
|
||||||
|
|
||||||
const comTitle = computed(() => {
|
const comTitle = computed(() => {
|
||||||
title.value = title.value.replace(/\s/g, "");
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
|
title.value = title.value.replace(/\s/g, '')
|
||||||
return title.value.length ? title.value : '新项目'
|
return title.value.length ? title.value : '新项目'
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleFocus = () => {
|
const handleFocus = () => {
|
||||||
focus.value = true
|
focus.value = true
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
; (<any>inputInstRef).value.focus()
|
inputInstRef.value && (inputInstRef.value as any).focus()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div class="go-content-layers-list-item" :class="{ hover: hover, select: select }">
|
||||||
class="go-content-layers-list-item"
|
|
||||||
:class="{ hover: hover, select: select }"
|
|
||||||
>
|
|
||||||
<div class="go-flex-center item-content">
|
<div class="go-flex-center item-content">
|
||||||
<n-image
|
<n-image
|
||||||
class="list-img"
|
class="list-img"
|
||||||
@ -43,6 +40,7 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// eslint-disable-next-line vue/no-setup-props-destructure
|
||||||
const { image } = props.componentData.chartConfig
|
const { image } = props.componentData.chartConfig
|
||||||
|
|
||||||
// 计算当前选中目标
|
// 计算当前选中目标
|
||||||
@ -80,7 +78,7 @@ $textSize: 10px;
|
|||||||
/* 需要设置最高级,覆盖 hover 的颜色 */
|
/* 需要设置最高级,覆盖 hover 的颜色 */
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(0, 0, 0, 0);
|
||||||
.list-img {
|
.list-img {
|
||||||
border:1px solid v-bind('themeColor')!important;
|
border: 1px solid v-bind('themeColor') !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.select-modal,
|
.select-modal,
|
||||||
|
@ -35,7 +35,7 @@ export const useSync = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.isGroup) {
|
if (e.isGroup) {
|
||||||
;(e as CreateComponentGroupType).groupList.forEach(groupItem => {
|
(e as CreateComponentGroupType).groupList.forEach(groupItem => {
|
||||||
intComponent(groupItem)
|
intComponent(groupItem)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,37 +10,16 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"lib": [
|
"lib": ["es6", "ESNext", "dom"],
|
||||||
"es6",
|
"types": ["vite/client"],
|
||||||
"ESNext",
|
|
||||||
"dom"
|
|
||||||
],
|
|
||||||
"types": [
|
|
||||||
"vite/client"
|
|
||||||
],
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": ["src/*"],
|
||||||
"src/*"
|
"/#/*": ["types/*"]
|
||||||
],
|
|
||||||
"/#/*": [
|
|
||||||
"types/*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"noImplicitAny": true, //不允许使用any
|
"noImplicitAny": true, //不允许使用any
|
||||||
// "strictNullChecks": true, //不允许使用null
|
// "strictNullChecks": true, //不允许使用null
|
||||||
"noImplicitThis": true //不允许往this上面挂属性
|
"noImplicitThis": true //不允许往this上面挂属性
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "types/**/*"],
|
||||||
"src/**/*.ts",
|
"exclude": ["node_modules", "dist", "**/*.js"]
|
||||||
"src/**/*.d.ts",
|
|
||||||
"src/**/*.tsx",
|
|
||||||
"src/**/*.vue",
|
|
||||||
"types/**/*.d.ts",
|
|
||||||
"types/**/*.ts",
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"dist",
|
|
||||||
"**/*.js"
|
|
||||||
]
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user