Change Request: Support applying suggestions #18264
Labels
core
Relates to ESLint's core APIs and features
enhancement
This change enhances an existing feature of ESLint
ESLint version
HEAD
What problem do you want to solve?
There is no currently no way to apply suggestions from rules via the CLI or programmatically.
Suggestions are primarily chosen instead of fixers as:
no-unused-vars
)no-console
)Automatically applying suggestions is primarily intended for the cases 1) and 2),
as the user can specifically say my current code is complete (especially useful for git commit hooks) and they know the potential risks.
What do you think is the correct solution?
A new option
applySuggestions
for the CLI and a new static methodapplySuggestions
, similar to the existingoutputFixes
, on theESLint
class.These would be given a list of specifiers in the format
{RULE_ID}:{SUGGESTION_MESSAGE_ID} of which suggestions to apply. The suggestion message id may be optional if the rule only provides a single suggestion, e.g. from
no-console`.Participation
Additional comments
This issue is only for checking whether there is any interest in this before writing a more in depth RFC.
The text was updated successfully, but these errors were encountered: