fix: exclude every module a resource query matches - #353
Merged
Merged
Conversation
Every module's query is asked of the same regexp object, and `test` on one carrying `g` or `y` starts where the last answer left off — so `resourceQueryExclude: /raw/g` excluded every other module rather than every one of them. The regexp is now taken without those two flags. The test that covered this option could not have caught it: its fixture is a `.ts` file, which ESLint's flat config does not match, so nothing was ever linted and the case passed with the option removed. It now lints two `.js` modules of the same query and counts what is reported.
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
Every module's query is asked of the same regexp object, and
teston one carryinggorystarts where the last answer left off. SoresourceQueryExclude: /raw/gexcluded every other module: with two modules of the same query, no exclude reports 2 files,/media/reports 0, and/media/greports 1. The regexp is now taken without those two flags.The test that covered this option could not have caught it. Its fixture is
media/some-video.ts— an actual binary MPEG stream — and ESLint's flat config does not match.ts, so the file was reported as "File ignored because no matching configuration was supplied", whichremoveIgnoredWarningsdrops. The case passed identically withresourceQueryExcluderemoved. It now lints two.jsmodules of the same query and counts what is reported, including a case for the flags.Noticed while writing it, not changed here:
resourceQueryExcludeaccepts["media"]but rejects"media"— the schema saysRegExp | array, the JSDoc typedef saysRegExp | RegExp[] | string | string[], and the README saysRegExp | RegExp[]. Three different answers; happy to reconcile them separately.What kind of change does this PR introduce?
fix.
Did you add tests for your changes?
Yes —
test/resource-query.test.jsis rewritten againstfixtures/query-exclude/, with a control (nothing excluded → 2 files) so the cases mean something. The flags case fails against unmodifiedsrc/. The unused binary fixture is removed.Does this PR introduce a breaking change?
No —
g/yon this option had no coherent meaning to lose.If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a.
Use of AI
AI was used. It found both the flag bug and the test that guarded nothing while auditing the plugin, reproduced each before changing anything, and wrote the fix and the rewritten test.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
Generated by Claude Code