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

delete stubs if the lib ends up being flow typed #4158

Open
Brianzchen opened this issue Nov 10, 2021 · 3 comments
Open

delete stubs if the lib ends up being flow typed #4158

Brianzchen opened this issue Nov 10, 2021 · 3 comments
Labels
cli Related to CLI tool enhancement An addition to an existing component

Comments

@Brianzchen
Copy link
Member

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
If I install a dependency and it's not flowtyped currently we will install a stub. But if the lib becomes flow typed in the future as I'm doing right now across some libs in my team it doesn't delete the file so there needs to be manual intervention

If the current behavior is a bug, please provide the steps to reproduce.
Pretty self explanatory I hope

What is the expected behavior?
If I run flow-typed install and it skips because there is a typed lib, then also search if there's a stubbed module for that lib and if so delete it

If this is a feature request, what is motivation or use case for changing the behavior?
It gives a cleaner DX and encourages more flowtype users

@pascalduez
Copy link
Member

Good idea, but removing the stub automatically is a bit risky, let's say the user wrote some custom defs for their needs without contributing it to flow-typed. An interactive way with a prompt would be cool, obviously more work...

@Brianzchen
Copy link
Member Author

We already have logic that removes stubs after a real type def is defined, but we stop if the stub has been modified. I think we could lean on the same logic there and we'll be safe

@Brianzchen
Copy link
Member Author

fyi message looks like this

universal-cookie@^4.0.3': Stub already exists and has been modified. Use --overwrite to overwrite

@Brianzchen Brianzchen added this to Todo in Brian's watchlist Nov 23, 2021
@Brianzchen Brianzchen added cli Related to CLI tool enhancement An addition to an existing component labels Jan 30, 2022
@Brianzchen Brianzchen moved this from Todo to Working on in Brian's watchlist Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to CLI tool enhancement An addition to an existing component
Projects
Development

No branches or pull requests

2 participants