diff --git a/package.json b/package.json index a817ce105..9e2105356 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,8 @@ "@rollup/plugin-typescript": "11.1.6", "@types/js-beautify": "1.14.3", "@types/node": "20.14.13", - "@typescript-eslint/eslint-plugin": "7.18.0", - "@typescript-eslint/parser": "7.18.0", + "@typescript-eslint/eslint-plugin": "8.0.0", + "@typescript-eslint/parser": "8.0.0", "@vitejs/plugin-vue": "5.1.1", "@vitejs/plugin-vue-jsx": "4.0.0", "@vitest/coverage-v8": "2.0.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 87d4630a0..29e9b31e8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,11 +37,11 @@ importers: specifier: 20.14.13 version: 20.14.13 '@typescript-eslint/eslint-plugin': - specifier: 7.18.0 - version: 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4) + specifier: 8.0.0 + version: 8.0.0(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/parser': - specifier: 7.18.0 - version: 7.18.0(eslint@8.57.0)(typescript@5.5.4) + specifier: 8.0.0 + version: 8.0.0(eslint@8.57.0)(typescript@5.5.4) '@vitejs/plugin-vue': specifier: 5.1.1 version: 5.1.1(vite@5.3.5(@types/node@20.14.13))(vue@3.4.35(typescript@5.5.4)) @@ -787,63 +787,62 @@ packages: '@types/web-bluetooth@0.0.20': resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} - '@typescript-eslint/eslint-plugin@7.18.0': - resolution: {integrity: sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/eslint-plugin@8.0.0': + resolution: {integrity: sha512-STIZdwEQRXAHvNUS6ILDf5z3u95Gc8jzywunxSNqX00OooIemaaNIA0vEgynJlycL5AjabYLLrIyHd4iazyvtg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true - '@typescript-eslint/parser@7.18.0': - resolution: {integrity: sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/parser@8.0.0': + resolution: {integrity: sha512-pS1hdZ+vnrpDIxuFXYQpLTILglTjSYJ9MbetZctrUawogUsPdz31DIIRZ9+rab0LhYNTsk88w4fIzVheiTbWOQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 + eslint: ^8.57.0 || ^9.0.0 typescript: '*' peerDependenciesMeta: typescript: optional: true - '@typescript-eslint/scope-manager@7.18.0': - resolution: {integrity: sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/scope-manager@8.0.0': + resolution: {integrity: sha512-V0aa9Csx/ZWWv2IPgTfY7T4agYwJyILESu/PVqFtTFz9RIS823mAze+NbnBI8xiwdX3iqeQbcTYlvB04G9wyQw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@7.18.0': - resolution: {integrity: sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/type-utils@8.0.0': + resolution: {integrity: sha512-mJAFP2mZLTBwAn5WI4PMakpywfWFH5nQZezUQdSKV23Pqo6o9iShQg1hP2+0hJJXP2LnZkWPphdIq4juYYwCeg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 typescript: '*' peerDependenciesMeta: typescript: optional: true - '@typescript-eslint/types@7.18.0': - resolution: {integrity: sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/types@8.0.0': + resolution: {integrity: sha512-wgdSGs9BTMWQ7ooeHtu5quddKKs5Z5dS+fHLbrQI+ID0XWJLODGMHRfhwImiHoeO2S5Wir2yXuadJN6/l4JRxw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@7.18.0': - resolution: {integrity: sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/typescript-estree@8.0.0': + resolution: {integrity: sha512-5b97WpKMX+Y43YKi4zVcCVLtK5F98dFls3Oxui8LbnmRsseKenbbDinmvxrWegKDMmlkIq/XHuyy0UGLtpCDKg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' peerDependenciesMeta: typescript: optional: true - '@typescript-eslint/utils@7.18.0': - resolution: {integrity: sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/utils@8.0.0': + resolution: {integrity: sha512-k/oS/A/3QeGLRvOWCg6/9rATJL5rec7/5s1YmdS0ZU6LHveJyGFwBvLhSRBv6i9xaj7etmosp+l+ViN1I9Aj/Q==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: - eslint: ^8.56.0 + eslint: ^8.57.0 || ^9.0.0 - '@typescript-eslint/visitor-keys@7.18.0': - resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==} - engines: {node: ^18.18.0 || >=20.0.0} + '@typescript-eslint/visitor-keys@8.0.0': + resolution: {integrity: sha512-oN0K4nkHuOyF3PVMyETbpP5zp6wfyOvm7tWhTMfoqxSSsPmJIh6JNASuZDlODE8eE+0EB9uar+6+vxr9DBTYOA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} @@ -3094,14 +3093,14 @@ snapshots: '@types/web-bluetooth@0.0.20': {} - '@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.0.0(@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.18.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/type-utils': 7.18.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/parser': 8.0.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/type-utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.0 eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.1 @@ -3112,12 +3111,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@7.18.0(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/parser@8.0.0(eslint@8.57.0)(typescript@5.5.4)': dependencies: - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.0.0 debug: 4.3.5 eslint: 8.57.0 optionalDependencies: @@ -3125,29 +3124,29 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@7.18.0': + '@typescript-eslint/scope-manager@8.0.0': dependencies: - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/visitor-keys': 8.0.0 - '@typescript-eslint/type-utils@7.18.0(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/type-utils@8.0.0(eslint@8.57.0)(typescript@5.5.4)': dependencies: - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4) - '@typescript-eslint/utils': 7.18.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) + '@typescript-eslint/utils': 8.0.0(eslint@8.57.0)(typescript@5.5.4) debug: 4.3.5 - eslint: 8.57.0 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: typescript: 5.5.4 transitivePeerDependencies: + - eslint - supports-color - '@typescript-eslint/types@7.18.0': {} + '@typescript-eslint/types@8.0.0': {} - '@typescript-eslint/typescript-estree@7.18.0(typescript@5.5.4)': + '@typescript-eslint/typescript-estree@8.0.0(typescript@5.5.4)': dependencies: - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/visitor-keys': 7.18.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/visitor-keys': 8.0.0 debug: 4.3.5 globby: 11.1.0 is-glob: 4.0.3 @@ -3159,20 +3158,20 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@7.18.0(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/utils@8.0.0(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@typescript-eslint/scope-manager': 7.18.0 - '@typescript-eslint/types': 7.18.0 - '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.0.0 + '@typescript-eslint/types': 8.0.0 + '@typescript-eslint/typescript-estree': 8.0.0(typescript@5.5.4) eslint: 8.57.0 transitivePeerDependencies: - supports-color - typescript - '@typescript-eslint/visitor-keys@7.18.0': + '@typescript-eslint/visitor-keys@8.0.0': dependencies: - '@typescript-eslint/types': 7.18.0 + '@typescript-eslint/types': 8.0.0 eslint-visitor-keys: 3.4.3 '@ungap/structured-clone@1.2.0': {} diff --git a/src/createDomEvent.ts b/src/createDomEvent.ts index e5be2f10c..c6e77609b 100644 --- a/src/createDomEvent.ts +++ b/src/createDomEvent.ts @@ -11,9 +11,9 @@ import domEvents, { } from './constants/dom-events' interface TriggerOptions { - code?: String - key?: String - keyCode?: Number + code?: string + key?: string + keyCode?: number [custom: string]: any } @@ -156,7 +156,7 @@ function createDOMEvent( const eventPrototype = Object.getPrototypeOf(event) // attach custom options to the event, like `relatedTarget` and so on. - options && + if (options) { Object.keys(options).forEach((key) => { const propertyDescriptor = Object.getOwnPropertyDescriptor( eventPrototype, @@ -169,6 +169,7 @@ function createDOMEvent( event[key] = options[key] } }) + } return event } diff --git a/src/createInstance.ts b/src/createInstance.ts index cbd5d19f7..1e13a03fe 100644 --- a/src/createInstance.ts +++ b/src/createInstance.ts @@ -68,6 +68,7 @@ function getInstanceOptions( // implementation export function createInstance( + // eslint-disable-next-line @typescript-eslint/no-empty-object-type inputComponent: DefineComponent<{}, {}, any, any, any, any>, options?: MountingOptions & Record ) { @@ -129,8 +130,10 @@ export function createInstance( options?.slots && Object.entries(options.slots).reduce( ( + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type acc: { [key: string]: Function }, [name, slot]: [string, Slot] + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type ): { [key: string]: Function } => { if (Array.isArray(slot)) { const normalized = slot.map(slotToFunction) diff --git a/src/mount.ts b/src/mount.ts index 4e1027d35..1a30e0afb 100644 --- a/src/mount.ts +++ b/src/mount.ts @@ -16,6 +16,7 @@ type ShimSlotReturnType = T extends (...args: infer P) => any type WithArray = T | T[] +// eslint-disable-next-line @typescript-eslint/no-empty-object-type type ComponentData = T extends { data?(...args: any): infer D } ? D : {} export type ComponentMountingOptions< diff --git a/src/types.ts b/src/types.ts index 282abb96a..370d183f5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-empty-object-type */ import { Component, ComponentOptions, @@ -27,6 +28,7 @@ export type FindAllComponentsSelector = | string export type FindComponentSelector = RefSelector | FindAllComponentsSelector +// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type export type Slot = VNode | string | { render: Function } | Function | Component type SlotDictionary = { diff --git a/src/utils.ts b/src/utils.ts index 80244d05d..cb56af215 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -157,14 +157,14 @@ export function textContent(element: Node): string { : '' } -export function hasOwnProperty( +export function hasOwnProperty( obj: O, prop: P ): obj is O & Record { return obj.hasOwnProperty(prop) } -export function isNotNullOrUndefined( +export function isNotNullOrUndefined( obj: T | null | undefined ): obj is T { return Boolean(obj) diff --git a/src/utils/vueCompatSupport.ts b/src/utils/vueCompatSupport.ts index 299629c63..839d861ee 100644 --- a/src/utils/vueCompatSupport.ts +++ b/src/utils/vueCompatSupport.ts @@ -7,7 +7,9 @@ function isCompatEnabled(key: string): boolean { } export function isLegacyExtendedComponent(component: unknown): component is { + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type (): Function + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type super: Function options: ComponentOptions } {