Clean up benchmark exports and PropTypes import

This commit is contained in:
Nicolas Gallagher
2017-07-09 18:43:46 -07:00
parent 8f56454ed7
commit 2607cb25ab
35 changed files with 68 additions and 67 deletions
+6 -2
View File
@@ -5,7 +5,9 @@ const node = document.querySelector('.root');
const createRenderBenchmark = ({ description, getElement, name, runs }) => () => {
const setup = () => {};
const teardown = () => ReactDOM.unmountComponentAtNode(node);
const teardown = () => {
ReactDOM.unmountComponentAtNode(node);
};
return benchmark({
name,
@@ -13,7 +15,9 @@ const createRenderBenchmark = ({ description, getElement, name, runs }) => () =>
runs,
setup,
teardown,
task: () => ReactDOM.render(getElement(), node)
task: () => {
ReactDOM.render(getElement(), node);
}
});
};
+2 -1
View File
@@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import theme from '../theme';
import React, { PropTypes, PureComponent } from 'react';
import React, { PureComponent } from 'react';
import { StyleSheet, Text } from 'react-native';
class AppText extends PureComponent {
@@ -1,4 +1,5 @@
import React, { PureComponent, PropTypes } from 'react';
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import { StyleSheet, View } from 'react-native';
class AspectRatio extends PureComponent {
+1 -1
View File
@@ -45,4 +45,4 @@ const styles = StyleSheet.create({
}
});
module.exports = Box;
export default Box;
+1 -1
View File
@@ -14,4 +14,4 @@ const Box = ({ color, fixed = false, layout = 'column', outer = false, ...other
})}
/>;
module.exports = Box;
export default Box;
+1 -1
View File
@@ -44,4 +44,4 @@ const styles = {
}
};
module.exports = Box;
export default Box;
+1 -1
View File
@@ -46,4 +46,4 @@ const styles = {
}
};
module.exports = injectSheet(styles)(Box);
export default injectSheet(styles)(Box);
+1 -1
View File
@@ -45,4 +45,4 @@ const styles = StyleSheet.create({
}
});
module.exports = Box;
export default Box;
+1 -1
View File
@@ -44,4 +44,4 @@ const styles = StyleSheet.create({
}
});
module.exports = Box;
export default Box;
+1 -1
View File
@@ -44,4 +44,4 @@ const styles = {
})
};
module.exports = Box;
export default Box;
@@ -27,4 +27,4 @@ const Box = styled.View`
background-color: ${props => getColor(props.color)};
`;
module.exports = Box;
export default Box;
@@ -28,4 +28,4 @@ const Box = styled(View)`
background-color: ${props => getColor(props.color)};
`;
module.exports = Box;
export default Box;
+1 -1
View File
@@ -45,4 +45,4 @@ const styles = {
})
};
module.exports = Box;
export default Box;
+2 -1
View File
@@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import { StyleSheet, View } from 'react-native';
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import theme from '../theme';
class GridView extends Component {
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
class DeepTree extends Component {
static propTypes = {
@@ -40,4 +41,4 @@ class DeepTree extends Component {
}
}
module.exports = DeepTree;
export default DeepTree;
+2 -1
View File
@@ -1,11 +1,12 @@
import AspectRatio from '../AspectRatio';
import GridView from '../GridView';
import PropTypes from 'prop-types';
import TweetActionsBar from '../TweetActionsBar';
import TweetText from '../TweetText';
import UserAvatar from '../UserAvatar';
import UserNames from '../UserNames';
import { Image, StyleSheet, Text, View } from 'react-native';
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import theme from '../theme';
export class Tweet extends Component {
@@ -2,9 +2,10 @@ import IconReply from '../Icons/Reply';
import IconHeart from '../Icons/Heart';
import IconRetweet from '../Icons/Retweet';
import IconDirectMessage from '../Icons/DirectMessage';
import { Text, View, StyleSheet } from 'react-native';
import React, { PropTypes } from 'react';
import PropTypes from 'prop-types';
import React from 'react';
import theme from '../theme';
import { Text, View, StyleSheet } from 'react-native';
const getIcon = (icon, highlighted) => {
switch (icon) {
@@ -1,6 +1,7 @@
import PropTypes from 'prop-types';
import TweetAction from '../TweetAction';
import { View, StyleSheet } from 'react-native';
import React, { PropTypes, PureComponent } from 'react';
import React, { PureComponent } from 'react';
const actionNames = ['reply', 'retweet', 'like', 'directMessage'];
+5 -4
View File
@@ -1,15 +1,16 @@
import AppText from '../AppText';
import React from 'react';
import TweetTextPart from '../TweetTextPart';
import React, { PropTypes } from 'react';
import { array, number, string } from 'prop-types';
class TweetText extends React.Component {
static displayName = 'TweetText';
static propTypes = {
displayMode: TweetTextPart.propTypes.displayMode,
lang: PropTypes.string,
numberOfLines: PropTypes.number,
textParts: PropTypes.array.isRequired
lang: string,
numberOfLines: number,
textParts: array.isRequired
};
render() {
@@ -1,6 +1,7 @@
/* eslint-disable react/prop-types */
import { Image, StyleSheet, Text } from 'react-native';
import React, { PropTypes } from 'react';
import PropTypes from 'prop-types';
import React from 'react';
import theme from '../theme';
const createTextEntity = ({ part }) => <Text>{`${part.prefix}${part.text}`}</Text>;
@@ -1,6 +1,7 @@
import AspectRatio from '../AspectRatio';
import PropTypes from 'prop-types';
import { Image, StyleSheet } from 'react-native';
import React, { PropTypes, PureComponent } from 'react';
import React, { PureComponent } from 'react';
import theme from '../theme';
class UserAvatar extends PureComponent {
+2 -1
View File
@@ -1,6 +1,7 @@
import AppText from '../AppText';
import PropTypes from 'prop-types';
import { StyleSheet } from 'react-native';
import React, { PropTypes, PureComponent } from 'react';
import React, { PureComponent } from 'react';
class UserNames extends PureComponent {
static displayName = 'UserNames';
+1 -1
View File
@@ -28,4 +28,4 @@ const styles = StyleSheet.create({
}
});
module.exports = View;
export default View;
@@ -10,4 +10,4 @@ class View extends React.Component {
}
}
module.exports = View;
export default View;
+1 -1
View File
@@ -26,4 +26,4 @@ const viewStyle = {
minWidth: 0
};
module.exports = View;
export default View;
+1 -1
View File
@@ -29,4 +29,4 @@ const styles = {
}
};
module.exports = injectSheet(styles)(View);
export default injectSheet(styles)(View);
+1 -1
View File
@@ -32,4 +32,4 @@ const styles = StyleSheet.create({
}
});
module.exports = View;
export default View;
@@ -16,4 +16,4 @@ const View = styled.div`
min-width: 0;
`;
module.exports = View;
export default View;
+3 -1
View File
@@ -23,7 +23,7 @@ const fontSize = {
large: '1.25rem'
};
module.exports = {
const theme = {
colors,
fontFamily:
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif, ' +
@@ -36,3 +36,5 @@ module.exports = {
return `${num}${unit}`;
}
};
export default theme;
+3 -1
View File
@@ -1,7 +1,9 @@
import Box from './components/Box/css-modules';
import View from './components/View/css-modules';
export default {
const api = {
Box,
View
};
export default api;
+3 -1
View File
@@ -1,7 +1,9 @@
import Box from './components/Box/jss';
import View from './components/View/jss';
export default {
const api = {
Box,
View
};
export default api;
+3 -1
View File
@@ -1,7 +1,9 @@
import Box from './components/Box/react-native-stylesheet';
import View from './components/View/react-native-stylesheet';
export default {
const api = {
Box,
View
};
export default api;
+1 -1
View File
@@ -96,7 +96,7 @@ const tweet2 = {
}
};
const renderTweet = (label, components) =>
const renderTweet = label =>
createRenderBenchmark({
name: `Tweet [${label}]`,
runs: 10,
+1 -1
View File
@@ -21,7 +21,7 @@
"jest": "jest",
"jest:watch": "yarn test -- --watch",
"lint": "yarn lint:cmd -- benchmarks docs src",
"lint:cmd": "eslint --fix --ignore-path .gitignore",
"lint:cmd": "eslint --ignore-path .gitignore --fix",
"precommit": "lint-staged",
"release": "yarn lint && yarn test && yarn compile && yarn build && npm publish",
"test": "flow && jest"
+5 -27
View File
@@ -2053,7 +2053,7 @@ default-require-extensions@^1.0.0:
dependencies:
strip-bom "^2.0.0"
define-properties@^1.1.1, define-properties@^1.1.2:
define-properties@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94"
dependencies:
@@ -2307,7 +2307,7 @@ error-ex@^1.2.0:
dependencies:
is-arrayish "^0.2.1"
es-abstract@^1.3.2, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1, es-abstract@^1.6.1:
es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1, es-abstract@^1.6.1:
version "1.7.0"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.7.0.tgz#dfade774e01bfcd97f96180298c449c8623fb94c"
dependencies:
@@ -4665,16 +4665,7 @@ object.assign@^4.0.4:
function-bind "^1.1.0"
object-keys "^1.0.10"
object.entries@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.0.3.tgz#f42cc75363a4f9aa7037bcfb3bab3be4ffc78027"
dependencies:
define-properties "^1.1.1"
es-abstract "^1.3.2"
function-bind "^1.0.2"
has "^1.0.1"
object.entries@^1.0.4:
object.entries@^1.0.3, object.entries@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.0.4.tgz#1bf9a4dd2288f5b33f3a993d257661f05d161a5f"
dependencies:
@@ -4697,16 +4688,7 @@ object.omit@^2.0.0:
for-own "^0.1.4"
is-extendable "^0.1.1"
object.values@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.0.3.tgz#a7774ba050893fe6a5d5958acd05823e0f426bef"
dependencies:
define-properties "^1.1.1"
es-abstract "^1.3.2"
function-bind "^1.0.2"
has "^1.0.1"
object.values@^1.0.4:
object.values@^1.0.3, object.values@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.0.4.tgz#e524da09b4f66ff05df457546ec72ac99f13069a"
dependencies:
@@ -6448,11 +6430,7 @@ uuid@^2.0.1, uuid@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a"
uuid@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.0.tgz#6728fc0459c450d796a99c31837569bdf672d728"
uuid@^3.0.1:
uuid@^3.0.0, uuid@^3.0.1:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"