Skip to content

fix: exclude every module a resource query matches - #353

Merged
alexander-akait merged 1 commit into
mainfrom
fix/resource-query-flags
Sep 14, 2026
Merged

alexander-akait merged 1 commit into
mainfrom
fix/resource-query-flags

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

Summary

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: with two modules of the same query, no exclude reports 2 files, /media/ reports 0, and /media/g reports 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", which removeIgnoredWarnings drops. The case passed identically with resourceQueryExclude removed. It now lints two .js modules of the same query and counts what is reported, including a case for the flags.

Noticed while writing it, not changed here: resourceQueryExclude accepts ["media"] but rejects "media" — the schema says RegExp | array, the JSDoc typedef says RegExp | RegExp[] | string | string[], and the README says RegExp | 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.js is rewritten against fixtures/query-exclude/, with a control (nothing excluded → 2 files) so the cases mean something. The flags case fails against unmodified src/. The unused binary fixture is removed.

Does this PR introduce a breaking change?

No — g/y on 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

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.
@alexander-akait
alexander-akait merged commit 290ff5b into main Sep 14, 2026
13 checks passed
@alexander-akait
alexander-akait deleted the fix/resource-query-flags branch September 14, 2026 12:39
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