diff --git a/package-lock.json b/package-lock.json index 4ca8e9e..417b0d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@matrixai/events": "^4.0.0" }, "devDependencies": { - "@matrixai/lint": "^0.2.4", + "@matrixai/lint": "^0.2.6", "@swc/core": "1.3.82", "@swc/jest": "^0.2.29", "@types/jest": "^29.5.2", @@ -2109,9 +2109,9 @@ "integrity": "sha512-Z4cggoWDKEIi/YjOwbtonSaRCptM91T4JbQbLHP/kOxG/wHcjijavWQfEfWm6yszxm8WKhufm0alV+UhedyCqA==" }, "node_modules/@matrixai/lint": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@matrixai/lint/-/lint-0.2.4.tgz", - "integrity": "sha512-LaFiAmTMzGc0IItyJ+VlTE5Hcko0vAn0mXYd19SbNG+ubnLI3NIEEuHwIGJFJ84Y2Zid0/YOG69IrFQHnNmJjw==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@matrixai/lint/-/lint-0.2.6.tgz", + "integrity": "sha512-Cbx6SCTAqSt7lTKkaXL7wB+KbkiXYpQ0LdV5fPcnzEfG0sCuG8dbJcwzgHT5Qn7ubG71BBLUVFjHY1EGADzT8g==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2121,7 +2121,7 @@ "@typescript-eslint/parser": "^8.27.0", "@typescript-eslint/utils": "^8.26.1", "commander": "^13.1.0", - "eslint": ">=9.0.0", + "eslint": "^9.0.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsx-a11y": "^6.10.2", diff --git a/package.json b/package.json index 2acd001..e0a86ce 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@matrixai/events": "^4.0.0" }, "devDependencies": { - "@matrixai/lint": "^0.2.4", + "@matrixai/lint": "^0.2.6", "@swc/core": "1.3.82", "@swc/jest": "^0.2.29", "@types/jest": "^29.5.2", diff --git a/src/CreateDestroy.ts b/src/CreateDestroy.ts index 1a2aaeb..75bbca5 100644 --- a/src/CreateDestroy.ts +++ b/src/CreateDestroy.ts @@ -1,4 +1,4 @@ -import type { Status, Class } from './types.js'; +import type { Status, Class, AnyFn } from './types.js'; import { Evented } from '@matrixai/events'; import { RWLockWriter } from '@matrixai/async-locks'; import { @@ -118,7 +118,7 @@ function ready( } else if (descriptor.set != null) { kind = 'set'; } - const f: Function = descriptor[kind]; // eslint-disable-line @typescript-eslint/ban-types + const f = descriptor[kind] as AnyFn; if (typeof f !== 'function') { throw new TypeError(`${key} is not a function`); } diff --git a/src/CreateDestroyStartStop.ts b/src/CreateDestroyStartStop.ts index 10b181a..d9770c8 100644 --- a/src/CreateDestroyStartStop.ts +++ b/src/CreateDestroyStartStop.ts @@ -1,4 +1,4 @@ -import type { Status, Class } from './types.js'; +import type { Status, Class, AnyFn } from './types.js'; import { Evented } from '@matrixai/events'; import { RWLockWriter } from '@matrixai/async-locks'; import { @@ -238,7 +238,7 @@ function ready( } else if (descriptor.set != null) { kind = 'set'; } - const f: Function = descriptor[kind]; // eslint-disable-line @typescript-eslint/ban-types + const f = descriptor[kind] as AnyFn; if (typeof f !== 'function') { throw new TypeError(`${key} is not a function`); } diff --git a/src/StartStop.ts b/src/StartStop.ts index fee74e5..0ab1c67 100644 --- a/src/StartStop.ts +++ b/src/StartStop.ts @@ -159,7 +159,8 @@ function ready( } else if (descriptor.set != null) { kind = 'set'; } - const f: Function = descriptor[kind]; // eslint-disable-line @typescript-eslint/ban-types + type AnyFn = (...args: Array) => unknown; + const f = descriptor[kind] as AnyFn; if (typeof f !== 'function') { throw new TypeError(`${key} is not a function`); } diff --git a/src/types.ts b/src/types.ts index d78e524..e3666fc 100644 --- a/src/types.ts +++ b/src/types.ts @@ -11,4 +11,6 @@ type Status = 'destroying' | 'starting' | 'stopping' | null; type Class = new (...args: any[]) => T; -export type { PromiseDeconstructed, Status, Class }; +type AnyFn = (...args: Array) => unknown; + +export type { PromiseDeconstructed, Status, Class, AnyFn }; diff --git a/src/utils.ts b/src/utils.ts index ea3c082..9afd16b 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,4 +1,4 @@ -import type { PromiseDeconstructed } from './types.js'; +import type { AnyFn, PromiseDeconstructed } from './types.js'; /** * Symbols prevents name clashes with decorated classes @@ -42,8 +42,7 @@ function promise(): PromiseDeconstructed { * This function rewrites the stack trace according to where the wrapped * function is called, giving a more useful stack trace */ -// eslint-disable-next-line @typescript-eslint/ban-types -function resetStackTrace(error: Error, decorated?: Function): void { +function resetStackTrace(error: Error, decorated?: AnyFn): void { if (error.stack != null) { const stackTitle = error.stack.slice(0, error.stack.indexOf('\n') + 1); if (hasCaptureStackTrace) { diff --git a/tests/CreateDestroy.test.ts b/tests/CreateDestroy.test.ts index a8da27f..467252c 100644 --- a/tests/CreateDestroy.test.ts +++ b/tests/CreateDestroy.test.ts @@ -377,7 +377,7 @@ describe('CreateDestroy', () => { (async () => { const x = new X(); const destroy = x.destroy(); - x.a; + void x.a; await destroy; })(), ).resolves.toBeUndefined(); diff --git a/tests/CreateDestroyStartStop.test.ts b/tests/CreateDestroyStartStop.test.ts index b379629..2af5bec 100644 --- a/tests/CreateDestroyStartStop.test.ts +++ b/tests/CreateDestroyStartStop.test.ts @@ -596,7 +596,7 @@ describe('CreateDestroyStartStop', () => { await expect( (async () => { const start = x.start(); - x.a; + void x.a; await start; })(), ).rejects.toThrow(ErrorAsyncInitNotRunning); @@ -614,7 +614,7 @@ describe('CreateDestroyStartStop', () => { await expect( (async () => { const stop = x.stop(); - x.a; + void x.a; await stop; })(), ).resolves.toBeUndefined(); diff --git a/tests/StartStop.test.ts b/tests/StartStop.test.ts index 0d2634f..b038a25 100644 --- a/tests/StartStop.test.ts +++ b/tests/StartStop.test.ts @@ -311,7 +311,7 @@ describe('StartStop', () => { await expect( (async () => { const start = x.start(); - x.a; + void x.a; await start; })(), ).rejects.toThrow(ErrorAsyncInitNotRunning); @@ -329,7 +329,7 @@ describe('StartStop', () => { await expect( (async () => { const stop = x.stop(); - x.a; + void x.a; await stop; })(), ).resolves.toBeUndefined();