lint: type-checked eslint rules #7

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

Enables typescript-eslint's recommendedTypeChecked (#59). Our eslint was syntax-only, so it was
structurally unable to see the class of defect that matters most here: unawaited promises, and any
from untyped API responses flowing into logic.

It found a real landmine on the refund path

src/provider/mollie.ts compared Mollie's RefundStatus enum against a bare string literal:

refund.status === "refunded" // no-unsafe-enum-comparison

This type-checks and is correct today — RefundStatus.refunded does equal "refunded". But it
is not enum-safe: if that member's value ever shifted, the comparison becomes silently always-false
and every refund would report "failed". That is the one code path where a wrong answer is
financially consequential, and it is the same path that already carries the double-refund hazard
tracked separately.

Now compares RefundStatus.refunded — behaviour-preserving today, and safe against the SDK changing
underneath us. No syntax-only rule could have seen this.

Also

  • no-unnecessary-type-assertion in mollie.test.ts — a redundant as never as double assertion
    reduced to a single as. Auto-fixed; it still checks the same shape.
  • parserOptions.projectService with allowDefaultProject for the root config files
    (vitest.config.ts, drizzle.config.ts, *.mjs). Without it they fail to parse rather than being
    linted, since they sit outside tsconfig's include.

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 — which this service has
deliberately. Not worth the false-positive tax.

Verified by the hooks on the way in: pre-commit ran eslint clean, pre-push ran build plus the full
suite (58 tests, 9 files).

Refs #59

Enables typescript-eslint's `recommendedTypeChecked` (#59). Our eslint was syntax-only, so it was structurally unable to see the class of defect that matters most here: unawaited promises, and `any` from untyped API responses flowing into logic. ## It found a real landmine on the refund path `src/provider/mollie.ts` compared Mollie's `RefundStatus` **enum** against a bare string literal: ```ts refund.status === "refunded" // no-unsafe-enum-comparison ``` This type-checks and is correct **today** — `RefundStatus.refunded` does equal `"refunded"`. But it is not enum-safe: if that member's value ever shifted, the comparison becomes silently always-false and **every refund would report `"failed"`**. That is the one code path where a wrong answer is financially consequential, and it is the same path that already carries the double-refund hazard tracked separately. Now compares `RefundStatus.refunded` — behaviour-preserving today, and safe against the SDK changing underneath us. No syntax-only rule could have seen this. ## Also - `no-unnecessary-type-assertion` in `mollie.test.ts` — a redundant `as never as` double assertion reduced to a single `as`. Auto-fixed; it still checks the same shape. - `parserOptions.projectService` with `allowDefaultProject` for the root config files (`vitest.config.ts`, `drizzle.config.ts`, `*.mjs`). Without it they fail to parse rather than being linted, since they sit outside tsconfig's `include`. ## 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 — which this service has deliberately. Not worth the false-positive tax. Verified by the hooks on the way in: pre-commit ran eslint clean, pre-push ran build plus the full suite (58 tests, 9 files). Refs #59
supernaut lade till 1 incheckning 2026-07-29 20:06:19 +00:00
lint: type-checked eslint rules
Alla kontroller lyckades
ci / ci (pull_request) Successful in 29s
7026918aea
supernaut sammanfogade incheckning da1e9a60da till main 2026-07-29 20:13:36 +00:00
supernaut tog bort grenen lint/type-checked 2026-07-29 20:13:36 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-07-29 20:13:38 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-08-03 09:41:39 +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-payment!7
Ingen beskrivning angiven.