Skip to content

refactor!: files is include - #326

Open
alexander-akait wants to merge 2 commits into
mainfrom
refactor/files-to-include
Open

refactor!: files is include#326
alexander-akait wants to merge 2 commits into
mainfrom
refactor/files-to-include

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

Summary

Every equivalent plugin for the other bundlers spells this option include — the name comes from rollup's own filter helper, which most of them build on — and we were the one of seven that did not. A rename has to happen before 1.0.0 ships or never, which is why it is worth doing now rather than later.

Renaming it also gives files back to the checks. Stylelint has an option of that name, and the plugin was taking the word for itself and then passing its value along; each lint names its own file list and replaces that value, so it is now dropped from what Stylelint is told, and files written in a stylelint entry means Stylelint's files untouched.

One thing came along with it: the dedupe the module phase does is a Set rather than Array#includes over a growing list. It is asked of every module of every build, so it was a scan per module.

Stacked on #325, which is where include's "checks a file webpack never built" behaviour comes from — its commit is in this branch and leaves the diff once it merges. Review the last commit only.

What kind of change does this PR introduce?

refactor

Did you add tests for your changes?

The existing cases move to the new name, and test/stylelint/stylelint-options.test.js gains the assertion that matters here: given both files and include, Stylelint is told files and never include.

Does this PR introduce a breaking change?

Yes. files at the top level or in a check entry becomes include. A stylelint entry that wrote files meaning "the files to check" keeps working by accident — Stylelint reads it — but should move to include to be checked the same way as every other check. Both migration tables in README.md record the rename.

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

README.md here: the option's own section, every reference to it, the third-party check example, and both migration tables. The webpack.js.org page wants the rename after release.

Use of AI

AI was used. Claude Code checked the name against the published option sets of the Vite, Rollup and esbuild plugins, traced every read of files through the source before moving it, found that the value handed to Stylelint was always replaced, and ran the suite, lint, audit and both dist entry points. It also corrected itself mid-change: it had reported that the option's array doubled as the dedupe accumulator, which the runner's own spread rules out.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy


Generated by Claude Code

alexander-akait and others added 2 commits September 11, 2026 08:42
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
Every equivalent plugin for the other bundlers spells this `include` — the
name comes from rollup's own filter helper, which most of them build on — and
we were the one of seven that did not.

Renaming it also gives `files` back to the checks. Stylelint has an option
of that name, and the plugin was taking the word for itself and then handing
its value over; the value was replaced by each lint's own file list anyway,
so it is dropped from what Stylelint is told and `files` now means
Stylelint's `files` wherever it is written.

The dedupe the module phase does is a set rather than a scan of an array
while the names are moving: it is asked of every module of every build.

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