Skip to content

Commit

Permalink
[react-native] Use trailing commas transform
Browse files Browse the repository at this point in the history
Summary:
@public
Apparently trailing commas transform isn't exported by react-tools. We need to pull it out manually. This is not so clean but we're swtching to babel very shortly.

Test Plan:
* npm start
* write `foo(a,b,c,)` in some file
* request that file in the browser and make sure that trailing comma is gone
  • Loading branch information
Amjad Masad committed May 15, 2015
1 parent 40da7bb commit d9b7e63
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packager/transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ var reactVisitors =
require('react-tools/vendor/fbtransform/visitors').getAllVisitors();
var staticTypeSyntax =
require('jstransform/visitors/type-syntax').visitorList;
var trailingCommaVisitors =
require('jstransform/visitors/es7-trailing-comma-visitors.js').visitorList;

// Note that reactVisitors now handles ES6 classes, rest parameters, arrow
// functions, template strings, and object short notation.
var visitorList = reactVisitors;

var visitorList = reactVisitors.concat(trailingCommaVisitors);

function transform(srcTxt, filename) {
var options = {
Expand Down

0 comments on commit d9b7e63

Please sign in to comment.