feat: support bulk suppressions - #292
Conversation
|
|
| */ | ||
| function getSuppressionsService() { | ||
| // ESLint doesn't export SuppressionsService in package.json exports, | ||
| // so we need to resolve the path directly |
There was a problem hiding this comment.
We need to open an issue in eslint repo, ideally they should export or provide API for such things
There was a problem hiding this comment.
There's already an open issue for programmatic usage, eslint/eslint#19603 and active RFC eslint/rfcs#142. From what I can tell, the RFC proposes adding applySuppressions as constructor option to the ESLint class which I believe would make this fn moot. But since it's still RFC may take a while longer before an implementation is available on stable version. I understand a workaround may not be desirable in the meantime.
How do you want to proceed? Should we close this PR, until it can be solved proper using official APIs?
There was a problem hiding this comment.
Let's add a TODO with links above and we can merge, when they resolved it we will migrate to the official API, sorry for delay
There was a problem hiding this comment.
Done, fde678f.
And no worries about delay! I've also been busy and disconnecting over holidays. No rush from my side about this. Have a great weekend!
Make comment into a TODO to explain and motivate fix for workaround in the future.
alexander-akait
left a comment
There was a problem hiding this comment.
/cc @ricardogobbosouza Can you look at this too, thanks
|
Eslint suppressions are only available on eslint >=9 Wait #295 |
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|
@viddo could you please review testing and coverage? |
ESLint 10 takes `applySuppressions` and `suppressionsLocation` as constructor options, and the plugin already hands every ESLint option through, so the feature works with no code of its own. Cover it so a change to the pass-through cannot drop it silently, and document that ESLint resolves the suppressions file against its own `cwd` rather than the plugin's `context`. Closes #291. Supersedes #292, which predates the constructor options and reached into `eslint/lib/services/suppressions-service.js` instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy
…ecks` (#311) * test: cover ESLint bulk suppressions ESLint 10 takes `applySuppressions` and `suppressionsLocation` as constructor options, and the plugin already hands every ESLint option through, so the feature works with no code of its own. Cover it so a change to the pass-through cannot drop it silently, and document that ESLint resolves the suppressions file against its own `cwd` rather than the plugin's `context`. Closes #291. Supersedes #292, which predates the constructor options and reached into `eslint/lib/services/suppressions-service.js` instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy * refactor!: rename to diagnostics-webpack-plugin and the option to `checks` `lint-webpack-plugin` and `linter-webpack-plugin` are both taken on npm, by packages published in 2018 and 2019. `diagnostics` is the term the tools themselves use — TypeScript reports Diagnostics, and so does the Language Server Protocol — so it covers the linters running today and the type checkers and analysers meant to follow, without naming any of them. The option follows: `linters` becomes `checks`, `src/linters/` becomes `src/checks/`, and `LintError` becomes `DiagnosticError`. Nothing shipped under the old name, so the changelog still records the move as coming from `eslint-webpack-plugin`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy * chore: start the renamed package at 1.0.0 `diagnostics-webpack-plugin` is a new package on npm, so its versions start over rather than continuing `eslint-webpack-plugin`'s. Setting the version to 0.0.0 makes the pending majors resolve to 1.0.0, and the changelog says which of its entries belong to the old package. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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
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. Claude-Session: https://claude.ai/code/session_01GzZci4NQeiqwdrVfd7dGXy Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
Fixed in the main |
|
Anyway thanks for the PR |
Summary
Fixes #291 by adding support for loading SuppressionsService from ESLint that is currently used from CLI.
What kind of change does this PR introduce?
feature/bugfix
Did you add tests for your changes?
Does this PR introduce a breaking change?
No, it only amends/fix the suppressions feature.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
New option
suppressionsLocationto indicate where the suppressions file is located (if not on default location).