From 947a10710981cf5b3b6eb79fefd88d1bdb5054cb Mon Sep 17 00:00:00 2001 From: agileago Date: Fri, 1 Sep 2023 16:02:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4package.json=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E9=85=8D=E7=BD=AE=EF=BC=8C=E8=A7=A3=E5=86=B3vue-tsc?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 1 + package.json | 6 ------ src/decorators/computed.ts | 4 ++-- src/decorators/hook.ts | 2 +- src/decorators/link.ts | 2 +- src/decorators/mut.ts | 2 +- src/decorators/util.ts | 4 ++-- src/extends/component.ts | 4 ++-- src/helper.ts | 2 +- src/type.ts | 2 +- 10 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 3935e16..6d9a402 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -36,5 +36,6 @@ module.exports = { '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-floating-promises': 'off', 'no-empty': 'warn', + '@typescript-eslint/no-unused-vars': 'warn', }, } diff --git a/package.json b/package.json index 61ab7ac..968e653 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,6 @@ "main": "dist/vue3-oop.js", "module": "dist/vue3-oop.mjs", "types": "types/index.d.ts", - "exports": { - ".": { - "import": "./dist/vue3-oop.mjs", - "require": "./dist/vue3-oop.js" - } - }, "scripts": { "dev": "vite", "build": "vite build", diff --git a/src/decorators/computed.ts b/src/decorators/computed.ts index 0902759..4948c62 100644 --- a/src/decorators/computed.ts +++ b/src/decorators/computed.ts @@ -19,7 +19,7 @@ function handler(targetThis: Record) { const list = getProtoMetadata( targetThis, Computed.MetadataKey, - true + true, ) if (!list || !list.length) return for (const item of list) { @@ -39,7 +39,7 @@ function handler(targetThis: Record) { }, { flush: option === true ? 'sync' : option, - } + }, ) } else { keyVal = computed({ diff --git a/src/decorators/hook.ts b/src/decorators/hook.ts index 1c2012f..5823760 100644 --- a/src/decorators/hook.ts +++ b/src/decorators/hook.ts @@ -39,7 +39,7 @@ export interface HookDecorator { function handler(targetThis: any) { const list = getProtoMetadata<(Lifecycle | Lifecycle[])[]>( targetThis, - Hook.MetadataKey + Hook.MetadataKey, ) if (!list?.length) return for (const item of list) { diff --git a/src/decorators/link.ts b/src/decorators/link.ts index ac3e1b4..f9db3bd 100644 --- a/src/decorators/link.ts +++ b/src/decorators/link.ts @@ -11,7 +11,7 @@ export interface LinkDecorator { function handler(targetThis: Record) { const list = getProtoMetadata( targetThis, - Link.MetadataKey + Link.MetadataKey, ) if (!list || !list.length) return for (const item of list) { diff --git a/src/decorators/mut.ts b/src/decorators/mut.ts index caf509a..c6f3b24 100644 --- a/src/decorators/mut.ts +++ b/src/decorators/mut.ts @@ -33,7 +33,7 @@ function handler(targetThis: Record) { export function defMut( targetThis: Record, key: string | symbol, - options: any + options: any, ) { let keyVal: Ref if (options === true) { diff --git a/src/decorators/util.ts b/src/decorators/util.ts index 2378419..b5e2ffe 100644 --- a/src/decorators/util.ts +++ b/src/decorators/util.ts @@ -46,7 +46,7 @@ export function createDecorator(name: string, allowRepeat = false) { export function getProtoMetadata( target: any, key: symbol | string, - withDesc = false + withDesc = false, ): MetadataStore[] { const proto = Object.getPrototypeOf(target) if (!proto) return [] @@ -58,7 +58,7 @@ export function getProtoMetadata( } export function getDeepOwnDescriptor( proto: any, - key: string | symbol + key: string | symbol, ): PropertyDescriptor | null { if (!proto) return null const desc = Object.getOwnPropertyDescriptor(proto, key) diff --git a/src/extends/component.ts b/src/extends/component.ts index cce396e..ad8a252 100644 --- a/src/extends/component.ts +++ b/src/extends/component.ts @@ -172,7 +172,7 @@ Object.defineProperty(VueComponent, '__vccOpts', { props: defaultProps || {}, // 放到emits的on函数会自动缓存 emits: (emits || []).concat( - getEmitsFromProps(CompConstructor.defaultProps || {}) + getEmitsFromProps(CompConstructor.defaultProps || {}), ), setup, } @@ -202,7 +202,7 @@ export function useForwardRef() { export function mergeRefs(...values: VNodeRef[]) { return function ( ref: Element | ComponentPublicInstance | null, - refs: Record + refs: Record, ) { for (const r of values) { if (typeof r === 'string') { diff --git a/src/helper.ts b/src/helper.ts index ba3857d..6f0f6c7 100644 --- a/src/helper.ts +++ b/src/helper.ts @@ -22,7 +22,7 @@ export function getCurrentApp() { return getCurrentInstance()?.appContext.app } export function getEmitsFromProps( - defaultProps: Record | string[] + defaultProps: Record | string[], ) { const keys = Array.isArray(defaultProps) ? defaultProps diff --git a/src/type.ts b/src/type.ts index 0bd3914..7aedb71 100644 --- a/src/type.ts +++ b/src/type.ts @@ -49,7 +49,7 @@ type ModelProps = Exclude< export type WithVModel< T extends {}, - U extends keyof T = ModelProps + U extends keyof T = ModelProps, > = TransformModelValue<{ [k in U as `v-model:${k & string}`]?: T[k] | [T[k], string[]] }>