Update prettier and reformat code

This commit is contained in:
Nicolas Gallagher
2021-02-08 14:03:10 -08:00
parent 86b8048012
commit a5d6cd51ef
115 changed files with 714 additions and 727 deletions
+9 -9
View File
@@ -45,7 +45,7 @@ export default class App extends Component {
selectedValue={currentLibraryName}
style={styles.picker}
>
{Object.keys(tests[currentBenchmarkName]).map(libraryName => (
{Object.keys(tests[currentBenchmarkName]).map((libraryName) => (
<Picker.Item key={libraryName} label={libraryName} value={libraryName} />
))}
</Picker>
@@ -60,7 +60,7 @@ export default class App extends Component {
selectedValue={currentBenchmarkName}
style={styles.picker}
>
{Object.keys(tests).map(test => (
{Object.keys(tests).map((test) => (
<Picker.Item key={test} label={test} value={test} />
))}
</Picker>
@@ -156,11 +156,11 @@ export default class App extends Component {
);
}
_handleChangeBenchmark = value => {
_handleChangeBenchmark = (value) => {
this.setState(() => ({ currentBenchmarkName: value }));
};
_handleChangeLibrary = value => {
_handleChangeLibrary = (value) => {
this.setState(() => ({ currentLibraryName: value }));
};
@@ -187,9 +187,9 @@ export default class App extends Component {
}
};
_createHandleComplete = ({ benchmarkName, libraryName, sampleCount }) => results => {
_createHandleComplete = ({ benchmarkName, libraryName, sampleCount }) => (results) => {
this.setState(
state => ({
(state) => ({
results: state.results.concat([
{
...results,
@@ -210,15 +210,15 @@ export default class App extends Component {
this.setState(() => ({ results: [] }));
};
_setBenchRef = ref => {
_setBenchRef = (ref) => {
this._benchmarkRef = ref;
};
_setBenchWrapperRef = ref => {
_setBenchWrapperRef = (ref) => {
this._benchWrapperRef = ref;
};
_setScrollRef = ref => {
_setScrollRef = (ref) => {
this._scrollRef = ref;
};
@@ -119,7 +119,7 @@ export default class Benchmark extends Component<BenchmarkPropsType, BenchmarkSt
componentWillReceiveProps(nextProps: BenchmarkPropsType) {
if (nextProps) {
this.setState(state => ({ componentProps: nextProps.getComponentProps(state.cycle) }));
this.setState((state) => ({ componentProps: nextProps.getComponentProps(state.cycle) }));
}
}
+3 -6
View File
@@ -13,15 +13,12 @@ const styles = StyleSheet.create({
}
});
const createIcon = children => {
const Icon = props =>
const createIcon = (children) => {
const Icon = (props) =>
createElement(
'svg',
{
style: StyleSheet.compose(
styles.root,
props.style
),
style: StyleSheet.compose(styles.root, props.style),
width: 24,
height: 24,
viewBox: '0 0 24 24'
+3 -3
View File
@@ -4,7 +4,7 @@ import { Dimensions, Platform } from 'react-native';
const baseFontSize = 14;
const baseUnit = 1.3125;
const createPlatformLength = multiplier =>
const createPlatformLength = (multiplier) =>
Platform.select({ web: `${multiplier}rem`, default: multiplier * baseFontSize });
/**
@@ -87,7 +87,7 @@ export const spaces = {
if (Platform.OS === 'web' && canUseDOM) {
const { medium, large } = breakpoints;
const htmlElement = document.documentElement;
const setFontSize = width => {
const setFontSize = (width) => {
const fontSize = width > medium ? (width > large ? '18px' : '17px') : '16px';
if (htmlElement) {
htmlElement.style.fontSize = fontSize;
@@ -95,7 +95,7 @@ if (Platform.OS === 'web' && canUseDOM) {
};
setFontSize(Dimensions.get('window').width);
Dimensions.addEventListener('change', dimensions => {
Dimensions.addEventListener('change', (dimensions) => {
setFontSize(dimensions.window.width);
});
}
+1 -1
View File
@@ -21,7 +21,7 @@ type ImplementationType = {
};
const toImplementations = (context: Object): Array<ImplementationType> =>
context.keys().map(path => {
context.keys().map((path) => {
const components = context(path).default;
const name = path.split('/')[1];
const version = dependencies[name] || '';
@@ -11,15 +11,7 @@ const compose = (s1, s2) => {
class View extends React.Component {
render() {
const { style, ...other } = this.props;
return (
<div
{...other}
style={compose(
viewStyle,
style
)}
/>
);
return <div {...other} style={compose(viewStyle, style)} />;
}
}
@@ -1,7 +1,7 @@
import styled from 'styled-components';
import View from './View';
const getColor = color => {
const getColor = (color) => {
switch (color) {
case 0:
return '#14171A';
@@ -22,10 +22,10 @@ const getColor = color => {
const Box = styled(View)`
align-self: flex-start;
flex-direction: ${props => (props.layout === 'column' ? 'column' : 'row')};
padding: ${props => (props.outer ? '4px' : '0')};
${props => props.fixed && 'height:6px;'} ${props =>
props.fixed && 'width:6px;'} background-color: ${props => getColor(props.color)};
flex-direction: ${(props) => (props.layout === 'column' ? 'column' : 'row')};
padding: ${(props) => (props.outer ? '4px' : '0')};
${(props) => props.fixed && 'height:6px;'} ${(props) =>
props.fixed && 'width:6px;'} background-color: ${(props) => getColor(props.color)};
`;
export default Box;
@@ -1,7 +1,7 @@
import styled from 'styled-components';
import View from './View';
const Dot = styled(View).attrs(props => ({
const Dot = styled(View).attrs((props) => ({
style: {
marginLeft: `${props.x}px`,
marginTop: `${props.y}px`,
@@ -2,7 +2,7 @@ import classnames from 'classnames';
import React from 'react';
import View from './View';
const getColor = color => {
const getColor = (color) => {
switch (color) {
case 0:
return '#14171A';
@@ -21,7 +21,7 @@ const getColor = color => {
}
};
const Box = props => {
const Box = (props) => {
const { className, children: styles } = (
<scope className={classnames('Box', props.fixed && 'fixed')}>
<style jsx>{`
@@ -1,7 +1,7 @@
import React from 'react';
import View from './View';
const Dot = props => {
const Dot = (props) => {
const { className, children: styles } = (
<scope className="Dot">
<style jsx>{`
+5 -5
View File
@@ -10,7 +10,7 @@ import ReactDOM from 'react-dom';
const implementations = impl;
const packageNames = Object.keys(implementations);
const createTestBlock = fn => {
const createTestBlock = (fn) => {
return packageNames.reduce((testSetups, packageName) => {
const { name, components, version } = implementations[packageName];
const { Component, getComponentProps, sampleCount, Provider, benchmarkType } = fn(components);
@@ -29,21 +29,21 @@ const createTestBlock = fn => {
};
const tests = {
'Mount deep tree': createTestBlock(components => ({
'Mount deep tree': createTestBlock((components) => ({
benchmarkType: 'mount',
Component: Tree,
getComponentProps: () => ({ breadth: 2, components, depth: 7, id: 0, wrap: 1 }),
Provider: components.Provider,
sampleCount: 50
})),
'Mount wide tree': createTestBlock(components => ({
'Mount wide tree': createTestBlock((components) => ({
benchmarkType: 'mount',
Component: Tree,
getComponentProps: () => ({ breadth: 6, components, depth: 3, id: 0, wrap: 2 }),
Provider: components.Provider,
sampleCount: 50
})),
'Update dynamic styles': createTestBlock(components => ({
'Update dynamic styles': createTestBlock((components) => ({
benchmarkType: 'update',
Component: SierpinskiTriangle,
getComponentProps: ({ cycle }) => {
@@ -52,7 +52,7 @@ const tests = {
Provider: components.Provider,
sampleCount: 100
})),
'Mount text tree': createTestBlock(components => ({
'Mount text tree': createTestBlock((components) => ({
benchmarkType: 'mount',
Component: TextTree,
getComponentProps: () => ({ breadth: 6, components, depth: 3, id: 0, wrap: 2 }),