From 1da330d5a557a60fa422055f35e3a636a344b371 Mon Sep 17 00:00:00 2001
From: Joseph Savona <joesavona@fb.com>
Date: Sun, 13 Sep 2015 21:03:23 -0700
Subject: [PATCH] babel plugin: refactor printer to use ast nodes not strings

---
 .../babel-relay-plugin/src/GraphQLPrinter.js  | 332 ++++++++++--------
 .../src/__fixtures__/callValues.fixture       |  56 +--
 .../connectionWithPageInfoAlias.fixture       |  52 +--
 .../connectionWithPageInfoSubfields.fixture   |  54 +--
 .../connectionWithoutNodeField.fixture        |  54 +--
 .../src/__fixtures__/container.fixture        |  10 +-
 .../src/__fixtures__/fieldForEnum.fixture     |  16 +-
 .../src/__fixtures__/fieldWithAlias.fixture   |  10 +-
 .../fieldWithAliasAndArgs.fixture             |  12 +-
 .../src/__fixtures__/fieldWithArgs.fixture    |  12 +-
 .../fieldWithEmptyArrayArg.fixture            |  12 +-
 .../src/__fixtures__/fieldWithEnumArg.fixture |  54 +--
 .../fieldWithEnumQueryArg.fixture             |  54 +--
 .../fieldWithFakeConnection.fixture           |  30 +-
 .../src/__fixtures__/fieldWithParams.fixture  |  12 +-
 .../src/__fixtures__/fragment.fixture         |   4 +-
 .../__fixtures__/fragmentDirectives.fixture   |  10 +-
 .../fragmentWithModuleName.fixture            |   8 +-
 .../src/__fixtures__/fragmentWithName.fixture |   4 +-
 .../fragmentWithReference.fixture             |   6 +-
 .../src/__fixtures__/inlineFragment.fixture   |  14 +-
 .../introspectionQueryForSchema.fixture       |   6 +-
 .../introspectionQueryForType.fixture         |   4 +-
 .../__fixtures__/metadataConnection.fixture   |  56 +--
 .../metadataConnectionLimitable.fixture       |  18 +-
 .../src/__fixtures__/metadataDynamic.fixture  |  24 +-
 .../__fixtures__/metadataGenerated.fixture    |   8 +-
 .../__fixtures__/metadataNonFindable.fixture  |   8 +-
 .../src/__fixtures__/metadataPlural.fixture   |  12 +-
 .../__fixtures__/metadataRequisite.fixture    |   4 +-
 .../src/__fixtures__/metadataVarArgs.fixture  |  12 +-
 .../src/__fixtures__/mutation.fixture         |  22 +-
 .../src/__fixtures__/mutationWithName.fixture |   8 +-
 .../__fixtures__/mutationWithoutArgs.fixture  |   8 +-
 .../src/__fixtures__/queryWithFields.fixture  |  10 +-
 .../src/__fixtures__/queryWithName.fixture    |  12 +-
 .../queryWithNestedFields.fixture             |  12 +-
 .../queryWithNestedFragments.fixture          |  12 +-
 .../queryWithObjectArgument.fixture           |   6 +-
 .../src/__fixtures__/queryWithVarArgs.fixture |   6 +-
 .../src/__fixtures__/subscription.fixture     |   8 +-
 .../__fixtures__/unionWithTypename.fixture    |   4 +-
 .../src/getBabelRelayPlugin.js                |  36 +-
 43 files changed, 574 insertions(+), 538 deletions(-)

diff --git a/scripts/babel-relay-plugin/src/GraphQLPrinter.js b/scripts/babel-relay-plugin/src/GraphQLPrinter.js
index dab9eef175042..24525d6e8781d 100644
--- a/scripts/babel-relay-plugin/src/GraphQLPrinter.js
+++ b/scripts/babel-relay-plugin/src/GraphQLPrinter.js
@@ -11,6 +11,7 @@
 
 var kinds = require('graphql/language/kinds');
 var printer = require('graphql/language/printer');
+var t = require('babel-core').types;
 var types = require('graphql/type');
 var typeIntrospection = require('graphql/type/introspection');
 
@@ -20,6 +21,8 @@ var SchemaMetaFieldDef = typeIntrospection.SchemaMetaFieldDef;
 var TypeMetaFieldDef = typeIntrospection.TypeMetaFieldDef;
 var TypeNameMetaFieldDef = typeIntrospection.TypeNameMetaFieldDef;
 
+var NULL = t.literal(null);
+
 /**
  * This is part of the Babel transform to convert embedded GraphQL RFC to
  * JavaScript. It converts from GraphQL AST to a string of JavaScript code.
@@ -36,38 +39,50 @@ GraphQLPrinter.prototype.getCode = function(ast, substitutions) {
     substitutions: substitutions
   };
 
+  var printedDocument;
   switch (ast.kind) {
     case kinds.OPERATION_DEFINITION:
       switch (ast.operation) {
         case 'query':
-          return printQuery(ast, options);
+          printedDocument = printQuery(ast, options);
+          break;
         case 'mutation':
-          return printOperation(ast, options);
+          printedDocument = printOperation(ast, options);
+          break;
       }
       break;
     case kinds.FRAGMENT_DEFINITION:
-      return printQueryFragment(ast, options);
+      printedDocument = printQueryFragment(ast, options);
+      break;
   }
-  throw new Error('unexpected type: ' + ast.kind);
+  if (!printedDocument) {
+    throw new Error('unexpected type: ' + ast.kind);
+  }
+
+  return t.functionExpression(
+    null,
+    options.substitutions.map(function(sub) {
+      return t.identifier(sub);
+    }),
+    t.blockStatement([
+      t.variableDeclaration(
+        'var',
+        [
+          t.variableDeclarator(
+            t.identifier('GraphQL'),
+            t.memberExpression(
+              identify(options.rqlFunctionName),
+              t.identifier('__GraphQL')
+            )
+          )
+        ]
+      ),
+      t.returnStatement(printedDocument),
+    ])
+  );
 };
 
 function printQueryFragment(fragment, options) {
-  var argsCode = getFragmentCode(fragment, options);
-  var substitutionNames = options.substitutions.join(', ');
-  return [
-    'function(' + substitutionNames + ') {',
-      'var GraphQL = ' + options.rqlFunctionName + '.__GraphQL;',
-      'return new GraphQL.QueryFragment(' + argsCode + ');',
-    '}'
-  ].join('');
-}
-
-function printInlineFragment(fragment, options) {
-  var argsCode = getFragmentCode(fragment, options);
-  return 'new GraphQL.QueryFragment(' + argsCode + ')';
-}
-
-function getFragmentCode(fragment, options) {
   var typeName = getTypeName(fragment);
   var type = options.schema.getType(typeName);
   if (!type) {
@@ -91,15 +106,19 @@ function getFragmentCode(fragment, options) {
   var fragments = fieldsAndFragments.fragments;
   var metadata = getRelayDirectiveMetadata(fragment);
 
-  var metadataCode = stringifyObject(metadata);
-
-  return getFunctionArgCode([
-    JSON.stringify(getName(fragment)),
-    JSON.stringify(getTypeName(fragment)),
-    fields,
-    fragments,
-    metadataCode
-  ]);
+  return t.newExpression(
+    t.memberExpression(
+      t.identifier('GraphQL'),
+      t.identifier('QueryFragment')
+    ),
+    trimArguments([
+      t.literal(getName(fragment)),
+      t.literal(getTypeName(fragment)),
+      fields,
+      fragments,
+      objectify(metadata)
+    ])
+  );
 }
 
 /**
@@ -129,7 +148,7 @@ function printQuery(query, options) {
     requisiteFields[rootCall.arg] = true;
   }
 
-  var callArgsCode = printArguments(rootField.arguments[0], options);
+  var printedArgs = printArguments(rootField.arguments[0], options);
 
   var fieldsAndFragments = printFieldsAndFragments(
     rootField.selectionSet,
@@ -158,24 +177,19 @@ function printQuery(query, options) {
     }
   }
 
-  var metadataCode = stringifyObject(metadata);
-
-  var argsCode = getFunctionArgCode([
-    JSON.stringify(getName(rootField)),
-    callArgsCode,
-    fields,
-    fragments,
-    metadataCode,
-    JSON.stringify(getName(query))
-  ]);
-
-  var substitutionNames = options.substitutions.join(', ');
-
-  return (
-    'function(' + substitutionNames + ') {' +
-      'var GraphQL = ' + options.rqlFunctionName + '.__GraphQL;' +
-      'return new GraphQL.Query(' + argsCode + ');' +
-    '}'
+  return t.newExpression(
+    t.memberExpression(
+      t.identifier('GraphQL'),
+      t.identifier('Query')
+    ),
+    trimArguments([
+      t.literal(getName(rootField)),
+      printedArgs,
+      fields,
+      fragments,
+      objectify(metadata),
+      t.literal(getName(query))
+    ])
   );
 }
 
@@ -204,13 +218,16 @@ function printOperation(operation, options) {
   var type = types.getNamedType(field.type);
   var requisiteFields = {clientMutationId: true};
 
-  var callCode =
-    'new GraphQL.Callv(' +
-    getFunctionArgCode([
-      JSON.stringify(getName(rootField)),
+  var printedCall = t.newExpression(
+    t.memberExpression(
+      t.identifier('GraphQL'),
+      t.identifier('Callv')
+    ),
+    trimArguments([
+      t.literal(getName(rootField)),
       printCallVariable('input')
-    ]) +
-    ')';
+    ])
+  );
 
   if (field.args.length !== 1) {
     throw new Error(util.format(
@@ -231,22 +248,19 @@ function printOperation(operation, options) {
   var fields = fieldsAndFragments.fields;
   var fragments = fieldsAndFragments.fragments;
 
-  var argsCode = getFunctionArgCode([
-    JSON.stringify(getName(operation)),
-    JSON.stringify(type.name),
-    callCode,
-    fields,
-    fragments,
-    stringifyObject(metadata)
-  ]);
-
-  var substitutionNames = options.substitutions.join(', ');
-
-  return (
-    'function(' + substitutionNames + ') {' +
-      'var GraphQL = ' + options.rqlFunctionName + '.__GraphQL;' +
-      'return new GraphQL.' + className + '(' + argsCode + ');' +
-    '}'
+  return t.newExpression(
+    t.memberExpression(
+      t.identifier('GraphQL'),
+      t.identifier(className)
+    ),
+    trimArguments([
+      t.literal(getName(operation)),
+      t.literal(type.name),
+      printedCall,
+      fields,
+      fragments,
+      objectify(metadata)
+    ])
   );
 }
 
@@ -265,7 +279,7 @@ function printFieldsAndFragments(
         // We assume that all spreads were added by us
         fragments.push(printFragmentReference(getName(selection), options));
       } else if (selection.kind === kinds.INLINE_FRAGMENT) {
-        fragments.push(printInlineFragment(selection, options));
+        fragments.push(printQueryFragment(selection, options));
       } else if (selection.kind === kinds.FIELD) {
         fields.push(selection);
       } else {
@@ -276,41 +290,45 @@ function printFieldsAndFragments(
       }
     });
   }
-  var fragmentsCode = null;
-  if (fragments.length) {
-    fragmentsCode = '[' + fragments.join(',') + ']';
-  }
 
   return {
     fields: printFields(fields, type, options, requisiteFields, parentType),
-    fragments: fragmentsCode,
+    fragments: fragments.length ?
+      t.arrayExpression(fragments) :
+      NULL,
   };
 }
 
-function printArguments(args, options) {
+function printArguments(args) {
   if (!args) {
-    return null;
+    return NULL;
   }
   var value = args.value;
   if (value.kind === kinds.LIST) {
-    return '[' + value.values.map(function(arg) {
-      return printArgument(arg, options)
-    }).join(', ') + ']';
+    return t.arrayExpression(
+      value.values.map(function(arg) {
+        return printArgument(arg);
+      })
+    );
   } else {
-    return printArgument(value, options);
+    return printArgument(value);
   }
 }
 
-function printArgument(arg, options) {
+function printArgument(arg) {
+  var value;
   switch (arg.kind) {
     case kinds.INT:
-      return JSON.stringify(parseInt(arg.value, 10));
+      value = parseInt(arg.value, 10);
+      break;
     case kinds.FLOAT:
-      return JSON.stringify(parseFloat(arg.value));
+      value = parseFloat(arg.value);
+      break;
     case kinds.STRING:
     case kinds.ENUM:
     case kinds.BOOLEAN:
-      return JSON.stringify(arg.value);
+      value = arg.value;
+      break;
     case kinds.VARIABLE:
       if (!arg.name || arg.name.kind !== kinds.NAME) {
         throw new Error('Expected variable to have a name');
@@ -319,10 +337,21 @@ function printArgument(arg, options) {
     default:
       throw new Error('Unexpected arg kind: ' + arg.kind);
   }
+  return printCallValue(value);
 }
 
 function printCallVariable(name) {
-  return 'new GraphQL.CallVariable(' + JSON.stringify(name) + ')';
+  return t.newExpression(
+    t.memberExpression(
+      t.identifier('GraphQL'),
+      t.identifier('CallVariable')
+    ),
+    [t.literal(name)]
+  );
+}
+
+function printCallValue(value) {
+  return t.literal(value);
 }
 
 function printFields(fields, type, options, requisiteFields, parentType) {
@@ -331,7 +360,7 @@ function printFields(fields, type, options, requisiteFields, parentType) {
     generateFields[name] = true;
   });
 
-  var fieldStrings = fields.map(function(field) {
+  var printedFields = fields.map(function(field) {
     var fieldName = getName(field);
     delete generateFields[fieldName];
     return printField(field, type, options, requisiteFields, false, parentType);
@@ -343,18 +372,24 @@ function printFields(fields, type, options, requisiteFields, parentType) {
       selectionSet: {selections: []},
       arguments: [],
     };
-    fieldStrings.push(
+    printedFields.push(
       printField(generatedAST, type, options, requisiteFields, true, parentType)
     );
   });
-  if (fieldStrings.length === 0) {
-    return null;
+  if (printedFields.length === 0) {
+    return NULL;
   }
-  return '[' + fieldStrings.join(', ') + ']';
+  return t.arrayExpression(printedFields);
 }
 
 function printFragmentReference(substitutionName, options) {
-  return options.rqlFunctionName + '.__frag(' + substitutionName + ')';
+  return t.callExpression(
+    t.memberExpression(
+      identify(options.rqlFunctionName),
+      t.identifier('__frag')
+    ),
+    [t.identifier(substitutionName)]
+  );
 }
 
 function printField(
@@ -486,29 +521,29 @@ function printField(
     metadata.requisite = true;
   }
 
-  var callsCode = printCalls(field, fieldDecl, options);
-
-  var fieldAliasCode = field.alias ?
-    JSON.stringify(field.alias.value) :
-    null;
-  var metadataCode = stringifyObject(metadata);
-
-  var argsCode = getFunctionArgCode([
-    JSON.stringify(fieldName),
-    fields,
-    fragments,
-    callsCode,
-    fieldAliasCode,
-    null,
-    metadataCode
-  ]);
-
-  return 'new GraphQL.Field(' + argsCode + ')';
+  var calls = printCalls(field, fieldDecl);
+  var fieldAlias = field.alias ? field.alias.value : null;
+
+  return t.newExpression(
+    t.memberExpression(
+      t.identifier('GraphQL'),
+      t.identifier('Field')
+    ),
+    trimArguments([
+      t.literal(fieldName),
+      fields,
+      fragments,
+      calls,
+      t.literal(fieldAlias),
+      NULL,
+      objectify(metadata)
+    ])
+  );
 }
 
 function printCalls(field, fieldDecl, options) {
   if (field.arguments.length === 0) {
-    return null;
+    return NULL;
   }
 
   // Each GraphQL RFC argument is mapped to a separate call. For GraphQL FB
@@ -529,17 +564,19 @@ function printCalls(field, fieldDecl, options) {
     if (typeName) {
       metadata.type = typeName;
     }
-    return (
-      'new GraphQL.Callv(' +
-        getFunctionArgCode([
-          JSON.stringify(callName),
-          printArguments(arg, options),
-          stringifyObject(metadata),
-        ]) +
-      ')'
+    return t.newExpression(
+      t.memberExpression(
+        t.identifier('GraphQL'),
+        t.identifier('Callv')
+      ),
+      trimArguments([
+        t.literal(callName),
+        printArguments(arg),
+        objectify(metadata)
+      ])
     );
   });
-  return '[' + callStrings.join(', ') + ']';
+  return t.arrayExpression(callStrings);
 }
 
 /**
@@ -775,33 +812,44 @@ function getFieldDef(schema, parentType, field) {
   return types.getNamedType(parentType).getFields()[fieldName];
 }
 
-function trimArray(arr) {
-  var lastIndex = -1;
-  for (var ii = arr.length - 1; ii >= 0; ii--) {
-    if (arr[ii] !== null) {
-      lastIndex = ii;
-      break;
-    }
+function objectify(obj) {
+  if (obj == null) {
+    return NULL;
   }
-  arr.length = lastIndex + 1;
-  return arr;
+  var keys = Object.keys(obj);
+  if (!keys.length) {
+    return NULL;
+  }
+  return t.objectExpression(
+    keys.map(function(key) {
+      return t.property('init', t.identifier(key), t.literal(obj[key]));
+    })
+  );
 }
 
-function stringifyObject(obj) {
-  for (var ii in obj) {
-    if (obj.hasOwnProperty(ii)) {
-      return JSON.stringify(obj);
+function identify(str) {
+  return str.split('.').reduce(function(acc, name) {
+    if (!acc) {
+      return t.identifier(name);
     }
-  }
-  return null;
+    return t.memberExpression(acc, t.identifier(name));
+  }, null);
 }
 
-function getFunctionArgCode(arr) {
-  return trimArray(arr)
-    .map(function(arg) {
-      return arg === null ? 'null' : arg;
-    })
-    .join(', ');
+function trimArguments(args) {
+  var lastIndex = -1;
+  for (var ii = args.length - 1; ii >= 0; ii--) {
+    if (args[ii] == null) {
+      throw new Error(
+        'Use `NULL` to indicate that output should be the literal value `null`.'
+      );
+    }
+    if (args[ii] !== NULL) {
+      lastIndex = ii;
+      break;
+    }
+  }
+  return args.slice(0, lastIndex + 1);
 }
 
 function getSelections(node) {
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/callValues.fixture b/scripts/babel-relay-plugin/src/__fixtures__/callValues.fixture
index 61fdab7342bcd..0cca1273f0424 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/callValues.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/callValues.fixture
@@ -24,44 +24,44 @@ Output:
 var foo = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query("node", 123, [new GraphQL.Field("friends", [new GraphQL.Field("edges", [new GraphQL.Field("node", [new GraphQL.Field("id", null, null, null, null, null, {
-    "parentType": "User",
-    "requisite": true
+    parentType: "User",
+    requisite: true
   }), new GraphQL.Field("firstName", null, null, [new GraphQL.Callv("if", true), new GraphQL.Callv("unless", false)], null, null, {
-    "parentType": "User"
+    parentType: "User"
   })], null, null, null, null, {
-    "parentType": "UserConnectionEdge",
-    "rootCall": "node",
-    "pk": "id",
-    "requisite": true
+    parentType: "UserConnectionEdge",
+    rootCall: "node",
+    pk: "id",
+    requisite: true
   }), new GraphQL.Field("cursor", null, null, null, null, null, {
-    "parentType": "UserConnectionEdge",
-    "generated": true,
-    "requisite": true
+    parentType: "UserConnectionEdge",
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    "parentType": "UserConnection",
-    "plural": true
+    parentType: "UserConnection",
+    plural: true
   }), new GraphQL.Field("pageInfo", [new GraphQL.Field("hasNextPage", null, null, null, null, null, {
-    "parentType": "PageInfo",
-    "generated": true,
-    "requisite": true
+    parentType: "PageInfo",
+    generated: true,
+    requisite: true
   }), new GraphQL.Field("hasPreviousPage", null, null, null, null, null, {
-    "parentType": "PageInfo",
-    "generated": true,
-    "requisite": true
+    parentType: "PageInfo",
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    "parentType": "UserConnection",
-    "generated": true,
-    "requisite": true
+    parentType: "UserConnection",
+    generated: true,
+    requisite: true
   })], null, [new GraphQL.Callv("first", 10), new GraphQL.Callv("orderby", "Name"), new GraphQL.Callv("find", "cursor1"), new GraphQL.Callv("isViewerFriend", true), new GraphQL.Callv("gender", "MALE", {
-    "type": "Gender"
+    type: "Gender"
   })], null, null, {
-    "parentType": "Node",
-    "connection": true
+    parentType: "Node",
+    connection: true
   }), new GraphQL.Field("id", null, null, null, null, null, {
-    "parentType": "Node",
-    "generated": true,
-    "requisite": true
+    parentType: "Node",
+    generated: true,
+    requisite: true
   })], null, {
-    "rootArg": "id"
+    rootArg: "id"
   }, "CallValues");
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/connectionWithPageInfoAlias.fixture b/scripts/babel-relay-plugin/src/__fixtures__/connectionWithPageInfoAlias.fixture
index c3b6d828a6b28..22207b444ff22 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/connectionWithPageInfoAlias.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/connectionWithPageInfoAlias.fixture
@@ -22,41 +22,41 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('friends', [new GraphQL.Field('edges', [new GraphQL.Field('node', [new GraphQL.Field('name', null, null, null, null, null, {
-    'parentType': 'User'
+    parentType: 'User'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'rootCall': 'node',
-    'pk': 'id',
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    rootCall: 'node',
+    pk: 'id',
+    requisite: true
   }), new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'plural': true
+    parentType: 'UserConnection',
+    plural: true
   }), new GraphQL.Field('pageInfo', [new GraphQL.Field('hasPreviousPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'requisite': true
+    parentType: 'PageInfo',
+    requisite: true
   }), new GraphQL.Field('hasNextPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   })], null, null, 'myPageInfo', null, {
-    'parentType': 'UserConnection',
-    'requisite': true
+    parentType: 'UserConnection',
+    requisite: true
   })], null, [new GraphQL.Callv('first', 3)], null, null, {
-    'parentType': 'Node',
-    'connection': true
+    parentType: 'Node',
+    connection: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'ConnectionWithPageInfoAlias');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/connectionWithPageInfoSubfields.fixture b/scripts/babel-relay-plugin/src/__fixtures__/connectionWithPageInfoSubfields.fixture
index ecfd157d49590..341df1f42a50d 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/connectionWithPageInfoSubfields.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/connectionWithPageInfoSubfields.fixture
@@ -20,42 +20,42 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('friends', [new GraphQL.Field('edges', [new GraphQL.Field('node', [new GraphQL.Field('name', null, null, null, null, null, {
-    'parentType': 'User'
+    parentType: 'User'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'rootCall': 'node',
-    'pk': 'id',
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    rootCall: 'node',
+    pk: 'id',
+    requisite: true
   }), new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'plural': true
+    parentType: 'UserConnection',
+    plural: true
   }), new GraphQL.Field('pageInfo', [new GraphQL.Field('hasNextPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   }), new GraphQL.Field('hasPreviousPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'requisite': true
+    parentType: 'UserConnection',
+    requisite: true
   })], null, [new GraphQL.Callv('first', 3)], null, null, {
-    'parentType': 'Node',
-    'connection': true
+    parentType: 'Node',
+    connection: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'ConnectionWithPageInfoSubfields');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/connectionWithoutNodeField.fixture b/scripts/babel-relay-plugin/src/__fixtures__/connectionWithoutNodeField.fixture
index a2665066dfbe3..6185dc925d294 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/connectionWithoutNodeField.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/connectionWithoutNodeField.fixture
@@ -17,41 +17,41 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('friends', [new GraphQL.Field('edges', [new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    requisite: true
   }), new GraphQL.Field('node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'rootCall': 'node',
-    'pk': 'id',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    rootCall: 'node',
+    pk: 'id',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'plural': true
+    parentType: 'UserConnection',
+    plural: true
   }), new GraphQL.Field('pageInfo', [new GraphQL.Field('hasNextPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   }), new GraphQL.Field('hasPreviousPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnection',
+    generated: true,
+    requisite: true
   })], null, [new GraphQL.Callv('first', 3)], null, null, {
-    'parentType': 'Node',
-    'connection': true
+    parentType: 'Node',
+    connection: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'ConnectionWithoutNodeField');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/container.fixture b/scripts/babel-relay-plugin/src/__fixtures__/container.fixture
index d5b3d91ce522a..a547584daaee2 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/container.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/container.fixture
@@ -14,12 +14,12 @@ Relay.createContainer(Component, {
       return (function () {
         var GraphQL = Relay.QL.__GraphQL;
         return new GraphQL.QueryFragment('Container', 'Viewer', [new GraphQL.Field('actor', [new GraphQL.Field('id', null, null, null, null, null, {
-          'parentType': 'User',
-          'requisite': true
+          parentType: 'User',
+          requisite: true
         })], null, null, null, null, {
-          'parentType': 'Viewer',
-          'rootCall': 'node',
-          'pk': 'id'
+          parentType: 'Viewer',
+          rootCall: 'node',
+          pk: 'id'
         })]);
       })();
     }
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldForEnum.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldForEnum.fixture
index d1b2cdb1f234a..ea5ce38248afb 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldForEnum.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldForEnum.fixture
@@ -15,16 +15,16 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], [new GraphQL.QueryFragment('User', 'User', [new GraphQL.Field('gender', null, null, null, null, null, {
-    'parentType': 'User'
+    parentType: 'User'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })])], {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'FieldForEnum');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithAlias.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithAlias.fixture
index f2c475cc6db60..f0e89f9ad3047 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithAlias.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithAlias.fixture
@@ -13,12 +13,12 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('name', null, null, null, 'realname', null, {
-    'parentType': 'Node'
+    parentType: 'Node'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'FieldWithAlias');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithAliasAndArgs.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithAliasAndArgs.fixture
index 08e06418c6082..4f54649a11db1 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithAliasAndArgs.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithAliasAndArgs.fixture
@@ -15,14 +15,14 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('profilePicture', [new GraphQL.Field('uri', null, null, null, null, null, {
-    'parentType': 'ProfilePicture'
+    parentType: 'ProfilePicture'
   })], null, [new GraphQL.Callv('size', 100)], 'mugshot', null, {
-    'parentType': 'Node'
+    parentType: 'Node'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'FieldWithAliasAndArgs');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithArgs.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithArgs.fixture
index 94411b9008e9d..3a625776a3f2f 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithArgs.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithArgs.fixture
@@ -15,14 +15,14 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('profilePicture', [new GraphQL.Field('uri', null, null, null, null, null, {
-    'parentType': 'ProfilePicture'
+    parentType: 'ProfilePicture'
   })], null, [new GraphQL.Callv('size', 100)], null, null, {
-    'parentType': 'Node'
+    parentType: 'Node'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'FieldWithArgs');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEmptyArrayArg.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEmptyArrayArg.fixture
index c95fb485791ea..7200d39246fbc 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEmptyArrayArg.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEmptyArrayArg.fixture
@@ -13,13 +13,13 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('FieldWithEmptyArrayArg', 'User', [new GraphQL.Field('friends', [new GraphQL.Field('count', null, null, null, null, null, {
-    'parentType': 'UserConnection'
+    parentType: 'UserConnection'
   })], null, [new GraphQL.Callv('isViewerFriend', false)], null, null, {
-    'parentType': 'User',
-    'connection': true
+    parentType: 'User',
+    connection: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEnumArg.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEnumArg.fixture
index 2e3728d7cb2ee..e94deb8dc70e1 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEnumArg.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEnumArg.fixture
@@ -19,42 +19,42 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('friends', [new GraphQL.Field('edges', [new GraphQL.Field('node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'requisite': true
+    parentType: 'User',
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'rootCall': 'node',
-    'pk': 'id',
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    rootCall: 'node',
+    pk: 'id',
+    requisite: true
   }), new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'plural': true
+    parentType: 'UserConnection',
+    plural: true
   }), new GraphQL.Field('pageInfo', [new GraphQL.Field('hasNextPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   }), new GraphQL.Field('hasPreviousPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnection',
+    generated: true,
+    requisite: true
   })], null, [new GraphQL.Callv('gender', 'MALE', {
-    'type': 'Gender'
+    type: 'Gender'
   })], null, null, {
-    'parentType': 'Node',
-    'connection': true
+    parentType: 'Node',
+    connection: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'FieldWithEnumArg');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEnumQueryArg.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEnumQueryArg.fixture
index d54e0354fb25d..ee513d75c18e0 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEnumQueryArg.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithEnumQueryArg.fixture
@@ -19,42 +19,42 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('friends', [new GraphQL.Field('edges', [new GraphQL.Field('node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'requisite': true
+    parentType: 'User',
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'rootCall': 'node',
-    'pk': 'id',
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    rootCall: 'node',
+    pk: 'id',
+    requisite: true
   }), new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'plural': true
+    parentType: 'UserConnection',
+    plural: true
   }), new GraphQL.Field('pageInfo', [new GraphQL.Field('hasNextPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   }), new GraphQL.Field('hasPreviousPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnection',
+    generated: true,
+    requisite: true
   })], null, [new GraphQL.Callv('gender', new GraphQL.CallVariable('gender_0'), {
-    'type': 'Gender'
+    type: 'Gender'
   })], null, null, {
-    'parentType': 'Node',
-    'connection': true
+    parentType: 'Node',
+    connection: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'FieldWithEnumQueryArg');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithFakeConnection.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithFakeConnection.fixture
index c6a9d98a1a489..d98bc5a3cd42b 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithFakeConnection.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithFakeConnection.fixture
@@ -17,25 +17,25 @@ var Relay = require('Relay');
 var foo = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('FieldWithFakeConnection', 'User', [new GraphQL.Field('fakeConnection', [new GraphQL.Field('edges', [new GraphQL.Field('node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'FakeNode',
-    'requisite': true
+    parentType: 'FakeNode',
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'FakeEdge',
-    'rootCall': 'node',
-    'pk': 'id',
-    'requisite': true
+    parentType: 'FakeEdge',
+    rootCall: 'node',
+    pk: 'id',
+    requisite: true
   }), new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'FakeEdge',
-    'generated': true,
-    'requisite': true
+    parentType: 'FakeEdge',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'FakeConnection',
-    'plural': true
+    parentType: 'FakeConnection',
+    plural: true
   })], null, null, null, null, {
-    'parentType': 'User'
+    parentType: 'User'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithParams.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithParams.fixture
index f4f1f89490323..050b5981c8900 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fieldWithParams.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fieldWithParams.fixture
@@ -15,14 +15,14 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('profilePicture', [new GraphQL.Field('uri', null, null, null, null, null, {
-    'parentType': 'ProfilePicture'
+    parentType: 'ProfilePicture'
   })], null, [new GraphQL.Callv('size', new GraphQL.CallVariable('size'))], null, null, {
-    'parentType': 'Node'
+    parentType: 'Node'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'FieldWithParams');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fragment.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fragment.fixture
index add6f54a2d803..6bee4b3d4bef5 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fragment.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fragment.fixture
@@ -7,7 +7,7 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('Fragment', 'Node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'requisite': true
+    parentType: 'Node',
+    requisite: true
   })]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fragmentDirectives.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fragmentDirectives.fixture
index 967fbb077f027..fec50a2a4a2bd 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fragmentDirectives.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fragmentDirectives.fixture
@@ -7,11 +7,11 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('FragmentDirectives', 'Node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'requisite': true
+    parentType: 'Node',
+    requisite: true
   })], null, {
-    'plural': true,
-    'count': 1,
-    'name': 'Foo'
+    plural: true,
+    count: 1,
+    name: 'Foo'
   });
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithModuleName.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithModuleName.fixture
index b9f50f8ffeeec..d01d48fdfd384 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithModuleName.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithModuleName.fixture
@@ -10,14 +10,14 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('Foo', 'Node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'requisite': true
+    parentType: 'Node',
+    requisite: true
   })]);
 })();
 var y = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('Bar', 'Node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'requisite': true
+    parentType: 'Node',
+    requisite: true
   })]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithName.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithName.fixture
index e3bc9f192617b..b0ed732f38d99 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithName.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithName.fixture
@@ -7,7 +7,7 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('FragmentNameHere', 'Node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'requisite': true
+    parentType: 'Node',
+    requisite: true
   })]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithReference.fixture b/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithReference.fixture
index 8ae8de8a2c941..4afd602d7fd79 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithReference.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/fragmentWithReference.fixture
@@ -7,8 +7,8 @@ var Relay = require('react-relay');
 var x = (function (sub_0) {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('FragmentWithReference', 'Node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], [Relay.QL.__frag(sub_0)]);
 })(reference);
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/inlineFragment.fixture b/scripts/babel-relay-plugin/src/__fixtures__/inlineFragment.fixture
index aac40fe074f3d..f4dc408f2b3b2 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/inlineFragment.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/inlineFragment.fixture
@@ -13,14 +13,14 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('InlineFragment', 'Node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], [new GraphQL.QueryFragment('User', 'User', [new GraphQL.Field('userOnlyField', null, null, null, null, null, {
-    'parentType': 'User'
+    parentType: 'User'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })])]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/introspectionQueryForSchema.fixture b/scripts/babel-relay-plugin/src/__fixtures__/introspectionQueryForSchema.fixture
index 3143a8ee98871..f17fba6aa0162 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/introspectionQueryForSchema.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/introspectionQueryForSchema.fixture
@@ -13,9 +13,9 @@ Output:
 var foo = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query("__schema", null, [new GraphQL.Field("types", [new GraphQL.Field("name", null, null, null, null, null, {
-    "parentType": "__Type"
+    parentType: "__Type"
   })], null, null, null, null, {
-    "parentType": "__Schema",
-    "plural": true
+    parentType: "__Schema",
+    plural: true
   })], null, null, "IntrospectionQueryFroSchema");
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/introspectionQueryForType.fixture b/scripts/babel-relay-plugin/src/__fixtures__/introspectionQueryForType.fixture
index e8f70ee5411ca..36b2a4543230b 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/introspectionQueryForType.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/introspectionQueryForType.fixture
@@ -11,8 +11,8 @@ Output:
 var foo = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query("__type", "Root", [new GraphQL.Field("name", null, null, null, null, null, {
-    "parentType": "__Type"
+    parentType: "__Type"
   })], null, {
-    "rootArg": "name"
+    rootArg: "name"
   }, "IntrospectionQueryForType");
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/metadataConnection.fixture b/scripts/babel-relay-plugin/src/__fixtures__/metadataConnection.fixture
index 5ed2f261402cf..d9632b1038ec6 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/metadataConnection.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/metadataConnection.fixture
@@ -19,43 +19,43 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('friends', [new GraphQL.Field('edges', [new GraphQL.Field('node', [new GraphQL.Field('name', null, null, null, null, null, {
-    'parentType': 'User'
+    parentType: 'User'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'rootCall': 'node',
-    'pk': 'id',
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    rootCall: 'node',
+    pk: 'id',
+    requisite: true
   }), new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'UserConnectionEdge',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnectionEdge',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'plural': true
+    parentType: 'UserConnection',
+    plural: true
   }), new GraphQL.Field('pageInfo', [new GraphQL.Field('hasNextPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   }), new GraphQL.Field('hasPreviousPage', null, null, null, null, null, {
-    'parentType': 'PageInfo',
-    'generated': true,
-    'requisite': true
+    parentType: 'PageInfo',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'UserConnection',
-    'generated': true,
-    'requisite': true
+    parentType: 'UserConnection',
+    generated: true,
+    requisite: true
   })], null, [new GraphQL.Callv('first', 3)], null, null, {
-    'parentType': 'Node',
-    'connection': true
+    parentType: 'Node',
+    connection: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'MetadataConnection');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/metadataConnectionLimitable.fixture b/scripts/babel-relay-plugin/src/__fixtures__/metadataConnectionLimitable.fixture
index 6a64016792225..7fb42ddc38b4b 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/metadataConnectionLimitable.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/metadataConnectionLimitable.fixture
@@ -19,18 +19,18 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('viewer', null, [new GraphQL.Field('__configs__', [new GraphQL.Field('edges', [new GraphQL.Field('node', [new GraphQL.Field('name', null, null, null, null, null, {
-    'parentType': 'Config'
+    parentType: 'Config'
   })], null, null, null, null, {
-    'parentType': 'ConfigsConnectionEdge',
-    'requisite': true
+    parentType: 'ConfigsConnectionEdge',
+    requisite: true
   }), new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'ConfigsConnectionEdge',
-    'generated': true,
-    'requisite': true
+    parentType: 'ConfigsConnectionEdge',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'ConfigsConnection',
-    'plural': true
+    parentType: 'ConfigsConnection',
+    plural: true
   })], null, null, null, null, {
-    'parentType': 'Viewer'
+    parentType: 'Viewer'
   })], null, null, 'MetadataConnectionLimitable');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/metadataDynamic.fixture b/scripts/babel-relay-plugin/src/__fixtures__/metadataDynamic.fixture
index 67ae0a94ea19e..76f485fb17e4f 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/metadataDynamic.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/metadataDynamic.fixture
@@ -15,20 +15,20 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('MetadataDynamic', 'NewsFeedConnection', [new GraphQL.Field('edges', [new GraphQL.Field('node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'requisite': true
+    parentType: 'Node',
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'NewsFeedConnectionEdge',
-    'rootCall': 'node',
-    'pk': 'id',
-    'dynamic': true,
-    'requisite': true
+    parentType: 'NewsFeedConnectionEdge',
+    rootCall: 'node',
+    pk: 'id',
+    dynamic: true,
+    requisite: true
   }), new GraphQL.Field('cursor', null, null, null, null, null, {
-    'parentType': 'NewsFeedConnectionEdge',
-    'generated': true,
-    'requisite': true
+    parentType: 'NewsFeedConnectionEdge',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'NewsFeedConnection',
-    'plural': true
+    parentType: 'NewsFeedConnection',
+    plural: true
   })]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/metadataGenerated.fixture b/scripts/babel-relay-plugin/src/__fixtures__/metadataGenerated.fixture
index b3d0974b400f9..6da05c6df761c 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/metadataGenerated.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/metadataGenerated.fixture
@@ -11,10 +11,10 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'MetadataGenerated');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/metadataNonFindable.fixture b/scripts/babel-relay-plugin/src/__fixtures__/metadataNonFindable.fixture
index 368d4156a2770..a3e1de92cfbf9 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/metadataNonFindable.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/metadataNonFindable.fixture
@@ -15,10 +15,10 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('viewer', null, [new GraphQL.Field('pendingPosts', [new GraphQL.Field('count', null, null, null, null, null, {
-    'parentType': 'PendingPostsConnection'
+    parentType: 'PendingPostsConnection'
   })], null, null, null, null, {
-    'parentType': 'Viewer',
-    'connection': true,
-    'nonFindable': true
+    parentType: 'Viewer',
+    connection: true,
+    nonFindable: true
   })], null, null, 'MetadataNonFindable');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/metadataPlural.fixture b/scripts/babel-relay-plugin/src/__fixtures__/metadataPlural.fixture
index e287e3a52fb17..444370ccb93b5 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/metadataPlural.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/metadataPlural.fixture
@@ -13,13 +13,13 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('websites', null, null, null, null, null, {
-    'parentType': 'Node',
-    'plural': true
+    parentType: 'Node',
+    plural: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'MetadataPlural');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/metadataRequisite.fixture b/scripts/babel-relay-plugin/src/__fixtures__/metadataRequisite.fixture
index 071c4d5e93ac6..9d9c43d5fbac9 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/metadataRequisite.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/metadataRequisite.fixture
@@ -7,7 +7,7 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('MetadataRequisite', 'Node', [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'requisite': true
+    parentType: 'Node',
+    requisite: true
   })]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/metadataVarArgs.fixture b/scripts/babel-relay-plugin/src/__fixtures__/metadataVarArgs.fixture
index e54e09331c93d..5e64a31633950 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/metadataVarArgs.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/metadataVarArgs.fixture
@@ -13,13 +13,13 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.QueryFragment('MetadataVarArgs', 'User', [new GraphQL.Field('friends', [new GraphQL.Field('count', null, null, null, null, null, {
-    'parentType': 'UserConnection'
+    parentType: 'UserConnection'
   })], null, [new GraphQL.Callv('orderby', new GraphQL.CallVariable('order'))], null, null, {
-    'parentType': 'User',
-    'connection': true
+    parentType: 'User',
+    connection: true
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })]);
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/mutation.fixture b/scripts/babel-relay-plugin/src/__fixtures__/mutation.fixture
index 2c5a94acf0c7c..ff36af7149dcc 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/mutation.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/mutation.fixture
@@ -15,20 +15,20 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Mutation('Mutation', 'ActorSubscribeResponsePayload', new GraphQL.Callv('actorSubscribe', new GraphQL.CallVariable('input')), [new GraphQL.Field('actor', [new GraphQL.Field('profilePicture', null, null, null, null, null, {
-    'parentType': 'User'
+    parentType: 'User'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'User',
-    'generated': true,
-    'requisite': true
+    parentType: 'User',
+    generated: true,
+    requisite: true
   })], null, null, null, null, {
-    'parentType': 'ActorSubscribeResponsePayload',
-    'rootCall': 'node',
-    'pk': 'id'
+    parentType: 'ActorSubscribeResponsePayload',
+    rootCall: 'node',
+    pk: 'id'
   }), new GraphQL.Field('clientMutationId', null, null, null, null, null, {
-    'parentType': 'ActorSubscribeResponsePayload',
-    'generated': true,
-    'requisite': true
+    parentType: 'ActorSubscribeResponsePayload',
+    generated: true,
+    requisite: true
   })], null, {
-    'inputType': 'ActorSubscribeInput'
+    inputType: 'ActorSubscribeInput'
   });
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/mutationWithName.fixture b/scripts/babel-relay-plugin/src/__fixtures__/mutationWithName.fixture
index e0b8123d9dc3a..2acd4fa3e3395 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/mutationWithName.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/mutationWithName.fixture
@@ -13,10 +13,10 @@ var Relay = require('react-relay');
 var x = (function (sub_0) {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Mutation('MutationNameHere', 'ActorSubscribeResponsePayload', new GraphQL.Callv('actorSubscribe', new GraphQL.CallVariable('input')), [new GraphQL.Field('clientMutationId', null, null, null, null, null, {
-    'parentType': 'ActorSubscribeResponsePayload',
-    'generated': true,
-    'requisite': true
+    parentType: 'ActorSubscribeResponsePayload',
+    generated: true,
+    requisite: true
   })], [Relay.QL.__frag(sub_0)], {
-    'inputType': 'ActorSubscribeInput'
+    inputType: 'ActorSubscribeInput'
   });
 })(reference);
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/mutationWithoutArgs.fixture b/scripts/babel-relay-plugin/src/__fixtures__/mutationWithoutArgs.fixture
index 65a94d4b4677b..3ffa3305a4166 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/mutationWithoutArgs.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/mutationWithoutArgs.fixture
@@ -11,10 +11,10 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Mutation('MutationWithoutArgs', 'ActorSubscribeResponsePayload', new GraphQL.Callv('actorSubscribe', new GraphQL.CallVariable('input')), [new GraphQL.Field('clientMutationId', null, null, null, null, null, {
-    'parentType': 'ActorSubscribeResponsePayload',
-    'generated': true,
-    'requisite': true
+    parentType: 'ActorSubscribeResponsePayload',
+    generated: true,
+    requisite: true
   })], null, {
-    'inputType': 'ActorSubscribeInput'
+    inputType: 'ActorSubscribeInput'
   });
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/queryWithFields.fixture b/scripts/babel-relay-plugin/src/__fixtures__/queryWithFields.fixture
index 82c6008df6efb..eef7660c32830 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/queryWithFields.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/queryWithFields.fixture
@@ -13,12 +13,12 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('name', null, null, null, null, null, {
-    'parentType': 'Node'
+    parentType: 'Node'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'QueryWithFields');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/queryWithName.fixture b/scripts/babel-relay-plugin/src/__fixtures__/queryWithName.fixture
index 6ef64c5152c80..70bc338178d4c 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/queryWithName.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/queryWithName.fixture
@@ -15,14 +15,14 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('profilePicture', [new GraphQL.Field('uri', null, null, null, null, null, {
-    'parentType': 'ProfilePicture'
+    parentType: 'ProfilePicture'
   })], null, null, null, null, {
-    'parentType': 'Node'
+    parentType: 'Node'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'QueryNameHere');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/queryWithNestedFields.fixture b/scripts/babel-relay-plugin/src/__fixtures__/queryWithNestedFields.fixture
index c3429a56d49c8..9fde570b4f355 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/queryWithNestedFields.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/queryWithNestedFields.fixture
@@ -15,14 +15,14 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('profilePicture', [new GraphQL.Field('uri', null, null, null, null, null, {
-    'parentType': 'ProfilePicture'
+    parentType: 'ProfilePicture'
   })], null, null, null, null, {
-    'parentType': 'Node'
+    parentType: 'Node'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], null, {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'QueryWithNestedFields');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/queryWithNestedFragments.fixture b/scripts/babel-relay-plugin/src/__fixtures__/queryWithNestedFragments.fixture
index 560f63c93fa21..7c907b1a26d32 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/queryWithNestedFragments.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/queryWithNestedFragments.fixture
@@ -27,14 +27,14 @@ var Relay = require('react-relay');
 var x = (function (sub_0, sub_1, sub_2, sub_3, sub_4, sub_5, sub_6, sub_7, sub_8, sub_9, sub_10, sub_11) {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('node', 123, [new GraphQL.Field('profilePicture', [new GraphQL.Field('uri', null, null, null, null, null, {
-    'parentType': 'ProfilePicture'
+    parentType: 'ProfilePicture'
   })], [Relay.QL.__frag(sub_4), Relay.QL.__frag(sub_5), Relay.QL.__frag(sub_6), Relay.QL.__frag(sub_7)], null, null, null, {
-    'parentType': 'Node'
+    parentType: 'Node'
   }), new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'generated': true,
-    'requisite': true
+    parentType: 'Node',
+    generated: true,
+    requisite: true
   })], [Relay.QL.__frag(sub_0), Relay.QL.__frag(sub_1), Relay.QL.__frag(sub_2), Relay.QL.__frag(sub_3), Relay.QL.__frag(sub_8), Relay.QL.__frag(sub_9), Relay.QL.__frag(sub_10), Relay.QL.__frag(sub_11)], {
-    'rootArg': 'id'
+    rootArg: 'id'
   }, 'QueryWithNestedFragments');
 })(frag1, frag2, frag3, frag4, frag5, frag6, frag7, frag8, frag9, frag10, frag11, frag12);
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/queryWithObjectArgument.fixture b/scripts/babel-relay-plugin/src/__fixtures__/queryWithObjectArgument.fixture
index fa17693b1e6bc..94d01fc7158da 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/queryWithObjectArgument.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/queryWithObjectArgument.fixture
@@ -13,9 +13,9 @@ var Relay = require('Relay');
 var q = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('search', new GraphQL.CallVariable('query'), [new GraphQL.Field('title', null, null, null, null, null, {
-    'parentType': 'SearchResult'
+    parentType: 'SearchResult'
   })], null, {
-    'rootArg': 'query',
-    'rootCallType': '[SearchInput!]'
+    rootArg: 'query',
+    rootCallType: '[SearchInput!]'
   }, 'QueryWithObjectArgument');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/queryWithVarArgs.fixture b/scripts/babel-relay-plugin/src/__fixtures__/queryWithVarArgs.fixture
index c9a5fc87eaf19..a50460fb11ee6 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/queryWithVarArgs.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/queryWithVarArgs.fixture
@@ -13,9 +13,9 @@ var Relay = require('react-relay');
 var x = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query('nodes', [123, 456], [new GraphQL.Field('id', null, null, null, null, null, {
-    'parentType': 'Node',
-    'requisite': true
+    parentType: 'Node',
+    requisite: true
   })], null, {
-    'rootArg': 'ids'
+    rootArg: 'ids'
   }, 'QueryWithVarArgs');
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/subscription.fixture b/scripts/babel-relay-plugin/src/__fixtures__/subscription.fixture
index 25287f7e2d38a..0079c959b03a4 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/subscription.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/subscription.fixture
@@ -13,10 +13,10 @@ var Relay = require('react-relay');
 var x = (function (sub_0) {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Mutation('Subscription', 'ActorSubscribeResponsePayload', new GraphQL.Callv('actorSubscribeSubscribe', new GraphQL.CallVariable('input')), [new GraphQL.Field('clientMutationId', null, null, null, null, null, {
-    'parentType': 'ActorSubscribeResponsePayload',
-    'generated': true,
-    'requisite': true
+    parentType: 'ActorSubscribeResponsePayload',
+    generated: true,
+    requisite: true
   })], [Relay.QL.__frag(sub_0)], {
-    'inputType': 'ActorSubscribeInput!'
+    inputType: 'ActorSubscribeInput!'
   });
 })(reference);
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/__fixtures__/unionWithTypename.fixture b/scripts/babel-relay-plugin/src/__fixtures__/unionWithTypename.fixture
index 186d17ca9133b..909b476253223 100644
--- a/scripts/babel-relay-plugin/src/__fixtures__/unionWithTypename.fixture
+++ b/scripts/babel-relay-plugin/src/__fixtures__/unionWithTypename.fixture
@@ -11,8 +11,8 @@ Output:
 var foo = (function () {
   var GraphQL = Relay.QL.__GraphQL;
   return new GraphQL.Query("media", 123, [new GraphQL.Field("__typename", null, null, null, null, null, {
-    "parentType": "Media"
+    parentType: "Media"
   })], null, {
-    "rootArg": "id"
+    rootArg: "id"
   }, "UnionWithTypename");
 })();
\ No newline at end of file
diff --git a/scripts/babel-relay-plugin/src/getBabelRelayPlugin.js b/scripts/babel-relay-plugin/src/getBabelRelayPlugin.js
index 05d2df4e122e0..8fa17cf5ffcb6 100644
--- a/scripts/babel-relay-plugin/src/getBabelRelayPlugin.js
+++ b/scripts/babel-relay-plugin/src/getBabelRelayPlugin.js
@@ -53,17 +53,7 @@ function getBabelRelayPlugin(
 ) /*: Object */ {
   return function(babel) {
     var Plugin = babel.Plugin;
-    var parse = babel.parse;
     var t = babel.types;
-    var traverse = babel.traverse;
-
-    /**
-     * Same as `babel.util.parseTemplate`.
-     */
-    function parseTemplate(loc, code) {
-      var ast = parse(code, {filename: loc, looseModules: true}).program;
-      return traverse.removeProperties(ast);
-    }
 
     return new Plugin('relay-query', {
       visitor: {
@@ -181,10 +171,17 @@ function getBabelRelayPlugin(
               filename +
               '`.'
             );
-            code = (
-              'function() { throw new Error(\'' +
-                message.replace(/\'/g, '\\\'') +
-              '\'); }'
+            code = t.functionExpression(
+              null,
+              [],
+              t.blockStatement([
+                t.throwStatement(
+                  t.newExpression(
+                    t.identifier('Error'),
+                    [t.literal(message)]
+                  )
+                )
+              ])
             );
 
             // also log the full error if `debug` option is set
@@ -198,19 +195,10 @@ function getBabelRelayPlugin(
               );
             }
           }
-          code = '(' + code + ')';
-          var funcExpr = parseTemplate('Relay.QL', code).body[0].expression;
 
           // Immediately invoke the function with substitutions as arguments.
           var substitutions = node.quasi.expressions;
-          var funcCall = t.callExpression(
-            t.functionExpression(
-              null,
-              funcExpr.params,
-              funcExpr.body
-            ),
-            substitutions
-          );
+          var funcCall = t.callExpression(code, substitutions);
           this.replaceWith(funcCall);
         }
       }