diff --git a/package.json b/package.json index f50b208..fb1dadf 100644 --- a/package.json +++ b/package.json @@ -47,20 +47,20 @@ "split2": "^4.2.0" }, "devDependencies": { - "@cowtech/eslint-config": "^8.10.0", - "@swc/cli": "^0.1.62", - "@swc/core": "^1.3.94", - "@types/node": "^20.8.7", - "@types/pump": "^1.1.2", - "@types/split2": "^4.2.2", - "@types/tap": "^15.0.10", + "@cowtech/eslint-config": "^9.0.0", + "@swc/cli": "^0.1.63", + "@swc/core": "^1.3.101", + "@types/node": "^20.10.5", + "@types/pump": "^1.1.3", + "@types/split2": "^4.2.3", + "@types/tap": "^15.0.11", "c8": "^8.0.1", "chokidar": "^3.5.3", "concurrently": "^8.2.2", - "prettier": "^3.0.3", - "tap": "^18.5.2", - "ts-node": "^10.9.1", - "typescript": "^5.2.2" + "prettier": "^3.1.1", + "tap": "^18.6.1", + "ts-node": "^10.9.2", + "typescript": "^5.3.3" }, "engines": { "node": ">= 18.18.0" diff --git a/src/index.ts b/src/index.ts index e7f1160..3420ea1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,6 +10,7 @@ function parseOptionAsync(promises: Promise[], fn: (...args: any[]) => Pro const [promise, resolve, reject] = createPromiseForCallbacks() promises.push(promise) + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument fn(...args) .then(resolve) .catch(reject) @@ -41,7 +42,7 @@ export async function processData( contents += chunk.toString(encoding) } } catch (error) { - handleError(error, input) + handleError(error as Error, input) } return executeCommands(contents, 0, commands) @@ -77,7 +78,7 @@ export async function processData( // Start processing pipe.resume() }).catch(error => { - handleError(error, input) + handleError(error as Error, input) }) } @@ -126,8 +127,8 @@ export async function execute(args: string[], { version, description }: PackageI const { input, encoding, whole } = cli.opts() try { - await processData(input, encoding, whole, commands) + await processData(input as string, encoding as BufferEncoding, whole as boolean, commands) } catch (error) { - handleError(error, input, true) + handleError(error as Error, input as string, true) } } diff --git a/test/index.test.ts b/test/index.test.ts index 64dde6d..08a5e32 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -3,10 +3,10 @@ import { readFileSync } from 'node:fs' import t from 'tap' import { execute, processData } from '../src/index.js' -import { NSedError } from '../src/models.js' +import { NSedError, type PackageInfo } from '../src/models.js' import { requireModule } from '../src/operations.js' -const packageInfo = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')) +const packageInfo: PackageInfo = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')) const dataFile = new URL('fixtures/data.txt', import.meta.url).toString().replace('file://', '') t.test('NSed execution', async t => {