-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
A trailing comma is not permitted after the rest element - ListView.js 457:14 #10199
Comments
just hit the same issue |
Just run into the same thing. Worked with
Broken with
Investigating further. |
Same here |
Yep. Lots of stuff different packages under |
Same here on node v6.3.1 but working on another machine running v6.4 |
@mlazowik good find, looks like babel has changed the spec for object destructuring. I'm going to make a pull request unless you want to? |
@colinlmcdonald making one right now :) |
confirming that @colinlmcdonald temp fix works OSX El Capitan 10.11.6 |
Since babylon seems to think point releases are ok for fundamental parsing strictness changes, maybe React Native should pin to exact versions of bablyon? |
What's the fix? |
Same problem here. |
Deleting the trailing commas in ListView.js @ line 457, Restart your package manager. If the changes don't take effect then try closing out Xcode and the simulator. Then reopen each of them. |
The fix for me is a lot of monkey patching inside |
Here are the file paths: node_modules/react-native/Libraries/CustomComponents/ListView/ListView.js node_modules/react-native/Libraries/CustomComponents/NavigationalExperimental/NavigationCard.js node_modules/react-native/Libraries/Utilities/MessageQueue.js |
@npomfret / @Carrington-Dennis -- lots of other node modules are going to be hit by this too. I suggest reloading the app and following the redbox errors to see where is affected, making PRs to those projects. As an example, react-native-vector-icons also got smacked by this babel change. |
And use shrinkwrap. |
@npomfret try the method @Carrington-Dennis suggests. Just confirmed it works until the rest gets sorted out. |
confirming monkey patching works |
Yeah to confirm this is from babel/babylon#149, babel/babylon#149 (comment) in v6.11.3 Can do a patch now to rollback since it can be too much trouble to change. |
@Carrington-Dennis last one is node_modules/react-native/Libraries/Utilities/MessageQueue.js not: node_modules/react-native/Libraries/Utilities/ListView/MessageQueue.js 👀 |
@jnmandal correct. Thank you. I just changed my original reply to node_modules/react-native/Libraries/Utilities/MessageQueue.js |
Sorry about that yall - didn't intend to make a bad experience using react-native with those issues. Released babel/babylon#154 with v6.11.4 which reverts the issue. You'll need to reinstall I think for most projects you don't compile node_modules (there's a dist/lib folder used in npm) so you're able to just fix the errors in your own application when it happens and you update. However, if another project's files cause errors it's basically out of your hands unless you change node_modules yourself. (I didn't think of this at the time). |
Thanks @hzoo for the quick fix to the issue |
@Carrington-Dennis Correct list of paths. Finally got my app working. |
Keep in mind that while we're reverted this change, code that was broken by this is wrong per the spec and will eventually be a syntax error whenever Babel has a major version bump or introduces an alternate way to version parsing without breaking people this badly. Like you can't do an array spread like this:
you can't do an object spread like this:
as the current object rest spec defines it: https://sebmarkbage.github.io/ecmascript-rest-spread/#Rest |
Prevent `Syntax Error react-native-progress/Bar.js: A trailing comma is not permitted after the rest element` see facebook/react-native#10199
Closing since this issue has been fixed upstream with Babylon for now. Thanks for the context @loganfsmyth -- it makes sense that a trailing comma isn't needed after a rest variable since it will always be the last entry. This is a codemod to strip the comma: codemod -m --extensions=js --exclude-paths=node_modules '(\.\.\.[\w$]+)\s*,(\s*\})' '\1\2' |
This regex does not catch all instances, as there can be comment(s) between trailing comma and |
After this experience I think it's a good idea to never use wild cards in any dependency management. It only leeds to difficult to diagnose problems that hit you at unexpected times. The hours I've wasted thinking "I didn't check any code in, why has this stopped working!?". At least with today's problem it just caused our builds just fail, but imagine the situation where a dependency update that got consumed silently at build time introduced a bug into your app. You've done nothing wrong, you didn't make any code changes, yet the app doesn't work. This has happened to me and it took days to figure out. IMO - Updating dependencies, (no matter how trivial the change) should be done and committed to version control. It make it much easier to reason about failures of this nature. The convenience of wildcards in dependency management can be reproduced with a script that just brings the dependencies up to date. |
Summary: These are caused by new [syntax checking](https://github.com/babel/babylon/blob/1285131e3eb28ab6f5f62a7c5fd3ffd7ce1e5eb8/CHANGELOG.md#v6113-2016-10-01) introduced by babylon. "The single rest at the end only applies to binding `let { x, ...y } = obj;` and assignment `({ x, ...y } = obj).`" I'd say this really should be cherry picked into the stable branch. **Test plan** 1. install babylon@6.11.3 2. see that things break 3. apply patch 4. things work 5. make sure all instances were fixed (I used `\.\.\..*,.*\n.*=` in IntelliJ regex format—find all ... followed by newline followed by =) Issue #10199 Closes #10200 Differential Revision: D3974066 Pulled By: javache fbshipit-source-id: 3f3c1e9df01a3b3bdd61dd3863416c638d3ed98d
Prevent `Syntax Error react-native-progress/Bar.js: A trailing comma is not permitted after the rest element` see facebook/react-native#10199
Issue Description
I wanted to start my first react-native application. I followed the steps in the tutorial to get it installed and running. Without any modifications, after running react-native run-ios and going to Xcode I got the following error:
Steps to Reproduce / Code Snippets
Follow the react-native tutorial https://facebook.github.io/react-native/docs/getting-started.html. After deleting the trailing commas in;
ListView.js - line 457,
NavigationCard.js - line 85,
MessageQueue.js - line 390
it worked. Interestingly, these trailing commas were all after using the spread operator (...).
Expected Results
Trailing commas in deconstructed objects should work.
Additional Information
The text was updated successfully, but these errors were encountered: