Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature: Autofixer and/or suggestions in inferable cases #40

Open
JoshuaKGoldberg opened this issue Dec 4, 2024 · 3 comments
Open

Comments

@JoshuaKGoldberg
Copy link

Manually replacing existing dependencies is a painful slog. It'd be lovely to have automated assistance from the lint rule.

My initial instinct is that there are three kinds of cases:

  • Fixer-level: APIs that are directly equivalent and can be switched to without change in behavior1
  • Suggestion-level: APIs that are generally the same and probably safe to switch to, but need manual review
  • Very different ones that are either too functionally different or too difficult to automate

Feature request: can this be added to the rule?

Footnotes

  1. Or are at least intended to be exactly the same. Even "safe" fixers sometimes can technically break teeny edge cases.

@43081j
Copy link
Contributor

43081j commented Dec 4, 2024

We currently have a codemods repo over here:

https://github.com/es-tooling/module-replacements-codemods

This tries to auto migrate between packages. But we don't yet have an easy way to execute these

The plan was originally to have a cli which does this, but maybe it's also possible we get the linter to do it

@JoshuaKGoldberg
Copy link
Author

Yeah codemods on their own are nice, but IME most developers & projects don't go the extra mile to use them. Lint rules are right there in the editor.

From another perspective: ESLint is actually a pretty good codemod platform (fixes & suggestions, inline disable comments, configuration overrides with glob matchers, ...). And it keeps things fixed over time by blocking introduced violations. I find it hard to advocate for any other codemod system 😄

@43081j
Copy link
Contributor

43081j commented Dec 9, 2024

that's true

it would be ideal I think if we could share the codemod logic between the linter and a future codemod cli

especially since the codemods repo is already consumed by some things

I'll have a ponder on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants