feat!: union the emit and fail options into one reportAs - #315
Merged
Conversation
alexander-akait
force-pushed
the
feat/union-emit-and-fail-options
branch
from
September 7, 2026 18:15
479af01 to
ecbd791
Compare
`emitError` and `emitWarning` become one `emit`, and `failOnError` and `failOnWarning` one `failOn`. Each takes `"warning"`, `"error"` or `false`, naming the least severe result it takes in, so `"warning"` covers the errors above it and `false` covers nothing. Reporting the errors of a check while hiding its warnings is a threshold, not a set, so one value says it and no combination of two spells a state that is not one. `emitError: false` alone loses its spelling with them: showing a check's warnings while hiding its errors was never useful. Defaults carry the old behaviour over: `emit` is `"warning"`, and `failOn` is `"error"` outside `development` mode and `false` inside it. `quiet` is now exactly `emit: "error"`. Both options resolve through `??`, so one written out as `undefined` reads as the one left unwritten. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
alexander-akait
force-pushed
the
feat/union-emit-and-fail-options
branch
from
September 7, 2026 18:53
ecbd791 to
2507357
Compare
alexander-akait
force-pushed
the
feat/union-emit-and-fail-options
branch
2 times, most recently
from
September 7, 2026 20:48
a663cc5 to
586aba6
Compare
`emitError`, `emitWarning`, `failOnError` and `failOnWarning` become one
option taking `"error"`, `"warning"` or `false`. It says what a check reports
its results as, and reporting one as a webpack error is what fails the build,
so there is nothing left for a second option to say.
reportAs: undefined // each result at its own severity: errors fail, warnings do not
reportAs: "error" // everything fails the build, warnings included
reportAs: "warning" // nothing fails the build
reportAs: false // nothing is reported
The name answers the question the option asks. `emit` was inherited from
`emitError` and `emitWarning`, where the answer was whether to report at all;
this one answers what to report a result as, and a name that says "whether"
invites reading `"error"` as "errors only".
Left unset the default is unchanged, so a check no longer reports into errors
and warnings by anyone's instruction — it does so because that is what its
results are, and one value overrides it. `quiet` keeps dropping the warnings
before that, which is how the errors are reported alone.
The plugin no longer aborts the compilation. A result reported as a webpack
error fails the build the way every other webpack error does, with the assets
still written; webpack's own `bail` does not reach an error pushed this late,
so the abort was the plugin's alone and is gone with `failOn`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
alexander-akait
force-pushed
the
feat/union-emit-and-fail-options
branch
from
September 8, 2026 09:14
586aba6 to
4815bcf
Compare
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
emitError,emitWarning,failOnErrorandfailOnWarningbecome one option taking"error","warning"orfalse. It says what a check reports its results as — and reporting one as a webpack error is what fails the build, so there is nothing left for a second option to say."error""warning"falseoutputReportis still written.The name answers the question the option asks.
emitwas inherited fromemitError/emitWarning, where the answer was whether to report at all. This option answers what to report a result as — and a name that says "whether" invites reading"error"as "errors only", which is exactly how it kept being misread while the shape was settling.Left unset the default is unchanged, so a check no longer reports into errors and warnings by anyone's instruction — it does so because that is what its results are, and one value overrides it.
quietkeeps dropping the warnings before that, which is how a check's errors are reported alone.The plugin no longer aborts the compilation. A result reported as a webpack error fails the build the way every other webpack error does, with the assets still written. Worth knowing, because it was the one thing
failOndid thatreportAsdoes not: webpack's ownbaildoes not reach an error pushed atprocessAssets— measured,bail: truestill returns stats withhasErrors()true rather than erroring the run — so that abort was the plugin's alone, and it goes withfailOn.Nothing else is lost. The four booleans expressed six distinct behaviours between them; all six are still reachable, measured on real builds — where a result of each severity landed, and whether the build came out failed:
reportAs: falsereportAs: "warning",quiet: truereportAs: "warning"quiet: truereportAs: "error"The schema refuses
true,"info",[],["error"]and{ error: "error" }.reportAsandquietare now applied by the plugin rather than by each adapter, sosplitResultsis a pure split by the result's own severity and a check shipped outside this package — which cannot know about either option — gets both for free. Writing the docs is what surfaced that: the sample adapter in the README honoured neither.What kind of change does this PR introduce?
feat (breaking).
Did you add tests for your changes?
Yes. The eight files named after single booleans —
emit-error,emit-warning,fail-on-error,fail-on-warning, twice over for ESLint and Stylelint — become onereport-as.test.jsper check, covering every value,quietalongside it, an option written out asundefined, and what the schema refuses; plus a case for a third-party adapter implementing neither option. 121 passing.Does this PR introduce a breaking change?
Yes:
emitError,emitWarning,failOnErrorandfailOnWarningare gone, and the plugin no longer aborts the compilation. Nothing has shipped under this package name, so it lands in the same unreleased major as the rename. The README's migration guide carries the old-to-new table.If relevant, what needs to be documented once your changes are merged or what have you already documented?
Documented here: the
Errors and warningssection rewritten for the one option, both migration guides given the old-to-new table and the note that the build is no longer aborted, and the adapter contract inAdding a checkcorrected to say the plugin appliesreportAsandquiet. The note aboutdevelopmentmode not failing the build is dropped along with the behaviour. The changeset is a major. Nothing is left outstanding beyond whatever the eventual webpack.js.org page for the renamed plugin needs.Use of AI
Written with Claude Code, driven interactively. It proposed a boolean, then a severity list, then a threshold, then an object keyed by severity; I turned down each one — a run reporting into errors and warnings at once is the wrong shape, and two options for one question is one too many — and then asked for a better name than
emit. It verified rather than assumed where it mattered: thatbaildoes not cover an error pushed atprocessAssets, so it could say what dropping the abort actually costs, and that all six behaviours survive, by measuring where each severity lands. It also found that a merged default let an explicitundefinedsilence the plugin, and that the sample adapter in the README ignored two options — which is what moved them into the plugin. I reviewed the result.🤖 Generated with Claude Code
https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy