Skip to content

Commit 6b30832

Browse files
authored
Upgrade prettier (#26081)
The old version of prettier we were using didn't support the Flow syntax to access properties in a type using `SomeType['prop']`. This updates `prettier` and `rollup-plugin-prettier` to the latest versions. I added the prettier config `arrowParens: "avoid"` to reduce the diff size as the default has changed in Prettier 2.0. The largest amount of changes comes from function expressions now having a space. This doesn't have an option to preserve the old behavior, so we have to update this.
1 parent 1f5ce59 commit 6b30832

File tree

421 files changed

+3448
-4261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

421 files changed

+3448
-4261
lines changed

.prettierrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module.exports = {
88
jsxBracketSameLine: true,
99
trailingComma: 'es5',
1010
printWidth: 80,
11-
parser: 'babel',
12-
11+
parser: 'flow',
12+
arrowParens: 'avoid',
1313
overrides: [
1414
{
1515
files: esNextPaths,

dangerfile.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function row(result, baseSha, headSha) {
9797
return rowArr.join(' | ');
9898
}
9999

100-
(async function() {
100+
(async function () {
101101
// Use git locally to grab the commit which represents the place
102102
// where the branches differ
103103

@@ -241,8 +241,9 @@ Comparing: ${baseSha}...${headSha}
241241
242242
## Critical size changes
243243
244-
Includes critical production bundles, as well as any change greater than ${CRITICAL_THRESHOLD *
245-
100}%:
244+
Includes critical production bundles, as well as any change greater than ${
245+
CRITICAL_THRESHOLD * 100
246+
}%:
246247
247248
${header}
248249
${criticalResults.join('\n')}

fixtures/attribute-behavior/src/App.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,9 @@ class App extends React.Component {
902902

903903
let log = '';
904904
for (let attribute of attributes) {
905-
log += `## \`${attribute.name}\` (on \`<${attribute.tagName ||
906-
'div'}>\` inside \`<${attribute.containerTagName || 'div'}>\`)\n`;
905+
log += `## \`${attribute.name}\` (on \`<${
906+
attribute.tagName || 'div'
907+
}>\` inside \`<${attribute.containerTagName || 'div'}>\`)\n`;
907908
log += '| Test Case | Flags | Result |\n';
908909
log += '| --- | --- | --- |\n';
909910

fixtures/devtools/scheduling-profiler/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function initServer() {
3939
const host = 'localhost';
4040
const port = 8000;
4141

42-
const requestListener = function(request, response) {
42+
const requestListener = function (request, response) {
4343
let contents;
4444
switch (request.url) {
4545
case '/react.js':

fixtures/dom/public/renderer.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
'use strict';
66

7-
(function() {
7+
(function () {
88
var Fixture = null;
99
var output = document.getElementById('output');
1010
var status = document.getElementById('status');
@@ -60,7 +60,7 @@
6060
setStatus('Generating markup');
6161

6262
return Promise.resolve()
63-
.then(function() {
63+
.then(function () {
6464
const element = createElement(Fixture);
6565

6666
// Server rendering moved to a separate package along with ReactDOM
@@ -80,11 +80,11 @@
8080
}
8181

8282
// Finally, React 0.4 and lower emits markup in a callback
83-
return new Promise(function(resolve) {
83+
return new Promise(function (resolve) {
8484
React.renderComponentToString(element, resolve);
8585
});
8686
})
87-
.then(function(string) {
87+
.then(function (string) {
8888
output.innerHTML = string;
8989
setStatus('Markup only (No React)');
9090
})
@@ -124,13 +124,13 @@
124124
}
125125

126126
function loadScript(src) {
127-
return new Promise(function(resolve, reject) {
127+
return new Promise(function (resolve, reject) {
128128
var script = document.createElement('script');
129129
script.async = true;
130130
script.src = src;
131131

132132
script.onload = resolve;
133-
script.onerror = function(error) {
133+
script.onerror = function (error) {
134134
reject(new Error('Unable to load ' + src));
135135
};
136136

@@ -145,7 +145,7 @@
145145
setStatus('Failed');
146146
output.innerHTML = 'Please name your root component "Fixture"';
147147
} else {
148-
prerender().then(function() {
148+
prerender().then(function () {
149149
if (getBooleanQueryParam('hydrate')) {
150150
render();
151151
}
@@ -161,27 +161,27 @@
161161

162162
window.onerror = handleError;
163163

164-
reload.onclick = function() {
164+
reload.onclick = function () {
165165
window.location.reload();
166166
};
167167

168168
hydrate.onclick = render;
169169

170170
loadScript(getQueryParam('reactPath'))
171-
.then(function() {
171+
.then(function () {
172172
if (needsReactDOM) {
173173
return Promise.all([
174174
loadScript(getQueryParam('reactDOMPath')),
175175
loadScript(getQueryParam('reactDOMServerPath')),
176176
]);
177177
}
178178
})
179-
.then(function() {
179+
.then(function () {
180180
if (failed) {
181181
return;
182182
}
183183

184-
window.addEventListener('message', function(event) {
184+
window.addEventListener('message', function (event) {
185185
var data = JSON.parse(event.data);
186186

187187
switch (data.type) {

fixtures/dom/src/components/fixtures/error-handling/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,15 @@ class TrySilenceFatalError extends React.Component {
243243

244244
function naiveMemoize(fn) {
245245
let memoizedEntry;
246-
return function() {
246+
return function () {
247247
if (!memoizedEntry) {
248248
memoizedEntry = {result: null};
249249
memoizedEntry.result = fn();
250250
}
251251
return memoizedEntry.result;
252252
};
253253
}
254-
let memoizedFunction = naiveMemoize(function() {
254+
let memoizedFunction = naiveMemoize(function () {
255255
throw new Error('Passed');
256256
});
257257

fixtures/dom/src/components/fixtures/hydration/Code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class CodeEditor extends React.Component {
3434
lineNumbers: true,
3535
});
3636

37-
this.editor.on('change', function(doc) {
37+
this.editor.on('change', function (doc) {
3838
onChange(doc.getValue());
3939
});
4040
}

fixtures/dom/src/components/fixtures/mouse-events/mouse-enter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const ReactDOM = window.ReactDOM;
66
const MouseEnter = () => {
77
const containerRef = React.useRef();
88

9-
React.useEffect(function() {
9+
React.useEffect(function () {
1010
const hostEl = containerRef.current;
1111
ReactDOM.render(<MouseEnterDetect />, hostEl, () => {
1212
ReactDOM.render(<MouseEnterDetect />, hostEl.childNodes[1]);

fixtures/dom/src/polyfills.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'core-js/es6/map';
88

99
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
1010
// MIT license
11-
(function() {
11+
(function () {
1212
var lastTime = 0;
1313
var vendors = ['ms', 'moz', 'webkit', 'o'];
1414
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
@@ -19,18 +19,18 @@ import 'core-js/es6/map';
1919
}
2020

2121
if (!window.requestAnimationFrame)
22-
window.requestAnimationFrame = function(callback, element) {
22+
window.requestAnimationFrame = function (callback, element) {
2323
var currTime = new Date().getTime();
2424
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
25-
var id = window.setTimeout(function() {
25+
var id = window.setTimeout(function () {
2626
callback(currTime + timeToCall);
2727
}, timeToCall);
2828
lastTime = currTime + timeToCall;
2929
return id;
3030
};
3131

3232
if (!window.cancelAnimationFrame)
33-
window.cancelAnimationFrame = function(id) {
33+
window.cancelAnimationFrame = function (id) {
3434
clearTimeout(id);
3535
};
3636
})();

fixtures/fiber-debugger/src/Fibers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function Graph(props) {
2929
});
3030

3131
var edgeLabels = {};
32-
React.Children.forEach(props.children, function(child) {
32+
React.Children.forEach(props.children, function (child) {
3333
if (!child) {
3434
return;
3535
}

0 commit comments

Comments
 (0)