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

Upgrade prettier #26081

Merged
merged 5 commits into from
Jan 31, 2023
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.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module.exports = {
jsxBracketSameLine: true,
trailingComma: 'es5',
printWidth: 80,
parser: 'babel',

parser: 'flow',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be 'hermes' or 'flow'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hermes PR wasn't merged yet due to concerns of size IIRC. Looks like flow is current enough for the moment to parser everything. (not actually sure what the plan is going forward with hermes vs. flow parser).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see

arrowParens: 'avoid',
overrides: [
{
files: esNextPaths,
Expand Down
7 changes: 4 additions & 3 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function row(result, baseSha, headSha) {
return rowArr.join(' | ');
}

(async function() {
(async function () {
// Use git locally to grab the commit which represents the place
// where the branches differ

Expand Down Expand Up @@ -241,8 +241,9 @@ Comparing: ${baseSha}...${headSha}

## Critical size changes

Includes critical production bundles, as well as any change greater than ${CRITICAL_THRESHOLD *
100}%:
Includes critical production bundles, as well as any change greater than ${
CRITICAL_THRESHOLD * 100
}%:

${header}
${criticalResults.join('\n')}
Expand Down
5 changes: 3 additions & 2 deletions fixtures/attribute-behavior/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,9 @@ class App extends React.Component {

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

Expand Down
2 changes: 1 addition & 1 deletion fixtures/devtools/scheduling-profiler/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function initServer() {
const host = 'localhost';
const port = 8000;

const requestListener = function(request, response) {
const requestListener = function (request, response) {
let contents;
switch (request.url) {
case '/react.js':
Expand Down
22 changes: 11 additions & 11 deletions fixtures/dom/public/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict';

(function() {
(function () {
var Fixture = null;
var output = document.getElementById('output');
var status = document.getElementById('status');
Expand Down Expand Up @@ -60,7 +60,7 @@
setStatus('Generating markup');

return Promise.resolve()
.then(function() {
.then(function () {
const element = createElement(Fixture);

// Server rendering moved to a separate package along with ReactDOM
Expand All @@ -80,11 +80,11 @@
}

// Finally, React 0.4 and lower emits markup in a callback
return new Promise(function(resolve) {
return new Promise(function (resolve) {
React.renderComponentToString(element, resolve);
});
})
.then(function(string) {
.then(function (string) {
output.innerHTML = string;
setStatus('Markup only (No React)');
})
Expand Down Expand Up @@ -124,13 +124,13 @@
}

function loadScript(src) {
return new Promise(function(resolve, reject) {
return new Promise(function (resolve, reject) {
var script = document.createElement('script');
script.async = true;
script.src = src;

script.onload = resolve;
script.onerror = function(error) {
script.onerror = function (error) {
reject(new Error('Unable to load ' + src));
};

Expand All @@ -145,7 +145,7 @@
setStatus('Failed');
output.innerHTML = 'Please name your root component "Fixture"';
} else {
prerender().then(function() {
prerender().then(function () {
if (getBooleanQueryParam('hydrate')) {
render();
}
Expand All @@ -161,27 +161,27 @@

window.onerror = handleError;

reload.onclick = function() {
reload.onclick = function () {
window.location.reload();
};

hydrate.onclick = render;

loadScript(getQueryParam('reactPath'))
.then(function() {
.then(function () {
if (needsReactDOM) {
return Promise.all([
loadScript(getQueryParam('reactDOMPath')),
loadScript(getQueryParam('reactDOMServerPath')),
]);
}
})
.then(function() {
.then(function () {
if (failed) {
return;
}

window.addEventListener('message', function(event) {
window.addEventListener('message', function (event) {
var data = JSON.parse(event.data);

switch (data.type) {
Expand Down
4 changes: 2 additions & 2 deletions fixtures/dom/src/components/fixtures/error-handling/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,15 @@ class TrySilenceFatalError extends React.Component {

function naiveMemoize(fn) {
let memoizedEntry;
return function() {
return function () {
if (!memoizedEntry) {
memoizedEntry = {result: null};
memoizedEntry.result = fn();
}
return memoizedEntry.result;
};
}
let memoizedFunction = naiveMemoize(function() {
let memoizedFunction = naiveMemoize(function () {
throw new Error('Passed');
});

Expand Down
2 changes: 1 addition & 1 deletion fixtures/dom/src/components/fixtures/hydration/Code.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class CodeEditor extends React.Component {
lineNumbers: true,
});

this.editor.on('change', function(doc) {
this.editor.on('change', function (doc) {
onChange(doc.getValue());
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ReactDOM = window.ReactDOM;
const MouseEnter = () => {
const containerRef = React.useRef();

React.useEffect(function() {
React.useEffect(function () {
const hostEl = containerRef.current;
ReactDOM.render(<MouseEnterDetect />, hostEl, () => {
ReactDOM.render(<MouseEnterDetect />, hostEl.childNodes[1]);
Expand Down
8 changes: 4 additions & 4 deletions fixtures/dom/src/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'core-js/es6/map';

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

if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback, element) {
window.requestAnimationFrame = function (callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() {
var id = window.setTimeout(function () {
callback(currTime + timeToCall);
}, timeToCall);
lastTime = currTime + timeToCall;
return id;
};

if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function(id) {
window.cancelAnimationFrame = function (id) {
clearTimeout(id);
};
})();
2 changes: 1 addition & 1 deletion fixtures/fiber-debugger/src/Fibers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Graph(props) {
});

var edgeLabels = {};
React.Children.forEach(props.children, function(child) {
React.Children.forEach(props.children, function (child) {
if (!child) {
return;
}
Expand Down
12 changes: 6 additions & 6 deletions fixtures/fizz/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@ const app = express();
app.use(compress());
app.get(
'/',
handleErrors(async function(req, res) {
handleErrors(async function (req, res) {
await waitForWebpack();
renderToStream(req.url, res);
})
);
app.get(
'/string',
handleErrors(async function(req, res) {
handleErrors(async function (req, res) {
await waitForWebpack();
renderToString(req.url, res);
})
);
app.get(
'/stream',
handleErrors(async function(req, res) {
handleErrors(async function (req, res) {
await waitForWebpack();
renderToStream(req.url, res);
})
);
app.get(
'/buffer',
handleErrors(async function(req, res) {
handleErrors(async function (req, res) {
await waitForWebpack();
renderToBuffer(req.url, res);
})
Expand All @@ -63,7 +63,7 @@ app
.listen(PORT, () => {
console.log(`Listening at ${PORT}...`);
})
.on('error', function(error) {
.on('error', function (error) {
if (error.syscall !== 'listen') {
throw error;
}
Expand All @@ -84,7 +84,7 @@ app
});

function handleErrors(fn) {
return async function(req, res, next) {
return async function (req, res, next) {
try {
return await fn(req, res);
} catch (x) {
Expand Down
2 changes: 1 addition & 1 deletion fixtures/flight/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const hasJsxRuntime = (() => {

// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
module.exports = function(webpackEnv) {
module.exports = function (webpackEnv) {
const isEnvDevelopment = webpackEnv === 'development';
const isEnvProduction = webpackEnv === 'production';

Expand Down
2 changes: 1 addition & 1 deletion fixtures/flight/config/webpackDevServer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const sockHost = process.env.WDS_SOCKET_HOST;
const sockPath = process.env.WDS_SOCKET_PATH; // default: '/ws'
const sockPort = process.env.WDS_SOCKET_PORT;

module.exports = function(proxy, allowedHost) {
module.exports = function (proxy, allowedHost) {
const disableFirewall =
!proxy || process.env.DANGEROUSLY_DISABLE_HOST_CHECK === 'true';
return {
Expand Down
6 changes: 3 additions & 3 deletions fixtures/flight/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ checkBrowsers(paths.appPath, isInteractive)
openBrowser(urls.localUrlForBrowser);
});

['SIGINT', 'SIGTERM'].forEach(function(sig) {
process.on(sig, function() {
['SIGINT', 'SIGTERM'].forEach(function (sig) {
process.on(sig, function () {
devServer.close();
process.exit();
});
});

if (process.env.CI !== 'true') {
// Gracefully exit when stdin ends
process.stdin.on('end', function() {
process.stdin.on('end', function () {
devServer.close();
process.exit();
});
Expand Down
8 changes: 4 additions & 4 deletions fixtures/flight/server/cli.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ babelRegister({
babelrc: false,
ignore: [
/\/(build|node_modules)\//,
function(file) {
function (file) {
if ((path.dirname(file) + '/').startsWith(__dirname + '/')) {
// Ignore everything in this folder
// because it's a mix of CJS and ESM
Expand All @@ -28,11 +28,11 @@ const express = require('express');
const app = express();

// Application
app.get('/', function(req, res) {
app.get('/', function (req, res) {
require('./handler.server.js')(req, res);
});

app.get('/todos', function(req, res) {
app.get('/todos', function (req, res) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.json([
{
Expand All @@ -50,7 +50,7 @@ app.listen(3001, () => {
console.log('Flight Server listening on port 3001...');
});

app.on('error', function(error) {
app.on('error', function (error) {
if (error.syscall !== 'listen') {
throw error;
}
Expand Down
2 changes: 1 addition & 1 deletion fixtures/flight/server/handler.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const {readFile} = require('fs');
const {resolve} = require('path');
const React = require('react');

module.exports = function(req, res) {
module.exports = function (req, res) {
// const m = require('../src/App.server.js');
import('../src/App.server.js').then(m => {
const dist = process.env.NODE_ENV === 'development' ? 'dist' : 'build';
Expand Down
Loading