-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
API for temporarily supressing experimental warnings #55505
Comments
WDYT about true // disable all
"EXPZZ" // disable "EXPZZ"
["EXPZZ", "EXPYY"] // disable both Even more so, we could condense the no-deprecation and no-experimental into a single disable-warnings functionality, where codes for both can be specified. E.G.
Etc |
A polymorphic property can be more confusing, it's better to keep the type consistent. |
As an author of a CommonJS tool that probes dynamic module names of unknown pedigree to I appreciate the work on enabling
Thank you for your time and consideration. PS - If interesting for any reason, this is the relevant code from PPS - If there are better ways to implement this behavior, I'm happy to learn of them. There are some extra levels of indirection at play in the code above due to it needing to support dynamic module import after being Webpack'd and also needing to run in Node, browser, and VS Code (WebWorker) context. |
Spinned off from #55417 to discuss about this more generally.
While it can be abused and lead to unwanted issues, I think CLI tools tend to inevitably want to do it for a cleaner output and will find their way to do it already. One example that I've found previously was how Yarn does it by temporarily monkey-patching
process.emit
https://github.com/yarnpkg/berry/blob/031b5da1dc8e459e844efda137b2f00d7cdc9dda/packages/yarnpkg-pnp/sources/loader/applyPatch.ts#L304-L325
So I think we might as well provide a proper API for this instead of having users resort to monkey-patching.
We could either just have something quick and simple like
process.noExperimentalWarning
toggle that gets checked before the warning is emitted (similar toprocess.noDeprecation
):Or some API that toggles specific warnings (this requires assigning code to experiments, which we currently do not have):
Or some API that takes a function and run it without emitting warnings (may be a bit awkward for async APIs, but ensures that users don't forget to toggle it back):
For the ones that take codes we could also merge it with deprecation warning handling and just have e.g.
process.silenceWarning()
/process.runWithoutWarning()
that also acceptsDEP
codes.More ideas are welcomed, too.
The text was updated successfully, but these errors were encountered: