sindresorhus/eslint-plugin-unicorn

prevent-abbreviations: when multiple replacements are defined, suggest each through ESLint's suggest API

Closed

#767 opened on Jun 3, 2020

 (4 comments) (3 reactions) (0 assignees)JavaScript (468 forks)user submission
enhancementhelp wanted

Repository metrics

Stars
 (5,022 stars)
PR merge metrics
 (Avg merge 1d 16h) (399 merged PRs in 30d)

Description

Currently, the prevent-abbreviations autofixer only applies when there is only a single replacement defined. But when multiple replacements are there (if the abbreviation is ambiguous) the violation has to be fixed manually.

It would be nice if the replacements were all suggested to the user in the editor/IDE to pick from. ESLint has the suggest API for this: https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions

Contributor guide