Add JSDoc type checking with a grow-only strict ratchet - #10
Conversation
Syntactic linting cannot catch a wrong property name — the 523 root cause was a .slide/.slides typo in valid JS. Type checking can, but only where the shape is annotated, and a JSDoc-presence rule would accept @PARAM {object} and catch nothing. So the gate is semantic: noImplicitAny makes every read or write through an unannotated shape an error, which forces the annotation that tsc then verifies. tsc checks the whole import graph, so a files list cannot isolate a file; scripts/typecheck-strict.mjs filters diagnostics to the paths listed in .typecheck-strict-paths instead. The list is plain text so the ratchet shows up in review, and it only grows: add every assets/ file you touch to it in the same PR and burn its findings to zero.
The parameter was annotated {object}, which the typeof narrowing on the
next line reduces to never — so the annotation described something the
function cannot accept. It takes an unknown value.
Follow-up notes — fallout from this PRFile these as issues, then replace the
Items 1–6 and 8 concern the ESLint gate and are on that PR instead. |
Adds a TypeScript
checkJsgate over the JS frontend, scoped by a grow-only path list.Stacked on
feature/eslint-frontend-linting— review that one first; this PR targets it, notrelease/3.0.0.Changes
tsconfig.checkjs.json—checkJswithnoImplicitAnyoff by defaultscripts/typecheck-strict.mjs— filters diagnostics to the paths in.typecheck-strict-paths.typecheck-strict-paths— the plain-text ratchet listWhy
Syntactic linting cannot catch a wrong property name; a typo in valid JS is invisible to it.
Type checking catches it, but only where the shape is annotated, and a JSDoc-presence rule would
accept
@param {object}and catch nothing. So the gate is semantic:noImplicitAnymakes everyread or write through an unannotated shape an error, forcing the annotation that tsc verifies.
tscchecks the whole import graph, so a files list cannot isolate a file — hence filteringdiagnostics by path instead. The list is plain text so the ratchet shows up in review, and it only
grows: add every
assets/file you touch and burn its findings to zero.