feat: check the files named by files, built by webpack or not - #325
Open
alexander-akait wants to merge 1 commit into
Open
feat: check the files named by files, built by webpack or not#325alexander-akait wants to merge 1 commit into
files, built by webpack or not#325alexander-akait wants to merge 1 commit into
Conversation
The ESLint check read the module graph and nothing else, so a file webpack never built was invisible to it: a module nothing imports yet went unchecked until something imported it. Stylelint walked the file system and did not have the problem, which made `files` mean two things depending on which check read it. It means one thing now. Naming `files` says what to check, so every file they match is checked; leaving it unset keeps each check reading what it read before, which is the module graph for ESLint and a walk for Stylelint. The walk is the one the Stylelint check already used, so this chooses between two paths that both existed rather than adding a third. No option was added for it. A check that has been told which files to look at has been told enough. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
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 ESLint check read the module graph and nothing else, so a file webpack never built was invisible to it — a module nothing imports yet went unchecked until something imported it. The Stylelint check walked the file system and never had the problem, which meant
filesanswered differently depending on which check read it.Measured on the same fixture and config before changing anything: one unimported file with an unused variable gave 0 errors through the module graph and 1 through the walk.
It means one thing now. Naming
filessays what to check, so every file they match is checked; leaving it unset keeps each check reading what it read before — the module graph for ESLint, a walk for Stylelint. The walk is the one the Stylelint check already used, so a check now chooses between two paths that both existed rather than gaining a third.No option was added. A check that has been told which files to look at has been told enough — the resolved
filesSourceis simplyoptions.files ? "glob" : adapter.filesSource, and the three places that read it read the resolved value rather than the adapter's.What kind of change does this PR introduce?
feat
Did you add tests for your changes?
Yes —
test/outside-graph.test.js, three cases over a newtest/fixtures/outsideholding one imported file and one nothing imports: withoutfilesnothing is reported, withfilesthe unimported one is, and withfilesthe imported one is also linted. That last case reads the recorder mock rather than the reported errors, so it proves the walk covers the graph's files too instead of replacing them.Does this PR introduce a breaking change?
Yes, for a configuration that sets
fileson a check reading the module graph: such a check used to treat them as a filter over what webpack built and now checks everything they match, so files webpack does not bundle can start reporting. Droppingfilesrestores the old set, and narrowing them — orexclude— limits the walk.If relevant, what needs to be documented once your changes are merged or what have you already documented?
The
filessection ofREADME.mdand the option's schema description say it here. The webpack.js.org page wants the same after release.Use of AI
AI was used. Claude Code measured the gap against the equivalent plugins for other bundlers, confirmed by running a build that the existing glob path already caught the unimported file, then made the choice follow from
files, wrote the tests and the documentation, and ran the suite, lint, audit and both dist entry points.🤖 Generated with Claude Code
https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
Generated by Claude Code