From 2dab81863981acb0ac7016a9087081c37e4d99e2 Mon Sep 17 00:00:00 2001 From: Aaron Moat <2937187+AaronMoat@users.noreply.github.com> Date: Sat, 28 Sep 2024 12:34:45 +1000 Subject: [PATCH 1/2] Disable @typescript-eslint/only-throw-error in test files --- .changeset/small-meals-scream.md | 5 +++++ packages/eslint-config-skuba/index.js | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/small-meals-scream.md diff --git a/.changeset/small-meals-scream.md b/.changeset/small-meals-scream.md new file mode 100644 index 000000000..b124d8481 --- /dev/null +++ b/.changeset/small-meals-scream.md @@ -0,0 +1,5 @@ +--- +'eslint-config-skuba': minor +--- + +Disable `@typescript-eslint/only-throw-error` in test files diff --git a/packages/eslint-config-skuba/index.js b/packages/eslint-config-skuba/index.js index 9c0c8d469..79704533d 100644 --- a/packages/eslint-config-skuba/index.js +++ b/packages/eslint-config-skuba/index.js @@ -171,6 +171,9 @@ module.exports = [ // Allow e.g. `/** @jest-environment jsdom */` directives 'tsdoc/syntax': 'off', + // Allow edge-case error handling tests, including from skuba's templates + '@typescript-eslint/only-throw-error': 'off', + // Allow potential floating promises in tests only for Koa compatibility // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-misused-promises.md#checksvoidreturn // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42551#issuecomment-648816869 From a354f42933cc665361530565a617e86c7018d65f Mon Sep 17 00:00:00 2001 From: Aaron Moat <2937187+AaronMoat@users.noreply.github.com> Date: Sat, 28 Sep 2024 12:35:09 +1000 Subject: [PATCH 2/2] Remove exclusion from template --- template/koa-rest-api/src/framework/server.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/template/koa-rest-api/src/framework/server.test.ts b/template/koa-rest-api/src/framework/server.test.ts index 7953e28ba..8bf87fedb 100644 --- a/template/koa-rest-api/src/framework/server.test.ts +++ b/template/koa-rest-api/src/framework/server.test.ts @@ -203,7 +203,6 @@ describe('createApp', () => { it('handles null error', async () => { middleware.mockImplementation(() => { - /* eslint-disable-next-line @typescript-eslint/only-throw-error */ throw null; });