Skip to content

Commit 174b8f5

Browse files
committed
Update prettier and reformat source code
1 parent c8f6db8 commit 174b8f5

File tree

162 files changed

+2952
-1372
lines changed

Some content is hidden

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

162 files changed

+2952
-1372
lines changed

configs/jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
const babelConfig = require('./babel.config.js');
44

55
module.exports = {
6-
coveragePathIgnorePatterns: ['/node_modules/', '<rootDir>/packages/react-native-web/src/vendor/'],
6+
coveragePathIgnorePatterns: [
7+
'/node_modules/',
8+
'<rootDir>/packages/react-native-web/src/vendor/'
9+
],
710
fakeTimers: {
811
enableGlobally: true
912
},

configs/jest.config.node.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
const babelConfig = require('./babel.config.js');
44

55
module.exports = {
6-
coveragePathIgnorePatterns: ['/node_modules/', '<rootDir>/packages/react-native-web/src/vendor/'],
6+
coveragePathIgnorePatterns: [
7+
'/node_modules/',
8+
'<rootDir>/packages/react-native-web/src/vendor/'
9+
],
710
fakeTimers: {
811
enableGlobally: true
912
},

package-lock.json

Lines changed: 20 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"lint-staged": "^10.5.4",
5858
"minimist": "^1.2.6",
5959
"npm-run-all": "^4.1.3",
60-
"prettier": "^2.2.1"
60+
"prettier": "^2.7.1"
6161
},
6262
"workspaces": [
6363
"packages/react-native-web",
@@ -81,7 +81,6 @@
8181
]
8282
},
8383
"prettier": {
84-
"printWidth": 100,
8584
"singleQuote": true,
8685
"trailingComma": "none"
8786
},

packages/babel-plugin-react-native-web/src/index.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const isCommonJS = (opts) => opts.commonjs === true;
44

55
const getDistLocation = (importName, opts) => {
66
const format = isCommonJS(opts) ? 'cjs/' : '';
7-
const internalName = importName === 'unstable_createElement' ? 'createElement' : importName;
7+
const internalName =
8+
importName === 'unstable_createElement' ? 'createElement' : importName;
89
if (internalName === 'index') {
910
return `react-native-web/dist/${format}index`;
1011
} else if (internalName && moduleMap[internalName]) {
@@ -24,7 +25,8 @@ const isReactNativeRequire = (t, node) => {
2425
t.isIdentifier(init.callee) &&
2526
init.callee.name === 'require' &&
2627
init.arguments.length === 1 &&
27-
(init.arguments[0].value === 'react-native' || init.arguments[0].value === 'react-native-web')
28+
(init.arguments[0].value === 'react-native' ||
29+
init.arguments[0].value === 'react-native-web')
2830
);
2931
};
3032

@@ -48,7 +50,11 @@ module.exports = function ({ types: t }) {
4850

4951
if (distLocation) {
5052
return t.importDeclaration(
51-
[t.importDefaultSpecifier(t.identifier(specifier.local.name))],
53+
[
54+
t.importDefaultSpecifier(
55+
t.identifier(specifier.local.name)
56+
)
57+
],
5258
t.stringLiteral(distLocation)
5359
);
5460
}
@@ -76,7 +82,12 @@ module.exports = function ({ types: t }) {
7682
if (distLocation) {
7783
return t.exportNamedDeclaration(
7884
null,
79-
[t.exportSpecifier(t.identifier('default'), t.identifier(exportName))],
85+
[
86+
t.exportSpecifier(
87+
t.identifier('default'),
88+
t.identifier(exportName)
89+
)
90+
],
8091
t.stringLiteral(distLocation)
8192
);
8293
}
@@ -98,13 +109,18 @@ module.exports = function ({ types: t }) {
98109
if (t.isObjectPattern(id)) {
99110
const imports = id.properties
100111
.map((identifier) => {
101-
const distLocation = getDistLocation(identifier.key.name, state.opts);
112+
const distLocation = getDistLocation(
113+
identifier.key.name,
114+
state.opts
115+
);
102116
if (distLocation) {
103117
return t.variableDeclaration(path.node.kind, [
104118
t.variableDeclarator(
105119
t.identifier(identifier.value.name),
106120
t.memberExpression(
107-
t.callExpression(t.identifier('require'), [t.stringLiteral(distLocation)]),
121+
t.callExpression(t.identifier('require'), [
122+
t.stringLiteral(distLocation)
123+
]),
108124
t.identifier('default')
109125
)
110126
)

packages/benchmarks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"react-native-web": "0.18.4"
1717
},
1818
"devDependencies": {
19-
"babel-loader": "^8.2.2",
19+
"babel-loader": "^8.2.5",
2020
"babel-plugin-react-native-web": "0.18.4",
2121
"css-loader": "^6.7.1",
2222
"style-loader": "^3.3.1",

packages/benchmarks/src/app/App.js

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import Benchmark from './Benchmark';
2-
import { Picker, StyleSheet, ScrollView, TouchableOpacity, View } from 'react-native';
2+
import {
3+
Picker,
4+
StyleSheet,
5+
ScrollView,
6+
TouchableOpacity,
7+
View
8+
} from 'react-native';
39
import React, { Component } from 'react';
410
import Button from './Button';
511
import { IconClear, IconEye } from './Icons';
@@ -26,9 +32,12 @@ export default class App extends Component {
2632

2733
render() {
2834
const { tests } = this.props;
29-
const { currentBenchmarkName, status, currentLibraryName, results } = this.state;
30-
const currentImplementation = tests[currentBenchmarkName][currentLibraryName];
31-
const { Component, Provider, getComponentProps, sampleCount } = currentImplementation;
35+
const { currentBenchmarkName, status, currentLibraryName, results } =
36+
this.state;
37+
const currentImplementation =
38+
tests[currentBenchmarkName][currentLibraryName];
39+
const { Component, Provider, getComponentProps, sampleCount } =
40+
currentImplementation;
3241

3342
return (
3443
<Layout
@@ -45,9 +54,15 @@ export default class App extends Component {
4554
selectedValue={currentLibraryName}
4655
style={styles.picker}
4756
>
48-
{Object.keys(tests[currentBenchmarkName]).map((libraryName) => (
49-
<Picker.Item key={libraryName} label={libraryName} value={libraryName} />
50-
))}
57+
{Object.keys(tests[currentBenchmarkName]).map(
58+
(libraryName) => (
59+
<Picker.Item
60+
key={libraryName}
61+
label={libraryName}
62+
value={libraryName}
63+
/>
64+
)
65+
)}
5166
</Picker>
5267
</View>
5368
<View style={{ width: 1, backgroundColor: colors.fadedGray }} />
@@ -185,24 +200,27 @@ export default class App extends Component {
185200
}
186201
};
187202

188-
_createHandleComplete = ({ benchmarkName, libraryName, sampleCount }) => (results) => {
189-
this.setState(
190-
(state) => ({
191-
results: state.results.concat([
192-
{
193-
...results,
194-
benchmarkName,
195-
libraryName,
196-
libraryVersion: this.props.tests[benchmarkName][libraryName].version
197-
}
198-
]),
199-
status: 'complete'
200-
}),
201-
this._scrollToEnd
202-
);
203-
// console.log(results);
204-
// console.log(results.samples.map(sample => sample.elapsed.toFixed(1)).join('\n'));
205-
};
203+
_createHandleComplete =
204+
({ benchmarkName, libraryName, sampleCount }) =>
205+
(results) => {
206+
this.setState(
207+
(state) => ({
208+
results: state.results.concat([
209+
{
210+
...results,
211+
benchmarkName,
212+
libraryName,
213+
libraryVersion:
214+
this.props.tests[benchmarkName][libraryName].version
215+
}
216+
]),
217+
status: 'complete'
218+
}),
219+
this._scrollToEnd
220+
);
221+
// console.log(results);
222+
// console.log(results.samples.map(sample => sample.elapsed.toFixed(1)).join('\n'));
223+
};
206224

207225
_handleClear = () => {
208226
this.setState(() => ({ results: [] }));

0 commit comments

Comments
 (0)