fix: eslint

pull/37/head
xingyu 2023-09-25 17:32:16 +08:00
parent efe71b9d8e
commit 1e3cb0c885
12 changed files with 28 additions and 15 deletions

View File

@ -8,7 +8,7 @@ interface UseAutoFocusContext {
isInitedDefault: Ref<boolean>
formElRef: Ref<FormActionType>
}
export async function useAutoFocus({ getSchema, getProps, formElRef, isInitedDefault }: UseAutoFocusContext) {
export function useAutoFocus({ getSchema, getProps, formElRef, isInitedDefault }: UseAutoFocusContext) {
watchEffect(async () => {
if (unref(isInitedDefault) || !unref(getProps).autoFocusFirstItem)
return

View File

@ -78,7 +78,7 @@ export function useForm(props?: Props): UseFormReturnType {
},
removeSchemaByField: async (field: string | string[]) => {
unref(formRef)?.removeSchemaByField(field)
await unref(formRef)?.removeSchemaByField(field)
},
// TODO promisify

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/require-await */
import type { ComputedRef, Ref } from 'vue'
import type { NamePath } from 'ant-design-vue/lib/form/interface'
import { nextTick, toRaw, unref } from 'vue'
@ -89,6 +90,7 @@ export function useFormEvents({
const defaultValueObj = schema?.defaultValueObj
const fieldKeys = Object.keys(defaultValueObj || {})
if (fieldKeys.length) {
// eslint-disable-next-line array-callback-return
fieldKeys.map((field) => {
formModel[field] = defaultValueObj![field]
})

View File

@ -6,8 +6,6 @@ import { useDesign } from '@/hooks/web/useDesign'
import { propTypes } from '@/utils/propTypes'
import mitt from '@/utils/mitt'
defineOptions({ name: 'Menu' })
const props = defineProps({
theme: propTypes.oneOf(['light', 'dark']).def('light'),
activeName: propTypes.oneOfType([propTypes.string, propTypes.number]),

View File

@ -1,3 +1,4 @@
<!-- eslint-disable no-useless-call -->
<script lang="ts" setup>
import { computed, inject, ref, toRaw, unref, useAttrs, useSlots, watchEffect } from 'vue'
import { Table } from 'ant-design-vue'

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/await-thenable */
import type { WatchStopHandle } from 'vue'
import { onUnmounted, ref, toRaw, unref, watch } from 'vue'
import type { BasicColumn, BasicTableProps, FetchParams, TableActionType } from '../types/table'

View File

@ -1,3 +1,4 @@
<!-- eslint-disable vue/no-side-effects-in-computed-properties -->
<script lang="ts" setup>
import type { CSSProperties } from 'vue'
import { computed, onMounted, ref, unref, watch } from 'vue'
@ -51,28 +52,27 @@ const permissionStore = usePermissionStore()
useDragLine(sideRef, dragBarRef, true)
const getMixSideWidth = computed(() => {
return unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH
})
const getMenuStyle = computed((): CSSProperties => {
return {
width: unref(openMenu) ? `${unref(getMenuWidth)}px` : 0,
// eslint-disable-next-line @typescript-eslint/no-use-before-define
left: `${unref(getMixSideWidth)}px`,
}
})
const getIsFixed = computed(() => {
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
mixSideHasChildren.value = unref(childrenMenus).length > 0
const isFixed = unref(getMixSideFixed) && unref(mixSideHasChildren)
if (isFixed)
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
openMenu.value = true
return isFixed
})
const getMixSideWidth = computed(() => {
return unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH
})
const getDomStyle = computed((): CSSProperties => {
const fixedWidth = unref(getIsFixed) ? unref(getRealWidth) : 0
@ -292,6 +292,7 @@ onClickOutside(wrap, () => {
<style lang="less">
@prefix-cls: ~'@{namespace}-layout-mix-sider';
@width: 80px;
.@{prefix-cls} {
position: fixed;
top: 0;
@ -326,7 +327,7 @@ onClickOutside(wrap, () => {
}
&.open {
> .scrollbar {
>.scrollbar {
border-right: 1px solid rgb(238 238 238);
}
}
@ -341,6 +342,7 @@ onClickOutside(wrap, () => {
}
}
}
.@{prefix-cls}-menu-list {
&__content {
box-shadow: 0 0 4px 0 rgb(0 0 0 / 10%);
@ -364,10 +366,11 @@ onClickOutside(wrap, () => {
border-bottom: 1px solid var(--sider-dark-lighten-bg-color);
}
> .scrollbar {
>.scrollbar {
border-right: 1px solid var(--sider-dark-lighten-bg-color);
}
}
.@{prefix-cls}-menu-list {
background-color: var(--sider-dark-bg-color);
@ -379,7 +382,7 @@ onClickOutside(wrap, () => {
}
}
> .scrollbar {
>.scrollbar {
height: calc(100% - @header-height - 38px);
}
@ -408,6 +411,7 @@ onClickOutside(wrap, () => {
&:hover {
color: @white;
}
// &:hover,
&--active {
font-weight: 700;

View File

@ -4,6 +4,7 @@ import type { RoleEnum } from '@/enums/roleEnum'
export type Component<T = any> = ReturnType<typeof defineComponent> | (() => Promise<typeof import('*.vue')>) | (() => Promise<T>)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
export interface AppRouteRecordRaw extends Omit<RouteRecordRaw, 'meta'> {
keepAlive?: boolean

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/unbound-method */
import type { RouteLocationNormalized, RouteLocationRaw, Router } from 'vue-router'
import { toRaw, unref } from 'vue'

View File

@ -158,13 +158,16 @@ export function once(el: HTMLElement, event: string, fn: EventListener): void {
export function useRafThrottle<T extends FunctionArgs>(fn: T): T {
let locked = false
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
return function (...args: any[]) {
if (locked)
return
locked = true
window.requestAnimationFrame(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-invalid-this
fn.apply(this, args)
locked = false
})

View File

@ -164,6 +164,9 @@ export function simpleDebounce(fn, delay = 100) {
clearTimeout(timer)
timer = setTimeout(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-invalid-this
fn.apply(this, args)
}, delay)
}

View File

@ -34,8 +34,7 @@ type _BuildPropType<T, V, C> =
export type BuildPropType<T, V, C> = _BuildPropType<IfUnknown<T, never>, IfUnknown<V, never>, IfUnknown<C, never>>
type _BuildPropDefault<T, D> = [T] extends [
// eslint-disable-next-line @typescript-eslint/ban-types
Record<string, unknown> | Array<any> | Function,
Record<string, unknown> | Array<any> | Fn,
]
? D
: D extends () => T