Skip to content

Commit

Permalink
Upgrade prettier (#26081)
Browse files Browse the repository at this point in the history
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.

DiffTrain build for [6b30832](6b30832)
[View git log for this commit](https://github.com/facebook/react/commits/6b3083266686f62b29462d32de75c6e71f7ba3e3)
  • Loading branch information
kassens committed Jan 31, 2023
1 parent 1f2f55a commit 5bd4fb4
Show file tree
Hide file tree
Showing 62 changed files with 8,031 additions and 7,502 deletions.
12 changes: 6 additions & 6 deletions compiled/facebook-www/JSXDEVRuntime-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,12 @@ function describeNativeComponentFrame(fn, construct) {
// This should throw.
if (construct) {
// Something should be setting the props in the constructor.
var Fake = function() {
var Fake = function () {
throw Error();
}; // $FlowFixMe

Object.defineProperty(Fake.prototype, "props", {
set: function() {
set: function () {
// We use a throwing setter instead of frozen or non-writable props
// because that won't throw in a non-strict mode function.
throw Error();
Expand Down Expand Up @@ -901,7 +901,7 @@ function warnIfStringRefCannotBeAutoConverted(config, self) {

function defineKeyPropWarningGetter(props, displayName) {
{
var warnAboutAccessingKey = function() {
var warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;

Expand All @@ -925,7 +925,7 @@ function defineKeyPropWarningGetter(props, displayName) {

function defineRefPropWarningGetter(props, displayName) {
{
var warnAboutAccessingRef = function() {
var warnAboutAccessingRef = function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;

Expand Down Expand Up @@ -967,7 +967,7 @@ function defineRefPropWarningGetter(props, displayName) {
* @internal
*/

var ReactElement = function(type, key, ref, self, source, owner, props) {
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
Expand Down Expand Up @@ -1488,7 +1488,7 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {

if (hasOwnProperty.call(props, "key")) {
var componentName = getComponentNameFromType(type);
var keys = Object.keys(props).filter(function(k) {
var keys = Object.keys(props).filter(function (k) {
return k !== "key";
});
var beforeExample =
Expand Down
12 changes: 6 additions & 6 deletions compiled/facebook-www/JSXDEVRuntime-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,12 @@ function describeNativeComponentFrame(fn, construct) {
// This should throw.
if (construct) {
// Something should be setting the props in the constructor.
var Fake = function() {
var Fake = function () {
throw Error();
}; // $FlowFixMe

Object.defineProperty(Fake.prototype, "props", {
set: function() {
set: function () {
// We use a throwing setter instead of frozen or non-writable props
// because that won't throw in a non-strict mode function.
throw Error();
Expand Down Expand Up @@ -901,7 +901,7 @@ function warnIfStringRefCannotBeAutoConverted(config, self) {

function defineKeyPropWarningGetter(props, displayName) {
{
var warnAboutAccessingKey = function() {
var warnAboutAccessingKey = function () {
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;

Expand All @@ -925,7 +925,7 @@ function defineKeyPropWarningGetter(props, displayName) {

function defineRefPropWarningGetter(props, displayName) {
{
var warnAboutAccessingRef = function() {
var warnAboutAccessingRef = function () {
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;

Expand Down Expand Up @@ -967,7 +967,7 @@ function defineRefPropWarningGetter(props, displayName) {
* @internal
*/

var ReactElement = function(type, key, ref, self, source, owner, props) {
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
Expand Down Expand Up @@ -1488,7 +1488,7 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {

if (hasOwnProperty.call(props, "key")) {
var componentName = getComponentNameFromType(type);
var keys = Object.keys(props).filter(function(k) {
var keys = Object.keys(props).filter(function (k) {
return k !== "key";
});
var beforeExample =
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1f5ce59dd7b6869b1a17ede65aa301002ef31d4b
6b3083266686f62b29462d32de75c6e71f7ba3e3
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1f5ce59dd7b6869b1a17ede65aa301002ef31d4b
6b3083266686f62b29462d32de75c6e71f7ba3e3
Loading

0 comments on commit 5bd4fb4

Please sign in to comment.