diff --git a/src/components/Application/src/useAppContext.ts b/src/components/Application/src/useAppContext.ts index add977e..2152e02 100644 --- a/src/components/Application/src/useAppContext.ts +++ b/src/components/Application/src/useAppContext.ts @@ -6,7 +6,7 @@ export interface AppProviderContextProps { isMobile: Ref } -const key: InjectionKey = Symbol() +const key: InjectionKey = Symbol('app-context') export function createAppProviderContext(context: AppProviderContextProps) { return createContext(context, key) diff --git a/src/components/Form/src/hooks/useFormContext.ts b/src/components/Form/src/hooks/useFormContext.ts index cbe37fd..4666af3 100644 --- a/src/components/Form/src/hooks/useFormContext.ts +++ b/src/components/Form/src/hooks/useFormContext.ts @@ -6,7 +6,7 @@ export interface FormContextProps { submitAction: () => Promise } -const key: InjectionKey = Symbol() +const key: InjectionKey = Symbol('form-context') export function createFormContext(context: FormContextProps) { return createContext(context, key) diff --git a/src/components/Modal/src/hooks/useModalContext.ts b/src/components/Modal/src/hooks/useModalContext.ts index e7ce1c9..262589b 100644 --- a/src/components/Modal/src/hooks/useModalContext.ts +++ b/src/components/Modal/src/hooks/useModalContext.ts @@ -5,7 +5,7 @@ export interface ModalContextProps { redoModalHeight: () => void } -const key: InjectionKey = Symbol() +const key: InjectionKey = Symbol('modal-context') export function createModalContext(context: ModalContextProps) { return createContext(context, key) diff --git a/src/components/SimpleMenu/src/components/useSimpleMenuContext.ts b/src/components/SimpleMenu/src/components/useSimpleMenuContext.ts index fa12aa7..9b96770 100644 --- a/src/components/SimpleMenu/src/components/useSimpleMenuContext.ts +++ b/src/components/SimpleMenu/src/components/useSimpleMenuContext.ts @@ -7,7 +7,7 @@ export interface SimpleRootMenuContextProps { activeName: Ref } -const key: InjectionKey = Symbol() +const key: InjectionKey = Symbol('simple-menu-context') export function createSimpleRootMenuContext(context: SimpleRootMenuContextProps) { return createContext(context, key, { readonly: false, native: true }) diff --git a/src/hooks/component/usePageContext.ts b/src/hooks/component/usePageContext.ts index fbdc507..645ee62 100644 --- a/src/hooks/component/usePageContext.ts +++ b/src/hooks/component/usePageContext.ts @@ -7,7 +7,7 @@ export interface PageContextProps { setPageHeight: (height: number) => Promise } -const key: InjectionKey = Symbol() +const key: InjectionKey = Symbol('page-context') export function createPageContext(context: PageContextProps) { return createContext(context, key, { native: true }) diff --git a/src/hooks/core/useContext.ts b/src/hooks/core/useContext.ts index c3a2fdd..c875e9d 100644 --- a/src/hooks/core/useContext.ts +++ b/src/hooks/core/useContext.ts @@ -11,7 +11,7 @@ type ShallowUnwrap = { [P in keyof T]: UnwrapRef } -export function createContext(context: any, key: InjectionKey = Symbol(), options: CreateContextOptions = {}) { +export function createContext(context: any, key: InjectionKey = Symbol('create-context'), options: CreateContextOptions = {}) { const { readonly = true, createProvider = true, native = false } = options const state = reactive(context) @@ -25,6 +25,6 @@ export function createContext(context: any, key: InjectionKey = Symbol(), export function useContext(key: InjectionKey, native?: boolean): T -export function useContext(key: InjectionKey = Symbol(), defaultValue?: any): ShallowUnwrap { +export function useContext(key: InjectionKey = Symbol('use-context'), defaultValue?: any): ShallowUnwrap { return inject(key, defaultValue || {}) } diff --git a/src/layouts/default/content/useContentContext.ts b/src/layouts/default/content/useContentContext.ts index 917ec8c..698877b 100644 --- a/src/layouts/default/content/useContentContext.ts +++ b/src/layouts/default/content/useContentContext.ts @@ -6,7 +6,7 @@ export interface ContentContextProps { setPageHeight: (height: number) => Promise } -const key: InjectionKey = Symbol() +const key: InjectionKey = Symbol('content-context') export function createContentContext(context: ContentContextProps) { return createContext(context, key, { native: true }) diff --git a/src/logics/mitt/routeChange.ts b/src/logics/mitt/routeChange.ts index bad535e..691856b 100644 --- a/src/logics/mitt/routeChange.ts +++ b/src/logics/mitt/routeChange.ts @@ -8,7 +8,7 @@ import { getRawRoute } from '@/utils' const emitter = mitt() -const key = Symbol() +const key = Symbol('route-change') let lastChangeTab: RouteLocationNormalized diff --git a/src/utils/helper/tsxHelper.tsx b/src/utils/helper/tsxHelper.tsx index ec8adf2..7abcfd6 100644 --- a/src/utils/helper/tsxHelper.tsx +++ b/src/utils/helper/tsxHelper.tsx @@ -28,6 +28,7 @@ export function getSlot(slots: Slots, slot = 'default', data?: any, opts?: Rende export function extendSlots(slots: Slots, excludeKeys: string[] = []) { const slotKeys = Object.keys(slots) const ret: any = {} + // eslint-disable-next-line array-callback-return slotKeys.map((key) => { if (excludeKeys.includes(key)) return null diff --git a/src/utils/http/axios/Axios.ts b/src/utils/http/axios/Axios.ts index 843ad60..b4a0ffb 100644 --- a/src/utils/http/axios/Axios.ts +++ b/src/utils/http/axios/Axios.ts @@ -266,7 +266,7 @@ export class VAxios { .then((res: AxiosResponse) => { resolve(res as unknown as Promise) // download file - if (typeof res != undefined) + if (typeof res != 'undefined') downloadByData(res?.data as unknown as BlobPart, title || 'export') }) .catch((e: Error | AxiosError) => { @@ -309,7 +309,7 @@ export class VAxios { .then((res: AxiosResponse) => { resolve(res as unknown as Promise) // download file - if (typeof res != undefined) + if (typeof res != 'undefined') downloadByData(res?.data as unknown as BlobPart, title) }) .catch((e: Error | AxiosError) => { diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index 4806d79..576635b 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -122,6 +122,7 @@ const transform: AxiosTransform = { let url = `${config.url}?` for (const propName of Object.keys(params)) { const value = params[propName] + // eslint-disable-next-line no-void if (value !== void 0 && value !== null && typeof value !== 'undefined') { if (typeof value === 'object') { for (const val of Object.keys(value)) { diff --git a/src/utils/is.ts b/src/utils/is.ts index a5c85de..d345a53 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/unbound-method const toString = Object.prototype.toString export function is(val: unknown, type: string) { @@ -57,7 +58,7 @@ export function isString(val: unknown): val is string { return is(val, 'String') } -export function isFunction(val: unknown): val is Function { +export function isFunction(val: unknown): val is Fn { return typeof val === 'function' } diff --git a/src/utils/mitt.ts b/src/utils/mitt.ts index ba78305..ba36be8 100644 --- a/src/utils/mitt.ts +++ b/src/utils/mitt.ts @@ -1,3 +1,4 @@ +/* eslint-disable array-callback-return */ /** * copy to https://github.com/developit/mitt * Expand clear method diff --git a/src/utils/props.ts b/src/utils/props.ts index 007b3b4..a5c10a6 100644 --- a/src/utils/props.ts +++ b/src/utils/props.ts @@ -6,10 +6,10 @@ import type { ExtractPropTypes } from 'vue' import type { Mutable } from './types' import { isObject } from '@/utils/is' -const wrapperKey = Symbol() +const wrapperKey = Symbol('wrapperKey') export interface PropWrapper { [wrapperKey]: T } -export const propKey = Symbol() +export const propKey = Symbol('propKey') type ResolveProp = ExtractPropTypes<{ key: { type: T; required: true }