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: New simpler onwarn API #2040

Closed
Conduitry opened this issue Feb 2, 2019 · 3 comments
Closed

Proposal: New simpler onwarn API #2040

Conduitry opened this issue Feb 2, 2019 · 3 comments
Milestone

Comments

@Conduitry
Copy link
Member

As discussed in chat, it may be nice to simplify the onwarn callback API. Currently, it accepts two arguments, a warning object and the default onwarn handler. Consumers can inspect the warning object and decide whether and how to call the default onwarn handler.

Instead, it could just accept a warning object, and return a boolean, indicating whether the compiler should display this warning. Slightly less powerful (but I don't see any real uses for the power we would use), and simpler to understand.

@Conduitry
Copy link
Member Author

Conduitry commented Feb 14, 2019

Another radical, even simpler idea: No onwarn handling in the core compiler at all. It just returns the array of warnings in the stats, and it's up to the bundler plugin or whatever to have some way to handle it. This might be a bad idea. But there is something appealing to me about making the compiler a completely pure function - no side-effects, no i/o of any sort.

@Rich-Harris
Copy link
Member

I like the second idea, it makes a lot of sense

This was referenced Feb 17, 2019
Rich-Harris added a commit that referenced this issue Feb 17, 2019
@Rich-Harris
Copy link
Member

closed via #2093

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