Skip to content

Commit a5d6cd5

Browse files
committed
Update prettier and reformat code
1 parent 86b8048 commit a5d6cd5

File tree

115 files changed

+706
-719
lines changed

Some content is hidden

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

115 files changed

+706
-719
lines changed

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ coverage
22
dist
33
node_modules
44
packages/**/vendor/*
5-
packages/examples
5+
packages/examples/.next

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = function(api) {
1+
module.exports = function (api) {
22
api.cache(true);
33

44
return {

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"jest-canvas-mock": "^2.3.1",
6161
"lint-staged": "^9.4.2",
6262
"npm-run-all": "^4.1.3",
63-
"prettier": "^1.18.2",
63+
"prettier": "^2.2.1",
6464
"react": "^17.0.1",
6565
"react-dom": "^17.0.1",
6666
"react-test-renderer": "^17.0.1"
@@ -82,7 +82,8 @@
8282
},
8383
"prettier": {
8484
"printWidth": 100,
85-
"singleQuote": true
85+
"singleQuote": true,
86+
"trailingComma": "none"
8687
},
8788
"author": "Nicolas Gallagher",
8889
"license": "MIT"

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const moduleMap = require('./moduleMap');
22

3-
const isCommonJS = opts => opts.commonjs === true;
3+
const isCommonJS = (opts) => opts.commonjs === true;
44

55
const getDistLocation = (importName, opts) => {
66
const format = isCommonJS(opts) ? 'cjs/' : '';
@@ -33,15 +33,15 @@ const isReactNativeModule = ({ source, specifiers }) =>
3333
(source.value === 'react-native' || source.value === 'react-native-web') &&
3434
specifiers.length;
3535

36-
module.exports = function({ types: t }) {
36+
module.exports = function ({ types: t }) {
3737
return {
3838
name: 'Rewrite react-native to react-native-web',
3939
visitor: {
4040
ImportDeclaration(path, state) {
4141
const { specifiers } = path.node;
4242
if (isReactNativeModule(path.node)) {
4343
const imports = specifiers
44-
.map(specifier => {
44+
.map((specifier) => {
4545
if (t.isImportSpecifier(specifier)) {
4646
const importName = specifier.imported.name;
4747
const distLocation = getDistLocation(importName, state.opts);
@@ -67,7 +67,7 @@ module.exports = function({ types: t }) {
6767
const { specifiers } = path.node;
6868
if (isReactNativeModule(path.node)) {
6969
const exports = specifiers
70-
.map(specifier => {
70+
.map((specifier) => {
7171
if (t.isExportSpecifier(specifier)) {
7272
const exportName = specifier.exported.name;
7373
const localName = specifier.local.name;
@@ -97,7 +97,7 @@ module.exports = function({ types: t }) {
9797
const { id } = path.node.declarations[0];
9898
if (t.isObjectPattern(id)) {
9999
const imports = id.properties
100-
.map(identifier => {
100+
.map((identifier) => {
101101
const distLocation = getDistLocation(identifier.key.name, state.opts);
102102
if (distLocation) {
103103
return t.variableDeclaration(path.node.kind, [

packages/benchmarks/src/app/App.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default class App extends Component {
4545
selectedValue={currentLibraryName}
4646
style={styles.picker}
4747
>
48-
{Object.keys(tests[currentBenchmarkName]).map(libraryName => (
48+
{Object.keys(tests[currentBenchmarkName]).map((libraryName) => (
4949
<Picker.Item key={libraryName} label={libraryName} value={libraryName} />
5050
))}
5151
</Picker>
@@ -60,7 +60,7 @@ export default class App extends Component {
6060
selectedValue={currentBenchmarkName}
6161
style={styles.picker}
6262
>
63-
{Object.keys(tests).map(test => (
63+
{Object.keys(tests).map((test) => (
6464
<Picker.Item key={test} label={test} value={test} />
6565
))}
6666
</Picker>
@@ -156,11 +156,11 @@ export default class App extends Component {
156156
);
157157
}
158158

159-
_handleChangeBenchmark = value => {
159+
_handleChangeBenchmark = (value) => {
160160
this.setState(() => ({ currentBenchmarkName: value }));
161161
};
162162

163-
_handleChangeLibrary = value => {
163+
_handleChangeLibrary = (value) => {
164164
this.setState(() => ({ currentLibraryName: value }));
165165
};
166166

@@ -187,9 +187,9 @@ export default class App extends Component {
187187
}
188188
};
189189

190-
_createHandleComplete = ({ benchmarkName, libraryName, sampleCount }) => results => {
190+
_createHandleComplete = ({ benchmarkName, libraryName, sampleCount }) => (results) => {
191191
this.setState(
192-
state => ({
192+
(state) => ({
193193
results: state.results.concat([
194194
{
195195
...results,
@@ -210,15 +210,15 @@ export default class App extends Component {
210210
this.setState(() => ({ results: [] }));
211211
};
212212

213-
_setBenchRef = ref => {
213+
_setBenchRef = (ref) => {
214214
this._benchmarkRef = ref;
215215
};
216216

217-
_setBenchWrapperRef = ref => {
217+
_setBenchWrapperRef = (ref) => {
218218
this._benchWrapperRef = ref;
219219
};
220220

221-
_setScrollRef = ref => {
221+
_setScrollRef = (ref) => {
222222
this._scrollRef = ref;
223223
};
224224

packages/benchmarks/src/app/Benchmark/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export default class Benchmark extends Component<BenchmarkPropsType, BenchmarkSt
119119

120120
componentWillReceiveProps(nextProps: BenchmarkPropsType) {
121121
if (nextProps) {
122-
this.setState(state => ({ componentProps: nextProps.getComponentProps(state.cycle) }));
122+
this.setState((state) => ({ componentProps: nextProps.getComponentProps(state.cycle) }));
123123
}
124124
}
125125

packages/benchmarks/src/app/Icons.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,12 @@ const styles = StyleSheet.create({
1313
}
1414
});
1515

16-
const createIcon = children => {
17-
const Icon = props =>
16+
const createIcon = (children) => {
17+
const Icon = (props) =>
1818
createElement(
1919
'svg',
2020
{
21-
style: StyleSheet.compose(
22-
styles.root,
23-
props.style
24-
),
21+
style: StyleSheet.compose(styles.root, props.style),
2522
width: 24,
2623
height: 24,
2724
viewBox: '0 0 24 24'

packages/benchmarks/src/app/theme.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Dimensions, Platform } from 'react-native';
44
const baseFontSize = 14;
55
const baseUnit = 1.3125;
66

7-
const createPlatformLength = multiplier =>
7+
const createPlatformLength = (multiplier) =>
88
Platform.select({ web: `${multiplier}rem`, default: multiplier * baseFontSize });
99

1010
/**
@@ -87,15 +87,15 @@ export const spaces = {
8787
if (Platform.OS === 'web' && canUseDOM) {
8888
const { medium, large } = breakpoints;
8989
const htmlElement = document.documentElement;
90-
const setFontSize = width => {
90+
const setFontSize = (width) => {
9191
const fontSize = width > medium ? (width > large ? '18px' : '17px') : '16px';
9292
if (htmlElement) {
9393
htmlElement.style.fontSize = fontSize;
9494
}
9595
};
9696

9797
setFontSize(Dimensions.get('window').width);
98-
Dimensions.addEventListener('change', dimensions => {
98+
Dimensions.addEventListener('change', (dimensions) => {
9999
setFontSize(dimensions.window.width);
100100
});
101101
}

packages/benchmarks/src/impl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type ImplementationType = {
2121
};
2222

2323
const toImplementations = (context: Object): Array<ImplementationType> =>
24-
context.keys().map(path => {
24+
context.keys().map((path) => {
2525
const components = context(path).default;
2626
const name = path.split('/')[1];
2727
const version = dependencies[name] || '';

packages/benchmarks/src/implementations/inline-styles/View.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,7 @@ const compose = (s1, s2) => {
1111
class View extends React.Component {
1212
render() {
1313
const { style, ...other } = this.props;
14-
return (
15-
<div
16-
{...other}
17-
style={compose(
18-
viewStyle,
19-
style
20-
)}
21-
/>
22-
);
14+
return <div {...other} style={compose(viewStyle, style)} />;
2315
}
2416
}
2517

0 commit comments

Comments
 (0)