Skip to content

Commit 253aa24

Browse files
committed
Update Prettier
Needed to bump this to get support for Flow's `extends` syntax.
1 parent 599decb commit 253aa24

File tree

21 files changed

+362
-347
lines changed

21 files changed

+362
-347
lines changed

fixtures/flight/config/modules.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ function getModules() {
108108
// TypeScript project and set up the config
109109
// based on tsconfig.json
110110
if (hasTsConfig) {
111-
const ts = require(resolve.sync('typescript', {
112-
basedir: paths.appNodeModules,
113-
}));
111+
const ts = require(
112+
resolve.sync('typescript', {
113+
basedir: paths.appNodeModules,
114+
})
115+
);
114116
config = ts.readConfigFile(paths.appTsConfig, ts.sys.readFile).config;
115117
// Otherwise we'll check if there is jsconfig.json
116118
// for non TS projects.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@
8181
"minimist": "^1.2.3",
8282
"mkdirp": "^0.5.1",
8383
"ncp": "^2.0.0",
84-
"prettier": "2.8.3",
84+
"prettier": "3.0.3",
8585
"pretty-format": "^29.4.1",
8686
"prop-types": "^15.6.2",
8787
"random-seed": "^0.3.0",
8888
"react-lifecycles-compat": "^3.0.4",
8989
"rimraf": "^3.0.0",
9090
"rollup": "^3.17.1",
91-
"rollup-plugin-prettier": "^3.0.0",
91+
"rollup-plugin-prettier": "^4.1.1",
9292
"rollup-plugin-strip-banner": "^3.0.0",
9393
"semver": "^7.1.1",
9494
"signedsource": "^2.0.0",

packages/react-client/src/ReactFlightClient.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,11 +572,11 @@ function createServerReferenceProxy<A: Iterable<any>, T>(
572572
}
573573
// Since this is a fake Promise whose .then doesn't chain, we have to wrap it.
574574
// TODO: Remove the wrapper once that's fixed.
575-
return ((Promise.resolve(p): any): Promise<Array<any>>).then(function (
576-
bound,
577-
) {
578-
return callServer(metaData.id, bound.concat(args));
579-
});
575+
return ((Promise.resolve(p): any): Promise<Array<any>>).then(
576+
function (bound) {
577+
return callServer(metaData.id, bound.concat(args));
578+
},
579+
);
580580
};
581581
registerServerReference(proxy, metaData);
582582
return proxy;

packages/react-devtools-shared/src/__tests__/profilerChangeDescriptions-test.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ describe('Profiler change descriptions', () => {
4040
}
4141

4242
const MemoizedChild = React.memo(Child, areEqual);
43-
const ForwardRefChild = React.forwardRef(function RefForwardingComponent(
44-
props,
45-
ref,
46-
) {
47-
return <Child />;
48-
});
43+
const ForwardRefChild = React.forwardRef(
44+
function RefForwardingComponent(props, ref) {
45+
return <Child />;
46+
},
47+
);
4948

5049
let forceUpdate = null;
5150

packages/react-devtools-shared/src/devtools/ProfilingCache.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ export default class ProfilingCache {
3333
this._profilerStore = profilerStore;
3434
}
3535

36-
getCommitTree: ({
37-
commitIndex: number,
38-
rootID: number,
39-
}) => CommitTree = ({commitIndex, rootID}) =>
36+
getCommitTree: ({commitIndex: number, rootID: number}) => CommitTree = ({
37+
commitIndex,
38+
rootID,
39+
}) =>
4040
getCommitTree({
4141
commitIndex,
4242
profilerStore: this._profilerStore,
4343
rootID,
4444
});
4545

46-
getFiberCommits: ({
47-
fiberID: number,
48-
rootID: number,
49-
}) => Array<number> = ({fiberID, rootID}) => {
46+
getFiberCommits: ({fiberID: number, rootID: number}) => Array<number> = ({
47+
fiberID,
48+
rootID,
49+
}) => {
5050
const cachedFiberCommits = this._fiberCommits.get(fiberID);
5151
if (cachedFiberCommits != null) {
5252
return cachedFiberCommits;

packages/react-devtools-shared/src/hooks/__tests__/parseHookNames-test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ describe('parseHookNames', () => {
7070
const hooksList = flattenHooksList(hooksTree);
7171

7272
// Runs in the UI thread so it can share Network cache:
73-
const locationKeyToHookSourceAndMetadata = await loadSourceAndMetadata(
74-
hooksList,
75-
);
73+
const locationKeyToHookSourceAndMetadata =
74+
await loadSourceAndMetadata(hooksList);
7675

7776
// Runs in a Worker because it's CPU intensive:
7877
return parseSourceAndMetadata(

packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (document.body != null) {
2626
installFizzInstrObserver(document.body);
2727
}
2828
// $FlowFixMe[incompatible-cast]
29-
handleExistingNodes((document.body /*: HTMLElement */));
29+
handleExistingNodes((document.body: HTMLElement));
3030
} else {
3131
// Document must be loading -- body may not exist yet if the fizz external
3232
// runtime is sent in <head> (e.g. as a preinit resource)
@@ -38,7 +38,7 @@ if (document.body != null) {
3838
installFizzInstrObserver(document.body);
3939
}
4040
// $FlowFixMe[incompatible-cast]
41-
handleExistingNodes((document.body /*: HTMLElement */));
41+
handleExistingNodes((document.body: HTMLElement));
4242

4343
// We can call disconnect without takeRecord here,
4444
// since we only expect a single document.body
@@ -49,15 +49,15 @@ if (document.body != null) {
4949
domBodyObserver.observe(document.documentElement, {childList: true});
5050
}
5151

52-
function handleExistingNodes(target /*: HTMLElement */) {
52+
function handleExistingNodes(target: HTMLElement) {
5353
const existingNodes = target.querySelectorAll('template');
5454
for (let i = 0; i < existingNodes.length; i++) {
5555
handleNode(existingNodes[i]);
5656
}
5757
}
5858

59-
function installFizzInstrObserver(target /*: Node */) {
60-
const handleMutations = (mutations /*: Array<MutationRecord> */) => {
59+
function installFizzInstrObserver(target: Node) {
60+
const handleMutations = (mutations: Array<MutationRecord>) => {
6161
for (let i = 0; i < mutations.length; i++) {
6262
const addedNodes = mutations[i].addedNodes;
6363
for (let j = 0; j < addedNodes.length; j++) {
@@ -80,13 +80,13 @@ function installFizzInstrObserver(target /*: Node */) {
8080
});
8181
}
8282

83-
function handleNode(node_ /*: Node */) {
83+
function handleNode(node_: Node) {
8484
// $FlowFixMe[incompatible-cast]
85-
if (node_.nodeType !== 1 || !(node_ /*: HTMLElement */).dataset) {
85+
if (node_.nodeType !== 1 || !(node_: HTMLElement).dataset) {
8686
return;
8787
}
8888
// $FlowFixMe[incompatible-cast]
89-
const node = (node_ /*: HTMLElement */);
89+
const node = (node_: HTMLElement);
9090
const dataset = node.dataset;
9191
if (dataset['rxi'] != null) {
9292
clientRenderBoundary(

packages/react-dom/src/__tests__/ReactDOMInput-test.js

Lines changed: 98 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,38 +2089,40 @@ describe('ReactDOMInput', () => {
20892089
it('sets type, step, min, max before value always', () => {
20902090
const log = [];
20912091
const originalCreateElement = document.createElement;
2092-
spyOnDevAndProd(document, 'createElement').mockImplementation(function (
2093-
type,
2094-
) {
2095-
const el = originalCreateElement.apply(this, arguments);
2096-
let value = '';
2097-
let typeProp = '';
2098-
2099-
if (type === 'input') {
2100-
Object.defineProperty(el, 'type', {
2101-
get: function () {
2102-
return typeProp;
2103-
},
2104-
set: function (val) {
2105-
typeProp = String(val);
2106-
log.push('set property type');
2107-
},
2108-
});
2109-
Object.defineProperty(el, 'value', {
2110-
get: function () {
2111-
return value;
2112-
},
2113-
set: function (val) {
2114-
value = String(val);
2115-
log.push('set property value');
2116-
},
2117-
});
2118-
spyOnDevAndProd(el, 'setAttribute').mockImplementation(function (name) {
2119-
log.push('set attribute ' + name);
2120-
});
2121-
}
2122-
return el;
2123-
});
2092+
spyOnDevAndProd(document, 'createElement').mockImplementation(
2093+
function (type) {
2094+
const el = originalCreateElement.apply(this, arguments);
2095+
let value = '';
2096+
let typeProp = '';
2097+
2098+
if (type === 'input') {
2099+
Object.defineProperty(el, 'type', {
2100+
get: function () {
2101+
return typeProp;
2102+
},
2103+
set: function (val) {
2104+
typeProp = String(val);
2105+
log.push('set property type');
2106+
},
2107+
});
2108+
Object.defineProperty(el, 'value', {
2109+
get: function () {
2110+
return value;
2111+
},
2112+
set: function (val) {
2113+
value = String(val);
2114+
log.push('set property value');
2115+
},
2116+
});
2117+
spyOnDevAndProd(el, 'setAttribute').mockImplementation(
2118+
function (name) {
2119+
log.push('set attribute ' + name);
2120+
},
2121+
);
2122+
}
2123+
return el;
2124+
},
2125+
);
21242126

21252127
ReactDOM.render(
21262128
<input
@@ -2174,71 +2176,70 @@ describe('ReactDOMInput', () => {
21742176

21752177
const log = [];
21762178
const originalCreateElement = document.createElement;
2177-
spyOnDevAndProd(document, 'createElement').mockImplementation(function (
2178-
type,
2179-
) {
2180-
const el = originalCreateElement.apply(this, arguments);
2181-
const getDefaultValue = Object.getOwnPropertyDescriptor(
2182-
HTMLInputElement.prototype,
2183-
'defaultValue',
2184-
).get;
2185-
const setDefaultValue = Object.getOwnPropertyDescriptor(
2186-
HTMLInputElement.prototype,
2187-
'defaultValue',
2188-
).set;
2189-
const getValue = Object.getOwnPropertyDescriptor(
2190-
HTMLInputElement.prototype,
2191-
'value',
2192-
).get;
2193-
const setValue = Object.getOwnPropertyDescriptor(
2194-
HTMLInputElement.prototype,
2195-
'value',
2196-
).set;
2197-
const getType = Object.getOwnPropertyDescriptor(
2198-
HTMLInputElement.prototype,
2199-
'type',
2200-
).get;
2201-
const setType = Object.getOwnPropertyDescriptor(
2202-
HTMLInputElement.prototype,
2203-
'type',
2204-
).set;
2205-
if (type === 'input') {
2206-
Object.defineProperty(el, 'defaultValue', {
2207-
get: function () {
2208-
return getDefaultValue.call(this);
2209-
},
2210-
set: function (val) {
2211-
log.push(`node.defaultValue = ${strify(val)}`);
2212-
setDefaultValue.call(this, val);
2213-
},
2214-
});
2215-
Object.defineProperty(el, 'value', {
2216-
get: function () {
2217-
return getValue.call(this);
2218-
},
2219-
set: function (val) {
2220-
log.push(`node.value = ${strify(val)}`);
2221-
setValue.call(this, val);
2222-
},
2223-
});
2224-
Object.defineProperty(el, 'type', {
2225-
get: function () {
2226-
return getType.call(this);
2227-
},
2228-
set: function (val) {
2229-
log.push(`node.type = ${strify(val)}`);
2230-
setType.call(this, val);
2231-
},
2232-
});
2233-
spyOnDevAndProd(el, 'setAttribute').mockImplementation(function (
2234-
name,
2235-
val,
2236-
) {
2237-
log.push(`node.setAttribute(${strify(name)}, ${strify(val)})`);
2238-
});
2239-
}
2240-
return el;
2241-
});
2179+
spyOnDevAndProd(document, 'createElement').mockImplementation(
2180+
function (type) {
2181+
const el = originalCreateElement.apply(this, arguments);
2182+
const getDefaultValue = Object.getOwnPropertyDescriptor(
2183+
HTMLInputElement.prototype,
2184+
'defaultValue',
2185+
).get;
2186+
const setDefaultValue = Object.getOwnPropertyDescriptor(
2187+
HTMLInputElement.prototype,
2188+
'defaultValue',
2189+
).set;
2190+
const getValue = Object.getOwnPropertyDescriptor(
2191+
HTMLInputElement.prototype,
2192+
'value',
2193+
).get;
2194+
const setValue = Object.getOwnPropertyDescriptor(
2195+
HTMLInputElement.prototype,
2196+
'value',
2197+
).set;
2198+
const getType = Object.getOwnPropertyDescriptor(
2199+
HTMLInputElement.prototype,
2200+
'type',
2201+
).get;
2202+
const setType = Object.getOwnPropertyDescriptor(
2203+
HTMLInputElement.prototype,
2204+
'type',
2205+
).set;
2206+
if (type === 'input') {
2207+
Object.defineProperty(el, 'defaultValue', {
2208+
get: function () {
2209+
return getDefaultValue.call(this);
2210+
},
2211+
set: function (val) {
2212+
log.push(`node.defaultValue = ${strify(val)}`);
2213+
setDefaultValue.call(this, val);
2214+
},
2215+
});
2216+
Object.defineProperty(el, 'value', {
2217+
get: function () {
2218+
return getValue.call(this);
2219+
},
2220+
set: function (val) {
2221+
log.push(`node.value = ${strify(val)}`);
2222+
setValue.call(this, val);
2223+
},
2224+
});
2225+
Object.defineProperty(el, 'type', {
2226+
get: function () {
2227+
return getType.call(this);
2228+
},
2229+
set: function (val) {
2230+
log.push(`node.type = ${strify(val)}`);
2231+
setType.call(this, val);
2232+
},
2233+
});
2234+
spyOnDevAndProd(el, 'setAttribute').mockImplementation(
2235+
function (name, val) {
2236+
log.push(`node.setAttribute(${strify(name)}, ${strify(val)})`);
2237+
},
2238+
);
2239+
}
2240+
return el;
2241+
},
2242+
);
22422243

22432244
ReactDOM.render(<input type="date" defaultValue="1980-01-01" />, container);
22442245

0 commit comments

Comments
 (0)