feat: add a typescript check - #327
Merged
Merged
Conversation
Run it with `{ use: "typescript" }`, or just `"typescript"`. It builds the
program a `tsconfig.json` describes and reports its diagnostics, so a type
error in a module nothing imports yet is reported rather than waiting for
something to import it. Emit is forced off: webpack writes the output.
A type checker does not fit the shape a linter does, and the contract already
allowed for that. It declares no `resultPath`, because a diagnostic belongs to
the program rather than to the file the plugin handed over — and a check that
cannot attribute a result now gets the whole file list every compilation
rather than only what changed, since there is nothing to report a file it was
never given from.
Two things found while testing it against the documented syntax. A check could
not be named — `checks: ["eslint"]` threw, though the README has shown it
since the one-mode docs landed — so an entry may now be the name alone, which
is what a check with nothing to configure wants. And the fixtures of a new
suite need adding to the lint ignores, which is why the three existing suites
are listed there.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
This was referenced Sep 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The third check, and the first that is not a linter. Run it with
{ use: "typescript" }or just"typescript": it builds the program atsconfig.jsondescribes and reports its diagnostics as webpack errors and warnings, so a type error in a module nothing imports yet is reported rather than waiting for something to import it. Emit is forced off — webpack writes the output.It also answers whether the
checksAPI is really extensible. It is: the adapter is one file plus a schema, and the only plugin change a type checker needed is the one below.A type checker does not fit a linter's shape, and the contract already allowed for it. The adapter declares no
resultPath, because a diagnostic belongs to the program rather than to the file the plugin handed over. The one plugin change follows from that: a check with noresultPathis now given the whole file list every compilation rather than only what changed, since there is nothing to report a file it was never given from.threadsis not honoured either, TypeScript spreading its own work, and that is stated in the README.Two things turned up while testing it against the syntax the README already shows:
checks: ["eslint"]threw`use` needs the name of a built-in check, though the README has shown that form since the one-mode docs merged — my own snippet, and wrong. An entry may now be the name alone, which is what a check with nothing to configure wants.What kind of change does this PR introduce?
feat
Did you add tests for your changes?
Yes —
test/typescript/typescript.test.js, six cases over two fixture projects: a clean program reports nothing, a type error becomes a webpack error naming the file and theTScode, a file webpack never built is still checked, an unreadableconfigFilesurfaces TypeScript's ownTS5083rather than a message of ours, a formatter written in the configuration is used, andreportAsturns the errors into warnings.test/unified/unified.test.jsgains the named-check case.Does this PR introduce a breaking change?
No. The new check is opt-in, and naming a check is additive. The
resultPathchange only affects a check that declares none, of which there were none before this one.If relevant, what needs to be documented once your changes are merged or what have you already documented?
README.mdhere: aTypeScriptsection withtypescriptPath,configFileandcompilerOptions, what differs from the linters, and the intro and install lines.typescript >= 5is an optional peer inpackage.json. The webpack.js.org page wants the section after release.Use of AI
AI was used. Claude Code prototyped the TypeScript compiler API against a fixture before writing the adapter, then wrote it, the tests and the documentation, and ran the suite, lint, audit and both dist entry points. While verifying it in watch mode it found a pre-existing hole it has reported rather than fixed here: the plugin registers no
fileDependencies, so webpack does not watch a file no module imports — measured onmain, editing an unimported.scssrebuilds nothing and its Stylelint error never clears. That belongs in its own change, for every glob-reading check at once.🤖 Generated with Claude Code
https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
Generated by Claude Code