Skip to content
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

Use double quote for transformed displayName #1708

Merged
merged 1 commit into from
Nov 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('react displayName jsx', function() {
var code = [
'"use strict";',
'var Whateva = React.createClass({',
' displayName: \'Whateva\',',
' displayName: "Whateva",',
' render: function() {',
' return null;',
' }',
Expand All @@ -34,7 +34,7 @@ describe('react displayName jsx', function() {
var result = [
'"use strict";',
'var Whateva = React.createClass({',
' displayName: \'Whateva\',',
' displayName: "Whateva",',
' render: function() {',
' return null;',
' }',
Expand All @@ -54,7 +54,7 @@ describe('react displayName jsx', function() {
].join('\n');

var result = [
'var Component = React.createClass({displayName: \'Component\',',
'var Component = React.createClass({displayName: "Component",',
' render: function() {',
' return null;',
' }',
Expand All @@ -76,7 +76,7 @@ describe('react displayName jsx', function() {

var result = [
'var Component;',
'Component = React.createClass({displayName: \'Component\',',
'Component = React.createClass({displayName: "Component",',
' render: function() {',
' return null;',
' }',
Expand All @@ -96,7 +96,7 @@ describe('react displayName jsx', function() {
].join('\n');

var result = [
'exports.Component = React.createClass({displayName: \'Component\',',
'exports.Component = React.createClass({displayName: "Component",',
' render: function() {',
' return null;',
' }',
Expand All @@ -119,7 +119,7 @@ describe('react displayName jsx', function() {

var result = [
'exports = {',
' Component: React.createClass({displayName: \'Component\',',
' Component: React.createClass({displayName: "Component",',
' render: function() {',
' return null;',
' }',
Expand Down
2 changes: 1 addition & 1 deletion vendor/fbtransform/transforms/reactDisplayName.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function addDisplayName(displayName, object, state) {

if (safe) {
utils.catchup(object['arguments'][0].range[0] + 1, state);
utils.append("displayName: '" + displayName + "',", state);
utils.append('displayName: "' + displayName + '",', state);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion vendor/fbtransform/transforms/xjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function renderXJSExpressionContainer(traverse, object, isLast, path, state) {
function quoteAttrName(attr) {
// Quote invalid JS identifiers.
if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
return "'" + attr + "'";
return '"' + attr + '"';
}
return attr;
}
Expand Down