Skip to content

feat: check the files named by files, built by webpack or not - #325

Open
alexander-akait wants to merge 1 commit into
mainfrom
feat/files-outside-the-graph
Open

feat: check the files named by files, built by webpack or not#325
alexander-akait wants to merge 1 commit into
mainfrom
feat/files-outside-the-graph

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

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 files answered 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 files says 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 filesSource is simply options.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 new test/fixtures/outside holding one imported file and one nothing imports: without files nothing is reported, with files the unimported one is, and with files the 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 files on 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. Dropping files restores the old set, and narrowing them — or exclude — limits the walk.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

The files section of README.md and 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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant