lint: type-checked eslint rules #15

Sammanfogat
supernaut sammanfogade 1 incheckning från lint/type-checked in i main 2026-07-29 20:14:38 +00:00
Ägare

Enables typescript-eslint's recommendedTypeChecked (#59). Our eslint was syntax-only, so it could
not see unawaited promises or any from untyped API responses flowing into logic — the defect class
that matters most in a service that mutates production Forgejo and Kanidm.

21 findings, and the interesting part is where they were

20 of the 21 were require-await — and every one is in test scaffolding, not production code:
src/testing/fakes.ts (which its own header describes as "Recording fakes for the Kanidm and Forgejo
seams") and src/members.test.ts.

That distinction decides the fix. The fakes declare async to satisfy the real client interfaces and
then return canned values, so there is nothing to await — that is the point of a fake, not an
oversight. Every production async in this repo does await properly (forgejo-http.ts's hard()
awaits this.request(...), and so on).

So require-await is switched off for **/*.test.ts and src/testing/** only, via the config's
existing "Test ergonomics" override block — which already scopes no-dynamic-delete and
no-non-null-assertion the same way. It stays on everywhere else, where a missing await is a
genuine bug.

The alternative — mass-editing 20 call sites in code that provisions and mutates production
infrastructure to satisfy a rule that has no signal there — would have been the wrong trade.

Also

  • one no-unnecessary-type-assertion, auto-fixed
  • parserOptions.projectService with allowDefaultProject for the root config files (*.mjs,
    vitest.config.ts), which otherwise fail to parse rather than being linted

Why recommendedTypeChecked and not strictTypeChecked

The stricter tier is declared non-stable upstream, and its no-unnecessary-condition rule fires on
exactly the defensive guards that protect untrusted runtime data. Not worth the false-positive tax.

Refs #59

Enables typescript-eslint's `recommendedTypeChecked` (#59). Our eslint was syntax-only, so it could not see unawaited promises or `any` from untyped API responses flowing into logic — the defect class that matters most in a service that mutates production Forgejo and Kanidm. ## 21 findings, and the interesting part is where they were 20 of the 21 were `require-await` — and **every one is in test scaffolding**, not production code: `src/testing/fakes.ts` (which its own header describes as "Recording fakes for the Kanidm and Forgejo seams") and `src/members.test.ts`. That distinction decides the fix. The fakes declare `async` to satisfy the real client interfaces and then return canned values, so there is nothing to await — that is the point of a fake, not an oversight. Every **production** `async` in this repo does await properly (`forgejo-http.ts`'s `hard()` awaits `this.request(...)`, and so on). So `require-await` is switched off for `**/*.test.ts` and `src/testing/**` only, via the config's existing "Test ergonomics" override block — which already scopes `no-dynamic-delete` and `no-non-null-assertion` the same way. It stays **on** everywhere else, where a missing await is a genuine bug. The alternative — mass-editing 20 call sites in code that provisions and mutates production infrastructure to satisfy a rule that has no signal there — would have been the wrong trade. ## Also - one `no-unnecessary-type-assertion`, auto-fixed - `parserOptions.projectService` with `allowDefaultProject` for the root config files (`*.mjs`, `vitest.config.ts`), which otherwise fail to parse rather than being linted ## Why `recommendedTypeChecked` and not `strictTypeChecked` The stricter tier is declared non-stable upstream, and its `no-unnecessary-condition` rule fires on exactly the defensive guards that protect untrusted runtime data. Not worth the false-positive tax. Refs #59
supernaut lade till 1 incheckning 2026-07-29 20:06:27 +00:00
lint: type-checked eslint rules
Alla kontroller lyckades
ci / ci (pull_request) Successful in 24s
513cf15754
supernaut sammanfogade incheckning bf8f665dbb till main 2026-07-29 20:14:38 +00:00
supernaut tog bort grenen lint/type-checked 2026-07-29 20:14:38 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-07-29 20:14:39 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-08-03 09:41:30 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-auth-reconciler!15
Ingen beskrivning angiven.