Change Request: Notify plugins when a fix has been applied #16143
Labels
archived due to age
This issue has been archived; please open a new issue for any further discussion
core
Relates to ESLint's core APIs and features
enhancement
This change enhances an existing feature of ESLint
needs design
Important details about this change need to be discussed
Projects
ESLint version
v8.20.0
What problem do you want to solve?
Context
As the author of the spellchecker plugin: @cspell/eslint-plugin, I would like to present the user a "fix" that allows the user to add a word to their custom dictionary. See: CSpell ESLint Plugin: Configuration option to add words to the dictionary · Issue #3233.
When used with an editor extension like VS Code ESLint, something like the following would show up:
If the fix is applied, the spellchecker plugin would add the word to the custom dictionary.
Problem
In the current ESLint implementation, a
ReportFixer
does not have the ability to provide a custom fix action or to know if a fix has been applied so it can take a custom action.What do you think is the correct solution?
Two options came to mind:
context
provides an event emitter than can be listen to:applied
function toFix
that is called when a fix has been applied.This is the easiest fix:
eslint/lib/linter/source-code-fixer.js
Lines 102 to 106 in 0bcd225
Becomes something like this:
Participation
Additional comments
No response
The text was updated successfully, but these errors were encountered: