feat: apply ESLint bulk suppressions below ESLint 10 - #310
Merged
Conversation
alexander-akait
force-pushed
the
test/eslint-suppressions
branch
from
September 7, 2026 15:06
8231e93 to
127dfd3
Compare
ESLint 10 takes `applySuppressions` and `suppressionsLocation` as constructor options and the plugin already passes them through. ESLint 9.24 ships the same service but wires it into its CLI alone, so the plugin now drives it after linting, resolving the file and the paths inside it against ESLint's `cwd` exactly as ESLint 10 does. Below 9.24 the option raises an error naming the version rather than silently reporting what was meant to be suppressed. The service is read by path because ESLint's `exports` hides it; the manifest is resolved through `eslint/package.json`, which works on Windows too. Covers an absolute `suppressionsLocation`, a nested file and a suppressions file outside `cwd`, the cases #292 raised. Closes #291. Supersedes #292. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
alexander-akait
force-pushed
the
test/eslint-suppressions
branch
from
September 7, 2026 15:41
dedbecb to
751d480
Compare
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
Closes #291. Supersedes #292, whose conflicts this carries forward instead.
Bulk suppressions now work on every ESLint this plugin supports:
applySuppressionsandsuppressionsLocationas constructor options, and the plugin already hands unrecognised ESLint options to theESLintclass as they are. Nothing needed.SuppressionsServicebut wires it into its CLI alone, and the constructor rejects the options outright withInvalid Options: - Unknown options: applySuppressions. The plugin now drives the service itself after linting.The ESLint 9 path resolves the file and the paths recorded inside it against ESLint's
cwd, and reads the default nameeslint-suppressions.jsonwhen no location is given — the same rules ESLint 10 applies, so one config behaves identically on both and the tests run unmodified against each.Two details behind that:
exportshides the service, so it is loaded by absolute path rather than by specifier. The package directory comes from resolvingeslint/package.json, which respectseslintPathand works on Windows. feat: support bulk suppressions #292 stripped/lib/api.jsoff the resolved entry with a POSIX-only regexp, so its fallback silently did nothing there.DEFAULT_SUPPRESSIONS_FILENAMEis an ESLint 10 addition. ESLint 9 hardcodes the name in its CLI, so reading the constant gaveundefinedand apaths[1] must be of type stringcrash — caught only by running the suite against 9.Credit for finding the bug and for the shape of these cases goes to @viddo.
What kind of change does this PR introduce?
feat.
Did you add tests for your changes?
Yes.
test/suppressions.test.jscovers eight cases: no file, the default file, a namedsuppressionsLocation, an absolute one, a nested file recorded relative tocwd, a suppressions file outsidecwdreached with../, partial suppression that still reports the rest, and a location naming no file. They are gated at ESLint 9.24 and run on both majors — 132 passing on ESLint 10, 134 on ESLint 9 (the two eslintrc suites also run there). I checked they hold something: deletingapplySuppressionsfromgetESLintOptionsturns three of them red on ESLint 10, and the ESLint 9 path was written against a failing suite.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
The README's
Suppressionssection under## ESLintcovers the options, thecwdcaveat and the version requirement. The changeset is a minor.Use of AI
Written with Claude Code, driven interactively. I asked it to fold #292 into this PR; it established that ESLint 10 makes #292's private-API module unnecessary, wrote the ESLint 9 fallback against the same service, and found the two portability defects above by running the suite on both majors. I reviewed the result.
Note
The first commit of this PR reached
mainalready, through #311's squash while this was stacked under it. What is left here is the feature.🤖 Generated with Claude Code
https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy