-
Notifications
You must be signed in to change notification settings - Fork 103
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
Fix for #7: Not as optimized for Webpack as it could be. #28
Conversation
…dds ability to wrap functions that are elements of an array literal in an argument list
This is awesome!! 🎉 I'm eager to merge, but have a few suggestions:
All in all though, great work and if you don't have time to address # 2 then I can take care of it after I merge. |
|
I added four negative test cases for array literals. I feel like I didn't have a ton of creativity in making these test cases, though, so let me know if there are some more ones you'd like! |
Actually, it just occurred to me that this could be designed to be more specific to webpack if we want. Right now the logic of this PR is:
But if we wanted to make it even more specific to webpack, we could make the logic instead be:
I'm inclined to change it that way. What do you think? |
I coded up a more webpack-specific version in PR #33, which is now my preference, I think. |
Aaaaaand I went ahead and added a webpack benchmark in PR #34 in case you want to use it. (I unexpectedly had a bunch of time this weekend and have found working on this surprisingly fun...) |
Yeah I agree that #33 is a more targeted solution. I'd prefer for this tool to be conservative to avoid over-parsing functions. Thanks for offering options with multiple PRs! :) |
Adds ability to wrap functions that are elements of an array literal in an argument list.
I refactored some of the if-else logic into named functions that were easier for me to understand, but I'm not sure if they will be easier for others or not. Feedback welcome.
npm run test
runs green andnpm run coverage
gives 100%.Running on the benchmark repo from The Cost of Small Modules on my MBP (and snipping out non-webpack versions for space), I get:
Chrome 54.0.2840.71
Firefox 48.0.2
Safari 9.1.3
Thanks for all your work!