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

Proposal: usage-based manifest entries #151

Open
43081j opened this issue Aug 20, 2024 · 0 comments
Open

Proposal: usage-based manifest entries #151

43081j opened this issue Aug 20, 2024 · 0 comments

Comments

@43081j
Copy link
Contributor

43081j commented Aug 20, 2024

While bouncing ideas around with a friend on this recently, I realised I think we need some kind of usage-based suggestions

For example:

import {foo} from 'target-package';

foo(); // we want to replace this with `replacement-1`

foo({ someFlag: true }); // replace this with `replacement-2`

in this situation:

  • if all usages are foo() (i.e. no options passed), we want to suggest replacement-1
  • if one or more usages have options passed, we want to suggest replacement-2

we can't currently achieve this through the manifests and would end up with such logic in consumers, like the lint plugin.

maybe we could have an ast-grep JSON rule in the manifest entry to define "if this rule matches, use this replacement"

i'm not sure yet but i feel like if we had this, we'd benefit massively and could add many more modules.

opinions very much welcome! would love to hear all your ideas on this

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

1 participant