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
[7.0] Remove bc code from preset handling and preset-es2015 #5128
Conversation
@danez, thanks for your PR! By analyzing the history of the files in this pull request, we identified @loganfsmyth, @motiz88 and @hzoo to be potential reviewers. |
Codecov Report
@@ Coverage Diff @@
## 7.0 #5128 +/- ##
==========================================
+ Coverage 90.38% 90.43% +0.04%
==========================================
Files 200 208 +8
Lines 9925 9938 +13
Branches 2697 2695 -2
==========================================
+ Hits 8971 8987 +16
+ Misses 954 951 -3
Continue to review full report at Codecov.
|
if (typeof val !== "function" && options !== undefined) { | ||
throw new Error(`Options ${JSON.stringify(options)} passed to ` + | ||
(presetLoc || "a preset") + " which does not accept options."); | ||
if (typeof val === "function") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we standardize and require presets to be functions, and drop Object support too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can simply the logic (this code is the worst and so many hacks) then ok 👍 just want to make sure its easy to change it. We can write a migration guide + even try a codemod if that's useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for keeping stuff as simple as possible.
Okay, I made all the changes. With this changes we don't have a way currently to detect if the preset supports options or not. I tried This case will now not throw a specific message like before but rather :
|
Just an idea but I think that codeframes helps a lot new users. The error would be like:
Could also be applied to parse errors. What do you think? |
Yes, but could also be done post-7. |
any reviews for this? |
Is it possible to write a codemod for this for any easy presets? Otherwise just needs to be in the migration guide for users |
👍 The migration guide. I have this as todo in the guide. I don't exactly know how to write it. |
Yeah we should probably do this otherwise we get typos issues. |
What should we do here? Do we want to merge this? I can rebase if so |
I don't anyone was opposed so yea! |
For bc we supported exporting an object + function (as buildPreset) at the same time. This now removes the bc and a preset needs to export either an object or a function as default export or module.export.