Skip to content

Commit aafccdf

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Revert D5409825: [RN] Convert easy files to Prettier
Differential Revision: D5409825 fbshipit-source-id: f797a40b58bc6bcc6ae53ed820a10ab49d3f10f5
1 parent bfece1d commit aafccdf

27 files changed

+122
-166
lines changed

babel-preset/configs/hmr.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
8-
*
9-
* @format
108
*/
119
'use strict';
1210

@@ -18,8 +16,8 @@ var transformPath = require.resolve(hmrTransform);
1816

1917
module.exports = function(options, filename) {
2018
var transform = filename
21-
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
22-
: hmrTransform;
19+
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
20+
: hmrTransform;
2321

2422
// Fix the module path to use '/' on Windows.
2523
if (path.sep === '\\') {
@@ -31,15 +29,13 @@ module.exports = function(options, filename) {
3129
[
3230
'react-transform',
3331
{
34-
transforms: [
35-
{
36-
transform: transform,
37-
imports: ['react'],
38-
locals: ['module'],
39-
},
40-
],
32+
transforms: [{
33+
transform: transform,
34+
imports: ['react'],
35+
locals: ['module'],
36+
}]
4137
},
42-
],
43-
]),
38+
]
39+
])
4440
};
4541
};

babel-preset/configs/internal.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
8-
*
9-
* @format
108
*/
119
'use strict';
1210

@@ -15,4 +13,4 @@ var resolvePlugins = require('../lib/resolvePlugins');
1513
module.exports = function(options) {
1614
// For future internal pipeline usage
1715
return null;
18-
};
16+
}

babel-preset/configs/main.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
8-
*
9-
* @format
108
*/
119
'use strict';
1210

@@ -27,10 +25,7 @@ var base = {
2725
'transform-es2015-computed-properties',
2826
'check-es2015-constants',
2927
'transform-es2015-destructuring',
30-
[
31-
'transform-es2015-modules-commonjs',
32-
{strict: false, allowTopLevelThis: true},
33-
],
28+
['transform-es2015-modules-commonjs', { strict: false, allowTopLevelThis: true }],
3429
'transform-es2015-parameters',
3530
'transform-es2015-shorthand-properties',
3631
'transform-es2015-spread',
@@ -42,17 +37,18 @@ var base = {
4237
'transform-react-display-name',
4338
'transform-react-jsx',
4439
'transform-regenerator',
45-
['transform-es2015-for-of', {loose: true}],
40+
['transform-es2015-for-of', { loose: true }],
4641
require('../transforms/transform-regenerator-runtime-insertion'),
4742
require('../transforms/transform-symbol-member'),
4843
]),
4944
};
5045

5146
var devTools = Object.assign({}, base);
5247
devTools.plugins = devTools.plugins.concat(
53-
resolvePlugins(['transform-react-jsx-source']),
48+
resolvePlugins(['transform-react-jsx-source'])
5449
);
5550

51+
5652
module.exports = function(options) {
5753
var withDevTools = options.withDevTools;
5854
if (withDevTools == null) {

babel-preset/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
8-
*
9-
* @format
108
*/
119
'use strict';
1210

babel-preset/lib/resolvePlugins.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
8-
*
9-
* @format
108
*/
119
'use strict';
1210

babel-preset/plugins.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
8-
*
9-
* @format
108
*/
119
'use strict';
1210

@@ -28,7 +26,7 @@ module.exports = {
2826
'babel-plugin-transform-es2015-shorthand-properties': require('babel-plugin-transform-es2015-shorthand-properties'),
2927
'babel-plugin-transform-es2015-spread': require('babel-plugin-transform-es2015-spread'),
3028
'babel-plugin-transform-es2015-template-literals': require('babel-plugin-transform-es2015-template-literals'),
31-
'babel-plugin-transform-es2015-literals': require('babel-plugin-transform-es2015-literals'),
29+
'babel-plugin-transform-es2015-literals' : require('babel-plugin-transform-es2015-literals'),
3230
'babel-plugin-transform-flow-strip-types': require('babel-plugin-transform-flow-strip-types'),
3331
'babel-plugin-transform-object-assign': require('babel-plugin-transform-object-assign'),
3432
'babel-plugin-transform-object-rest-spread': require('babel-plugin-transform-object-rest-spread'),

babel-preset/transforms/transform-regenerator-runtime-insertion.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*
9-
*
10-
* @format
119
*/
1210

1311
'use strict';
@@ -100,9 +98,9 @@ module.exports = function() {
10098
t.identifier('regeneratorRuntime'),
10199
t.callExpression(t.identifier('require'), [
102100
t.stringLiteral(NAME),
103-
]),
104-
),
105-
]),
101+
])
102+
)
103+
])
106104
);
107105
}
108106
},

babel-preset/transforms/transform-symbol-member.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/**
22
* Copyright 2004-present Facebook. All Rights Reserved.
3-
*
4-
* @format
53
*/
64

75
'use strict';
@@ -36,12 +34,16 @@ module.exports = function symbolMember(babel) {
3634
t.conditionalExpression(
3735
t.binaryExpression(
3836
'===',
39-
t.unaryExpression('typeof', t.identifier('Symbol'), true),
40-
t.stringLiteral('function'),
37+
t.unaryExpression(
38+
'typeof',
39+
t.identifier('Symbol'),
40+
true
41+
),
42+
t.stringLiteral('function')
4143
),
4244
node,
43-
t.stringLiteral(`@@${node.property.name}`),
44-
),
45+
t.stringLiteral(`@@${node.property.name}`)
46+
)
4547
);
4648

4749
// We should stop to avoid infinite recursion, since Babel
@@ -55,10 +57,8 @@ module.exports = function symbolMember(babel) {
5557
function isAppropriateMember(path) {
5658
let node = path.node;
5759

58-
return (
59-
path.parentPath.type !== 'AssignmentExpression' &&
60+
return path.parentPath.type !== 'AssignmentExpression' &&
6061
node.object.type === 'Identifier' &&
6162
node.object.name === 'Symbol' &&
62-
node.property.type === 'Identifier'
63-
);
63+
node.property.type === 'Identifier';
6464
}

bots/code-analysis-bot.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
8-
*
9-
* @format
108
*/
119
'use strict';
1210

@@ -19,9 +17,7 @@ if (!process.env.CI_REPO) {
1917
process.exit(1);
2018
}
2119
if (!process.env.GITHUB_TOKEN) {
22-
console.error(
23-
'Missing GITHUB_TOKEN. Example: 5fd88b964fa214c4be2b144dc5af5d486a2f8c1e',
24-
);
20+
console.error('Missing GITHUB_TOKEN. Example: 5fd88b964fa214c4be2b144dc5af5d486a2f8c1e');
2521
process.exit(1);
2622
}
2723
if (!process.env.PULL_REQUEST_NUMBER) {
@@ -96,7 +92,7 @@ var converters = {
9692
});
9793
});
9894
});
99-
},
95+
}
10096
};
10197

10298
function getShaFromPullRequest(user, repo, number, callback) {
@@ -124,6 +120,7 @@ function getFilesFromCommit(user, repo, sha, callback) {
124120
});
125121
}
126122

123+
127124
/**
128125
* Sadly we can't just give the line number to github, we have to give the
129126
* line number relative to the patch file which is super annoying. This
@@ -135,7 +132,7 @@ function getLineMapFromPatch(patchString) {
135132
var fileLineIndex = 0;
136133
var lineMap = {};
137134

138-
patchString.split('\n').forEach(line => {
135+
patchString.split('\n').forEach((line) => {
139136
if (line.match(/^@@/)) {
140137
fileLineIndex = line.match(/\+([0-9]+)/)[1] - 1;
141138
return;
@@ -184,27 +181,27 @@ function main(messages, user, repo, number) {
184181
return;
185182
}
186183

187-
getShaFromPullRequest(user, repo, number, sha => {
188-
getFilesFromCommit(user, repo, sha, files => {
189-
files.filter(file => messages[file.filename]).forEach(file => {
190-
// github api sometimes does not return a patch on large commits
191-
if (!file.patch) {
192-
return;
193-
}
194-
var lineMap = getLineMapFromPatch(file.patch);
195-
messages[file.filename].forEach(message => {
196-
sendComment(user, repo, number, sha, file.filename, lineMap, message);
184+
getShaFromPullRequest(user, repo, number, (sha) => {
185+
getFilesFromCommit(user, repo, sha, (files) => {
186+
files
187+
.filter((file) => messages[file.filename])
188+
.forEach((file) => {
189+
// github api sometimes does not return a patch on large commits
190+
if (!file.patch) {
191+
return;
192+
}
193+
var lineMap = getLineMapFromPatch(file.patch);
194+
messages[file.filename].forEach((message) => {
195+
sendComment(user, repo, number, sha, file.filename, lineMap, message);
196+
});
197197
});
198-
});
199198
});
200199
});
201200
}
202201

203202
var content = '';
204203
process.stdin.resume();
205-
process.stdin.on('data', function(buf) {
206-
content += buf.toString();
207-
});
204+
process.stdin.on('data', function(buf) { content += buf.toString(); });
208205
process.stdin.on('end', function() {
209206
var messages = {};
210207

cli.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* This source code is licensed under the BSD-style license found in the
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
8-
*
9-
* @format
108
*/
119
'use strict';
1210

0 commit comments

Comments
 (0)