From 160c48a8e4fc8dacdabe3e6897f647e0095e386c Mon Sep 17 00:00:00 2001 From: dickhardt Date: Wed, 5 Aug 2026 22:21:31 +0100 Subject: [PATCH] ci: make lint pass, so tests actually run CI has failed on every branch since February. `npm run lint` runs `prettier --check .`, which walked into generated build output, and because lint runs before `lerna run test`, the test suite has not executed on a pull request in months. The publish workflow tests separately, so releases were still gated; pull requests were not. Two causes. Prettier had no ignore for generated output. `.prettierignore` listed node_modules, dist and archive*, while the eslint config additionally ignored dist-test. So prettier checked `dist-test` and `.svelte-kit`, which exist only after a build, and failed on 106 files that nobody wrote. Aligned the two ignore lists and added `.svelte-kit` and `.claude`. Eslint reported 14 errors. Seven came from `.claude/worktrees`, a local directory eslint should never have been reading. The rest were the rest-sibling idiom used to strip private members from a JWK, where naming the discarded fields is how the omission works -- they are not unused. Set `ignoreRestSiblings` rather than scattering disable comments, which also retired the ones already in the tree. Removing those disables reformatted the files they were in, which prettier then flagged. That is a real ordering problem in the script: `prettier --check . && eslint --fix` runs the formatter check before the fixer, so anything eslint rewrites is never formatted, and the failure surfaces on someone else's next run. Left the script alone and committed the formatted result, but the order is worth revisiting -- `--fix` in CI mutates a checkout nothing will commit. Verified: prettier clean, eslint clean, lint exits 0, and httpsig, better-auth and email-verification all pass. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01LXExbWHeem2SNb7tZ2LGnc --- .prettierignore | 5 ++++- .../src/__tests__/issuance-token.test.ts | 3 --- .../src/__tests__/presentation-token.test.ts | 1 - eslint.config.mjs | 21 ++++++++++++++++++- httpsig/src/utils/crypto.ts | 1 - httpsig/tests/test-jkt-jwt.ts | 2 +- .../src/__tests__/issuance-token.test.ts | 3 --- .../src/__tests__/presentation-token.test.ts | 1 - .../src/__tests__/request-token.test.ts | 2 -- 9 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.prettierignore b/.prettierignore index 2719209..7e893bf 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,6 @@ node_modules dist -archive* \ No newline at end of file +dist-test +archive* +.svelte-kit +.claude diff --git a/email-verification/src/__tests__/issuance-token.test.ts b/email-verification/src/__tests__/issuance-token.test.ts index bb6b46b..7e53d9d 100644 --- a/email-verification/src/__tests__/issuance-token.test.ts +++ b/email-verification/src/__tests__/issuance-token.test.ts @@ -144,7 +144,6 @@ describe('IssuanceToken Functions', () => { }) it('should throw error for missing JWK algorithm', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { alg: _alg, ...keyWithoutAlg } = rsaPrivateKey await expect( @@ -153,7 +152,6 @@ describe('IssuanceToken Functions', () => { }) it('should throw error for missing JWK kid', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { kid: _kid, ...keyWithoutKid } = rsaPrivateKey await expect( @@ -295,7 +293,6 @@ describe('IssuanceToken Functions', () => { }) it('should throw error for missing cnf.jwk claim', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { cnf: _cnf, ...payloadWithoutCnf } = testPayload const header = { diff --git a/email-verification/src/__tests__/presentation-token.test.ts b/email-verification/src/__tests__/presentation-token.test.ts index 8896f49..2301f4e 100644 --- a/email-verification/src/__tests__/presentation-token.test.ts +++ b/email-verification/src/__tests__/presentation-token.test.ts @@ -233,7 +233,6 @@ describe('PresentationToken Functions', () => { }) it('should throw error for invalid JWK', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { alg: _alg, ...invalidKey } = rsaBrowserKey const issuanceTokenPayload: IssuanceTokenPayload = { diff --git a/eslint.config.mjs b/eslint.config.mjs index a5ae90d..6db6dac 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -8,7 +8,14 @@ export default [ ...tseslint.configs.recommended, prettierConfig, // Disable ESLint rules that conflict with Prettier { - ignores: ['**/dist', '**/dist-test', '**/node_modules', 'archive*/'], + ignores: [ + '**/dist', + '**/dist-test', + '**/node_modules', + '**/.svelte-kit', + 'archive*/', + '.claude/', + ], }, { languageOptions: { @@ -28,6 +35,18 @@ export default [ '@typescript-eslint/ban-ts-comment': 'off', // TBD: allow @ts-ignore comments '@typescript-eslint/no-empty-object-type': 'off', // TBD: Auth | {} allow empty object + + // Destructuring to omit members -- stripping private fields from a + // JWK, for example -- names the fields it is discarding. They are + // not unused; naming them is how the omission works. + '@typescript-eslint/no-unused-vars': [ + 'error', + { + ignoreRestSiblings: true, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + }, + ], }, }, ] diff --git a/httpsig/src/utils/crypto.ts b/httpsig/src/utils/crypto.ts index 0f26f3e..34d4178 100644 --- a/httpsig/src/utils/crypto.ts +++ b/httpsig/src/utils/crypto.ts @@ -249,7 +249,6 @@ export async function importPublicKey(jwk: JsonWebKey): Promise { * Extract public JWK from private JWK */ export function getPublicJwk(privateJwk: JsonWebKey): JsonWebKey { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { d, p, q, dp, dq, qi, ...publicJwk } = privateJwk return publicJwk } diff --git a/httpsig/tests/test-jkt-jwt.ts b/httpsig/tests/test-jkt-jwt.ts index fc1a895..60852bd 100644 --- a/httpsig/tests/test-jkt-jwt.ts +++ b/httpsig/tests/test-jkt-jwt.ts @@ -5,7 +5,7 @@ import { test } from 'node:test' import assert from 'node:assert' import { fetch, verify } from '../src/index.js' -import { base64urlEncode, base64urlDecode } from '../src/utils/base64.js' +import { base64urlEncode } from '../src/utils/base64.js' import { calculateThumbprint } from '../src/utils/thumbprint.js' /** diff --git a/web-identity/src/__tests__/issuance-token.test.ts b/web-identity/src/__tests__/issuance-token.test.ts index d6fd932..2d18805 100644 --- a/web-identity/src/__tests__/issuance-token.test.ts +++ b/web-identity/src/__tests__/issuance-token.test.ts @@ -144,7 +144,6 @@ describe('IssuanceToken Functions', () => { }) it('should throw error for missing JWK algorithm', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { alg: _alg, ...keyWithoutAlg } = rsaPrivateKey await expect( @@ -153,7 +152,6 @@ describe('IssuanceToken Functions', () => { }) it('should throw error for missing JWK kid', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { kid: _kid, ...keyWithoutKid } = rsaPrivateKey await expect( @@ -295,7 +293,6 @@ describe('IssuanceToken Functions', () => { }) it('should throw error for missing cnf.jwk claim', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { cnf: _cnf, ...payloadWithoutCnf } = testPayload const header = { diff --git a/web-identity/src/__tests__/presentation-token.test.ts b/web-identity/src/__tests__/presentation-token.test.ts index 3e899d6..3205c49 100644 --- a/web-identity/src/__tests__/presentation-token.test.ts +++ b/web-identity/src/__tests__/presentation-token.test.ts @@ -230,7 +230,6 @@ describe('PresentationToken Functions', () => { }) it('should throw error for invalid JWK', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { alg: _alg, ...invalidKey } = rsaBrowserKey const issuanceTokenPayload: IssuanceTokenPayload = { diff --git a/web-identity/src/__tests__/request-token.test.ts b/web-identity/src/__tests__/request-token.test.ts index 2d5ff17..b8fad22 100644 --- a/web-identity/src/__tests__/request-token.test.ts +++ b/web-identity/src/__tests__/request-token.test.ts @@ -80,7 +80,6 @@ describe('RequestToken Functions', () => { }) it('should throw error for missing JWK algorithm', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { alg: _alg, ...keyWithoutAlg } = rsaKey await expect( @@ -89,7 +88,6 @@ describe('RequestToken Functions', () => { }) it('should throw error for missing JWK kid', async () => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { kid: _kid, ...keyWithoutKid } = rsaKey await expect(