diff --git a/package.json b/package.json
index 69a06217..13c3b968 100644
--- a/package.json
+++ b/package.json
@@ -48,7 +48,7 @@
"babel-preset-react-native": "^1.9.1",
"del-cli": "^0.2.1",
"enzyme": "^2.4.1",
- "eslint": "^3.4.0",
+ "eslint": "^3.19.0",
"eslint-config-prettier": "^1.4.0",
"eslint-plugin-jsx-a11y": "^2.2.0",
"eslint-plugin-promise": "^2.0.1",
@@ -56,7 +56,7 @@
"file-loader": "^0.9.0",
"jest": "^19.0.2",
"node-libs-browser": "^0.5.3",
- "prettier": "^0.19.0",
+ "prettier": "^1.0.2",
"react": "~15.4.1",
"react-addons-test-utils": "~15.4.1",
"react-test-renderer": "~15.4.1",
diff --git a/performance/benchmark.js b/performance/benchmark.js
index 2ab3f603..fc2e9368 100644
--- a/performance/benchmark.js
+++ b/performance/benchmark.js
@@ -23,7 +23,7 @@ const median = values => {
}
const numbers = [...values].sort((a, b) => a - b);
- return (numbers[numbers.length - 1 >> 1] + numbers[numbers.length >> 1]) / 2;
+ return (numbers[(numbers.length - 1) >> 1] + numbers[numbers.length >> 1]) / 2;
};
const standardDeviation = values => {
diff --git a/performance/src/components/AppText/index.js b/performance/src/components/AppText/index.js
index 4447f4db..34d0de7e 100644
--- a/performance/src/components/AppText/index.js
+++ b/performance/src/components/AppText/index.js
@@ -15,15 +15,7 @@ class AppText extends PureComponent {
};
render() {
- const {
- align,
- color,
- fontStyle,
- size,
- uppercase,
- weight,
- ...other
- } = this.props;
+ const { align, color, fontStyle, size, uppercase, weight, ...other } = this.props;
const style = [
styles.root,
diff --git a/performance/src/components/Box/styled-components.js b/performance/src/components/Box/styled-components.js
index 7a02c2fa..8cce6166 100644
--- a/performance/src/components/Box/styled-components.js
+++ b/performance/src/components/Box/styled-components.js
@@ -21,10 +21,10 @@ const getColor = color => {
};
const Box = styled(View)`
- flex-direction: ${props => props.layout === 'column' ? 'column' : 'row'};
- padding: ${props => props.outer ? '4px' : '0'};
- height: ${props => props.fixed ? '20px' : 'auto'};
- width: ${props => props.fixed ? '20px' : 'auto'};
+ flex-direction: ${props => (props.layout === 'column' ? 'column' : 'row')};
+ padding: ${props => (props.outer ? '4px' : '0')};
+ height: ${props => (props.fixed ? '20px' : 'auto')};
+ width: ${props => (props.fixed ? '20px' : 'auto')};
background-color: ${props => getColor(props.color)};
`;
diff --git a/performance/src/components/GridView/index.js b/performance/src/components/GridView/index.js
index 808f5254..b84718ac 100644
--- a/performance/src/components/GridView/index.js
+++ b/performance/src/components/GridView/index.js
@@ -17,10 +17,12 @@ class GridView extends Component {
return (
{React.Children.map(children, child => {
- return child &&
+ return (
+ child &&
React.cloneElement(child, {
style: [child.props.style, styles.column, hasGap && styles.hasGapColumn]
- });
+ })
+ );
})}
);
@@ -40,7 +42,7 @@ const styles = StyleSheet.create({
minWidth: 0 // 2
},
hasGap: {
- marginHorizontal: theme.createLength(theme.spaceX * (-0.5), 'rem')
+ marginHorizontal: theme.createLength(theme.spaceX * -0.5, 'rem')
},
hasGapColumn: {
marginHorizontal: theme.createLength(theme.spaceX * 0.5, 'rem')
diff --git a/performance/src/components/Icons/DirectMessage.js b/performance/src/components/Icons/DirectMessage.js
index b6aa2161..579f54e1 100644
--- a/performance/src/components/Icons/DirectMessage.js
+++ b/performance/src/components/Icons/DirectMessage.js
@@ -2,18 +2,17 @@ import { createDOMElement } from 'react-native';
import React from 'react';
import styles from './styles';
-const IconDirectMessage = props => createDOMElement('svg', {
- children: (
-
-
-
-
- ),
- style: [styles.icon, props.style],
- viewBox: '0 0 56 72'
-});
+const IconDirectMessage = props =>
+ createDOMElement('svg', {
+ children: (
+
+
+
+
+ ),
+ style: [styles.icon, props.style],
+ viewBox: '0 0 56 72'
+ });
IconDirectMessage.metadata = { height: 72, width: 56 };
diff --git a/performance/src/components/Icons/Heart.js b/performance/src/components/Icons/Heart.js
index d5695aa1..4194e53b 100644
--- a/performance/src/components/Icons/Heart.js
+++ b/performance/src/components/Icons/Heart.js
@@ -2,17 +2,16 @@ import { createDOMElement } from 'react-native';
import React from 'react';
import styles from './styles';
-const IconHeart = props => createDOMElement('svg', {
- children: (
-
-
-
- ),
- style: [styles.icon, props.style],
- viewBox: '0 0 54 72'
-});
+const IconHeart = props =>
+ createDOMElement('svg', {
+ children: (
+
+
+
+ ),
+ style: [styles.icon, props.style],
+ viewBox: '0 0 54 72'
+ });
IconHeart.metadata = { height: 72, width: 54 };
diff --git a/performance/src/components/Icons/Reply.js b/performance/src/components/Icons/Reply.js
index 699c5fec..eef6ab0a 100644
--- a/performance/src/components/Icons/Reply.js
+++ b/performance/src/components/Icons/Reply.js
@@ -2,17 +2,16 @@ import { createDOMElement } from 'react-native';
import React from 'react';
import styles from './styles';
-const IconReply = props => createDOMElement('svg', {
- children: (
-
-
-
- ),
- style: [styles.icon, props.style],
- viewBox: '0 0 62 72'
-});
+const IconReply = props =>
+ createDOMElement('svg', {
+ children: (
+
+
+
+ ),
+ style: [styles.icon, props.style],
+ viewBox: '0 0 62 72'
+ });
IconReply.metadata = { height: 72, width: 62 };
diff --git a/performance/src/components/Icons/Retweet.js b/performance/src/components/Icons/Retweet.js
index daff6649..b06e8468 100644
--- a/performance/src/components/Icons/Retweet.js
+++ b/performance/src/components/Icons/Retweet.js
@@ -2,17 +2,16 @@ import { createDOMElement } from 'react-native';
import React from 'react';
import styles from './styles';
-const IconRetweet = props => createDOMElement('svg', {
- children: (
-
-
-
- ),
- style: [styles.icon, props.style],
- viewBox: '0 0 74 72'
-});
+const IconRetweet = props =>
+ createDOMElement('svg', {
+ children: (
+
+
+
+ ),
+ style: [styles.icon, props.style],
+ viewBox: '0 0 74 72'
+ });
IconRetweet.metadata = { height: 72, width: 74 };
diff --git a/performance/src/components/NestedTree/index.js b/performance/src/components/NestedTree/index.js
index 87cacba2..e988bc0c 100644
--- a/performance/src/components/NestedTree/index.js
+++ b/performance/src/components/NestedTree/index.js
@@ -17,17 +17,16 @@ class DeepTree extends Component {
{depth === 0 && }
{depth !== 0 &&
- Array.from({ length: breadth })
- .map((el, i) => (
-
- ))}
+ Array.from({ length: breadth }).map((el, i) => (
+
+ ))}
);
for (let i = 0; i < wrap; i++) {
diff --git a/performance/src/components/UserNames/index.js b/performance/src/components/UserNames/index.js
index cce85ac4..4f5b2075 100644
--- a/performance/src/components/UserNames/index.js
+++ b/performance/src/components/UserNames/index.js
@@ -18,14 +18,7 @@ class UserNames extends PureComponent {
};
render() {
- const {
- fullName,
- layout,
- onPress,
- screenName,
- style,
- ...other
- } = this.props;
+ const { fullName, layout, onPress, screenName, style, ...other } = this.props;
return (
createRenderBenchmark({
- name: `Deep tree [${label}]`,
- runs: 20,
- getElement() {
- return ;
- }
-});
+const renderDeepTree = (label, components) =>
+ createRenderBenchmark({
+ name: `Deep tree [${label}]`,
+ runs: 20,
+ getElement() {
+ return ;
+ }
+ });
export default renderDeepTree;
diff --git a/performance/tests/renderTweet.js b/performance/tests/renderTweet.js
index e1caafce..cc125e5a 100644
--- a/performance/tests/renderTweet.js
+++ b/performance/tests/renderTweet.js
@@ -96,17 +96,18 @@ const tweet2 = {
}
};
-const renderTweet = (label, components) => createRenderBenchmark({
- name: `Tweet [${label}]`,
- runs: 10,
- getElement() {
- return (
-
-
-
-
- );
- }
-});
+const renderTweet = (label, components) =>
+ createRenderBenchmark({
+ name: `Tweet [${label}]`,
+ runs: 10,
+ getElement() {
+ return (
+
+
+
+
+ );
+ }
+ });
export default renderTweet;
diff --git a/performance/tests/renderWideTree.js b/performance/tests/renderWideTree.js
index 2c404766..948585ca 100644
--- a/performance/tests/renderWideTree.js
+++ b/performance/tests/renderWideTree.js
@@ -2,12 +2,13 @@ import createRenderBenchmark from '../createRenderBenchmark';
import NestedTree from '../src/components/NestedTree';
import React from 'react';
-const renderWideTree = (label, components) => createRenderBenchmark({
- name: `Wide tree [${label}]`,
- runs: 20,
- getElement() {
- return ;
- }
-});
+const renderWideTree = (label, components) =>
+ createRenderBenchmark({
+ name: `Wide tree [${label}]`,
+ runs: 20,
+ getElement() {
+ return ;
+ }
+ });
export default renderWideTree;
diff --git a/src/apis/AsyncStorage/index.js b/src/apis/AsyncStorage/index.js
index fe78538b..7c9bef35 100644
--- a/src/apis/AsyncStorage/index.js
+++ b/src/apis/AsyncStorage/index.js
@@ -84,11 +84,10 @@ class AsyncStorage {
static multiGet(keys: Array) {
const promises = keys.map(key => AsyncStorage.getItem(key));
- return Promise.all(promises)
- .then(
- result => Promise.resolve(result.map((value, i) => [keys[i], value])),
- error => Promise.reject(error)
- );
+ return Promise.all(promises).then(
+ result => Promise.resolve(result.map((value, i) => [keys[i], value])),
+ error => Promise.reject(error)
+ );
}
/**
diff --git a/src/apis/NetInfo/index.js b/src/apis/NetInfo/index.js
index 5d35f210..b2ac9ca4 100644
--- a/src/apis/NetInfo/index.js
+++ b/src/apis/NetInfo/index.js
@@ -10,7 +10,8 @@ import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
import findIndex from 'array-find-index';
import invariant from 'fbjs/lib/invariant';
-const connection = ExecutionEnvironment.canUseDOM &&
+const connection =
+ ExecutionEnvironment.canUseDOM &&
(window.navigator.connection ||
window.navigator.mozConnection ||
window.navigator.webkitConnection);
diff --git a/src/apis/PanResponder/index.js b/src/apis/PanResponder/index.js
index 552cedba..d1247f7a 100644
--- a/src/apis/PanResponder/index.js
+++ b/src/apis/PanResponder/index.js
@@ -10,8 +10,10 @@ var TouchHistoryMath = require('../../vendor/TouchHistoryMath');
var currentCentroidXOfTouchesChangedAfter = TouchHistoryMath.currentCentroidXOfTouchesChangedAfter;
var currentCentroidYOfTouchesChangedAfter = TouchHistoryMath.currentCentroidYOfTouchesChangedAfter;
-var previousCentroidXOfTouchesChangedAfter = TouchHistoryMath.previousCentroidXOfTouchesChangedAfter;
-var previousCentroidYOfTouchesChangedAfter = TouchHistoryMath.previousCentroidYOfTouchesChangedAfter;
+var previousCentroidXOfTouchesChangedAfter =
+ TouchHistoryMath.previousCentroidXOfTouchesChangedAfter;
+var previousCentroidYOfTouchesChangedAfter =
+ TouchHistoryMath.previousCentroidYOfTouchesChangedAfter;
var currentCentroidX = TouchHistoryMath.currentCentroidX;
var currentCentroidY = TouchHistoryMath.currentCentroidY;
diff --git a/src/apis/Platform/index.js b/src/apis/Platform/index.js
index 745d99bc..576a96ec 100644
--- a/src/apis/Platform/index.js
+++ b/src/apis/Platform/index.js
@@ -1,6 +1,6 @@
const Platform = {
OS: 'web',
- select: (obj: Object) => 'web' in obj ? obj.web : obj.default
+ select: (obj: Object) => ('web' in obj ? obj.web : obj.default)
};
module.exports = Platform;
diff --git a/src/apis/StyleSheet/StyleManager.js b/src/apis/StyleSheet/StyleManager.js
index 310844b5..af008b9c 100644
--- a/src/apis/StyleSheet/StyleManager.js
+++ b/src/apis/StyleSheet/StyleManager.js
@@ -25,7 +25,8 @@ const pointerEvents = {
none: createClassName('pointerEvents', 'none')
};
-const pointerEventsCss = `.${pointerEvents.auto}{pointer-events:auto;}\n` +
+const pointerEventsCss =
+ `.${pointerEvents.auto}{pointer-events:auto;}\n` +
`.${pointerEvents.boxNone}{pointer-events:none;}\n` +
`.${pointerEvents.boxNone} *{pointer-events:auto;}\n` +
`.${pointerEvents.boxOnly}{pointer-events:auto;}\n` +
@@ -86,18 +87,15 @@ class StyleManager {
const cache = this.cache.byProp;
const mainSheetTextContext = Object.keys(cache)
- .reduce(
- (rules, prop) => {
- if (prop !== 'pointerEvents') {
- Object.keys(cache[prop]).forEach(value => {
- const className = this.getClassName(prop, value);
- rules.push(createCssRule(className, prop, value));
- });
- }
- return rules;
- },
- []
- )
+ .reduce((rules, prop) => {
+ if (prop !== 'pointerEvents') {
+ Object.keys(cache[prop]).forEach(value => {
+ const className = this.getClassName(prop, value);
+ rules.push(createCssRule(className, prop, value));
+ });
+ }
+ return rules;
+ }, [])
.join('\n');
const staticSheet = ``;
diff --git a/src/apis/StyleSheet/StyleRegistry.js b/src/apis/StyleSheet/StyleRegistry.js
index ef91d376..c12fb11b 100644
--- a/src/apis/StyleSheet/StyleRegistry.js
+++ b/src/apis/StyleSheet/StyleRegistry.js
@@ -120,22 +120,25 @@ class StyleRegistry {
_resolveStyle(reactNativeStyle) {
const domStyle = createReactDOMStyle(flattenStyle(reactNativeStyle));
- const props = Object.keys(domStyle).reduce((props, styleProp) => {
- const value = domStyle[styleProp];
- if (value != null) {
- const className = this.styleManager.getClassName(styleProp, value);
- if (className) {
- props.classList.push(className);
- } else {
- if (!props.style) {
- props.style = {};
+ const props = Object.keys(domStyle).reduce(
+ (props, styleProp) => {
+ const value = domStyle[styleProp];
+ if (value != null) {
+ const className = this.styleManager.getClassName(styleProp, value);
+ if (className) {
+ props.classList.push(className);
+ } else {
+ if (!props.style) {
+ props.style = {};
+ }
+ // 4x slower render
+ props.style[styleProp] = value;
}
- // 4x slower render
- props.style[styleProp] = value;
}
- }
- return props;
- }, { classList: [] });
+ return props;
+ },
+ { classList: [] }
+ );
props.className = classListToString(props.classList);
if (props.style) {
diff --git a/src/apis/StyleSheet/StyleSheetValidation.js b/src/apis/StyleSheet/StyleSheetValidation.js
index e4c02380..567fb5b8 100644
--- a/src/apis/StyleSheet/StyleSheetValidation.js
+++ b/src/apis/StyleSheet/StyleSheetValidation.js
@@ -21,7 +21,8 @@ class StyleSheetValidation {
if (process.env.NODE_ENV !== 'production') {
if (allStylePropTypes[prop] === undefined) {
var message1 = '"' + prop + '" is not a valid style property.';
- var message2 = '\nValid style props: ' +
+ var message2 =
+ '\nValid style props: ' +
JSON.stringify(Object.keys(allStylePropTypes).sort(), null, ' ');
styleError(message1, style, caller, message2);
} else {
diff --git a/src/apis/StyleSheet/__tests__/index-test.js b/src/apis/StyleSheet/__tests__/index-test.js
index c9f3a7af..b1ed53b6 100644
--- a/src/apis/StyleSheet/__tests__/index-test.js
+++ b/src/apis/StyleSheet/__tests__/index-test.js
@@ -6,8 +6,10 @@ const isPlainObject = x => {
const toString = Object.prototype.toString;
let proto;
/* eslint-disable */
- return toString.call(x) === '[object Object]' &&
- (proto = Object.getPrototypeOf(x), proto === null || proto === Object.getPrototypeOf({}));
+ return (
+ toString.call(x) === '[object Object]' &&
+ ((proto = Object.getPrototypeOf(x)), proto === null || proto === Object.getPrototypeOf({}))
+ );
/* eslint-enable */
};
diff --git a/src/apis/StyleSheet/expandStyle.js b/src/apis/StyleSheet/expandStyle.js
index 5d5250d4..3f6f34fd 100644
--- a/src/apis/StyleSheet/expandStyle.js
+++ b/src/apis/StyleSheet/expandStyle.js
@@ -47,15 +47,16 @@ const colorProps = {
color: true
};
-const alphaSortProps = propsArray => propsArray.sort((a, b) => {
- if (a < b) {
- return -1;
- }
- if (a > b) {
- return 1;
- }
- return 0;
-});
+const alphaSortProps = propsArray =>
+ propsArray.sort((a, b) => {
+ if (a < b) {
+ return -1;
+ }
+ if (a > b) {
+ return 1;
+ }
+ return 0;
+ });
const createReducer = (style, styleProps) => {
let hasResolvedBoxShadow = false;
diff --git a/src/apis/StyleSheet/hash.js b/src/apis/StyleSheet/hash.js
index 39f46b22..700a48d0 100644
--- a/src/apis/StyleSheet/hash.js
+++ b/src/apis/StyleSheet/hash.js
@@ -16,16 +16,17 @@ function murmurhash2_32_gc(str, seed) {
var l = str.length, h = seed ^ l, i = 0, k;
while (l >= 4) {
- k = str.charCodeAt(i) & 0xff |
- (str.charCodeAt((++i)) & 0xff) << 8 |
- (str.charCodeAt((++i)) & 0xff) << 16 |
- (str.charCodeAt((++i)) & 0xff) << 24;
+ k =
+ (str.charCodeAt(i) & 0xff) |
+ ((str.charCodeAt(++i) & 0xff) << 8) |
+ ((str.charCodeAt(++i) & 0xff) << 16) |
+ ((str.charCodeAt(++i) & 0xff) << 24);
- k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
+ k = (k & 0xffff) * 0x5bd1e995 + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16);
k ^= k >>> 24;
- k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
+ k = (k & 0xffff) * 0x5bd1e995 + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16);
- h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
+ h = ((h & 0xffff) * 0x5bd1e995 + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;
l -= 4;
++i;
@@ -38,11 +39,11 @@ function murmurhash2_32_gc(str, seed) {
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
case 1:
h ^= str.charCodeAt(i) & 0xff;
- h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
+ h = (h & 0xffff) * 0x5bd1e995 + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16);
}
h ^= h >>> 13;
- h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
+ h = (h & 0xffff) * 0x5bd1e995 + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16);
h ^= h >>> 15;
return h >>> 0;
diff --git a/src/apis/StyleSheet/staticCss.js b/src/apis/StyleSheet/staticCss.js
index add909bf..69ceb59a 100644
--- a/src/apis/StyleSheet/staticCss.js
+++ b/src/apis/StyleSheet/staticCss.js
@@ -1,4 +1,5 @@
-module.exports = 'html{' + // css reset
+module.exports =
+ 'html{' + // css reset
'font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;' +
'-webkit-tap-highlight-color:rgba(0,0,0,0);' +
'}\n' +
diff --git a/src/components/ActivityIndicator/index.js b/src/components/ActivityIndicator/index.js
index fc236eb9..17ff01e5 100644
--- a/src/components/ActivityIndicator/index.js
+++ b/src/components/ActivityIndicator/index.js
@@ -24,14 +24,7 @@ class ActivityIndicator extends Component {
};
render() {
- const {
- animating,
- color,
- hidesWhenStopped,
- size,
- style,
- ...other
- } = this.props;
+ const { animating, color, hidesWhenStopped, size, style, ...other } = this.props;
const svg = (