Update formatter and linter

This commit is contained in:
Nicolas Gallagher
2017-06-09 12:59:39 -07:00
parent 1f25ef82ae
commit fc86c876e0
33 changed files with 178 additions and 211 deletions
@@ -14,7 +14,8 @@ class I18nManagerExample extends Component {
LTR/RTL layout example!
</Text>
<Text style={styles.text}>
The writing direction of text is automatically determined by the browser, independent of the global writing direction of the app.
The writing direction of text is automatically determined by the browser, independent of
the global writing direction of the app.
</Text>
<Text style={[styles.text, styles.rtlText]}>
أحب اللغة العربية
@@ -1,4 +1,4 @@
/* eslint-disable react/jsx-no-bind */
/* eslint-disable react/jsx-no-bind, react/prefer-es6-class */
import createReactClass from 'create-react-class';
import React from 'react';
@@ -1,3 +1,5 @@
/* eslint-disable react/prefer-es6-class, react/prop-types */
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
@@ -7,9 +7,10 @@ const onButtonPress = action('Button has been pressed!');
const examples = [
{
title: 'Simple Button',
description: 'The title and onPress handler are required. It is ' +
'recommended to set accessibilityLabel to help make your app usable by ' +
'everyone.',
description:
'The title and onPress handler are required. It is ' +
'recommended to set accessibilityLabel to help make your app usable by ' +
'everyone.',
render: function() {
return (
<Button
@@ -22,9 +23,10 @@ const examples = [
},
{
title: 'Adjusted color',
description: 'Adjusts the color in a way that looks standard on each ' +
'platform. On iOS, the color prop controls the color of the text. On ' +
'Android, the color adjusts the background color of the button.',
description:
'Adjusts the color in a way that looks standard on each ' +
'platform. On iOS, the color prop controls the color of the text. On ' +
'Android, the color adjusts the background color of the button.',
render: function() {
return (
<Button
@@ -1,4 +1,4 @@
/* eslint-disable react/jsx-no-bind */
/* eslint-disable react/jsx-no-bind, react/prefer-es6-class, react/prop-types */
/**
* Copyright (c) 2013-present, Facebook, Inc.
@@ -227,8 +227,9 @@ var MultipleSourcesExample = createReactClass({
const examples = [
{
title: 'Plain Network Image',
description: 'If the `source` prop `uri` property is prefixed with ' +
'"http", then it will be downloaded from the network.',
description:
'If the `source` prop `uri` property is prefixed with ' +
'"http", then it will be downloaded from the network.',
render: function() {
return (
<Image
@@ -244,8 +245,9 @@ const examples = [
},
{
title: 'Plain Static Image',
description: 'Static assets should be placed in the source code tree, and ' +
'required in the same way as JavaScript modules.',
description:
'Static assets should be placed in the source code tree, and ' +
'required in the same way as JavaScript modules.',
render: function() {
return (
<View style={styles.horizontal}>
@@ -447,8 +449,7 @@ const examples = [
*/
{
title: 'Resize Mode',
description: 'The `resizeMode` style prop controls how the image is ' +
'rendered within the frame.',
description: 'The `resizeMode` style prop controls how the image is rendered within the frame.',
render: function() {
return (
<View>
@@ -514,7 +515,8 @@ const examples = [
return (
<Image
source={{
uri: 'http://38.media.tumblr.com/9e9bd08c6e2d10561dd1fb4197df4c4e/tumblr_mfqekpMktw1rn90umo1_500.gif'
uri:
'http://38.media.tumblr.com/9e9bd08c6e2d10561dd1fb4197df4c4e/tumblr_mfqekpMktw1rn90umo1_500.gif'
}}
style={styles.gif}
/>
@@ -6,7 +6,7 @@ const generateData = length => Array.from({ length }).map((item, i) => i);
const dataSource = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
storiesOf('component: ListView', module)
.add('vertical', () => (
.add('vertical', () =>
<View style={styles.scrollViewContainer}>
<ListView
contentContainerStyle={styles.scrollViewContentContainerStyle}
@@ -22,8 +22,8 @@ storiesOf('component: ListView', module)
style={styles.scrollViewStyle}
/>
</View>
))
.add('incremental rendering - large pageSize', () => (
)
.add('incremental rendering - large pageSize', () =>
<View style={styles.scrollViewContainer}>
<ListView
contentContainerStyle={styles.scrollViewContentContainerStyle}
@@ -40,8 +40,8 @@ storiesOf('component: ListView', module)
style={styles.scrollViewStyle}
/>
</View>
))
.add('incremental rendering - small pageSize', () => (
)
.add('incremental rendering - small pageSize', () =>
<View style={styles.scrollViewContainer}>
<ListView
contentContainerStyle={styles.scrollViewContentContainerStyle}
@@ -58,7 +58,7 @@ storiesOf('component: ListView', module)
style={styles.scrollViewStyle}
/>
</View>
));
);
const styles = StyleSheet.create({
box: {
@@ -1,8 +1,4 @@
import createReactClass from 'create-react-class';
import { ProgressBar, StyleSheet, View } from 'react-native';
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import TimerMixin from 'react-timer-mixin';
/* eslint-disable react/prefer-es6-class */
/**
* Copyright (c) 2013-present, Facebook, Inc.
@@ -27,6 +23,12 @@ import TimerMixin from 'react-timer-mixin';
* @flow
*/
import createReactClass from 'create-react-class';
import { ProgressBar, StyleSheet, View } from 'react-native';
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import TimerMixin from 'react-timer-mixin';
const ProgressBarExample = createReactClass({
mixins: [TimerMixin],
@@ -7,7 +7,7 @@ import { ScrollView, StyleSheet, Text, TouchableHighlight, View } from 'react-na
const onScroll = action('ScrollView.onScroll');
storiesOf('component: ScrollView', module)
.add('vertical', () => (
.add('vertical', () =>
<View style={styles.scrollViewContainer}>
<ScrollView
contentContainerStyle={styles.scrollViewContentContainerStyle}
@@ -15,15 +15,15 @@ storiesOf('component: ScrollView', module)
scrollEventThrottle={1000} // 1 event per second
style={styles.scrollViewStyle}
>
{Array.from({ length: 50 }).map((item, i) => (
{Array.from({ length: 50 }).map((item, i) =>
<View key={i} style={styles.box}>
<TouchableHighlight onPress={() => {}}><Text>{i}</Text></TouchableHighlight>
</View>
))}
)}
</ScrollView>
</View>
))
.add('horizontal', () => (
)
.add('horizontal', () =>
<View style={styles.scrollViewContainer}>
<ScrollView
contentContainerStyle={styles.scrollViewContentContainerStyle}
@@ -32,14 +32,14 @@ storiesOf('component: ScrollView', module)
scrollEventThrottle={16} // ~60 events per second
style={styles.scrollViewStyle}
>
{Array.from({ length: 50 }).map((item, i) => (
{Array.from({ length: 50 }).map((item, i) =>
<View key={i} style={[styles.box, styles.horizontalBox]}>
<Text>{i}</Text>
</View>
))}
)}
</ScrollView>
</View>
));
);
const styles = StyleSheet.create({
box: {
@@ -1,4 +1,4 @@
/* eslint-disable react/jsx-no-bind */
/* eslint-disable react/jsx-no-bind, react/prefer-es6-class */
/**
* Copyright (c) 2013-present, Facebook, Inc.
+10 -7
View File
@@ -1,4 +1,4 @@
/* eslint-disable react/jsx-no-bind */
/* eslint-disable react/jsx-no-bind, react/prefer-es6-class, react/prop-types */
/**
* Copyright (c) 2013-present, Facebook, Inc.
@@ -268,9 +268,10 @@ const examples = [
},
{
title: 'Nested',
description: 'Nested text components will inherit the styles of their ' +
'parents (only backgroundColor is inherited from non-Text parents). ' +
'<Text> only supports other <Text> and raw text (strings) as children.',
description:
'Nested text components will inherit the styles of their ' +
'parents (only backgroundColor is inherited from non-Text parents). ' +
'<Text> only supports other <Text> and raw text (strings) as children.',
render: function() {
return (
<View>
@@ -362,7 +363,7 @@ const examples = [
render: function() {
return (
<Text>
A {'generated'} {' '} {'string'} and some &nbsp;&nbsp;&nbsp; spaces
A {'generated'} {' '} {'string'} and some &nbsp;&nbsp;&nbsp; spaces
</Text>
);
}
@@ -453,7 +454,8 @@ const examples = [
style={{ backgroundColor: 'white', textDecorationLine: 'underline', color: 'blue' }}
suppressHighlighting={false}
>
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud
</Text>
{' '}
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
@@ -469,7 +471,8 @@ const examples = [
<View>
<Text>
By default, text will respect Text Size accessibility setting on iOS.
It means that all font sizes will be increased or descreased depending on the value of Text Size setting in
It means that all font sizes will be increased or descreased depending on the value of
Text Size setting in
{' '}
<Text style={{ fontWeight: 'bold' }}>
Settings.app - Display & Brightness - Text Size
@@ -107,7 +107,8 @@ class AutoExpandingTextInput extends React.Component {
constructor(props) {
super(props);
this.state = {
text: 'React Native enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and React. The focus of React Native is on developer efficiency across all the platforms you care about — learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native.',
text:
'React Native enables you to build world-class application experiences on native platforms using a consistent developer experience based on JavaScript and React. The focus of React Native is on developer efficiency across all the platforms you care about — learn once, write anywhere. Facebook uses React Native in multiple production apps and will continue investing in React Native.',
height: 0
};
}
@@ -39,11 +39,12 @@ import {
const examples = [
{
title: '<TouchableHighlight>',
description: 'TouchableHighlight works by adding an extra view with a ' +
'black background under the single child view. This works best when the ' +
'child view is fully opaque, although it can be made to work as a simple ' +
'background color change as well with the activeOpacity and ' +
'underlayColor props.',
description:
'TouchableHighlight works by adding an extra view with a ' +
'black background under the single child view. This works best when the ' +
'child view is fully opaque, although it can be made to work as a simple ' +
'background color change as well with the activeOpacity and ' +
'underlayColor props.',
render: function() {
return (
<View>
@@ -79,17 +80,19 @@ const examples = [
},
{
title: 'Touchable feedback events',
description: '<Touchable*> components accept onPress, onPressIn, ' +
'onPressOut, and onLongPress as props.',
description:
'<Touchable*> components accept onPress, onPressIn, ' +
'onPressOut, and onLongPress as props.',
render: function() {
return <TouchableFeedbackEvents />;
}
},
{
title: 'Touchable delay for events',
description: '<Touchable*> components also accept delayPressIn, ' +
'delayPressOut, and delayLongPress as props. These props impact the ' +
'timing of feedback events.',
description:
'<Touchable*> components also accept delayPressIn, ' +
'delayPressOut, and delayLongPress as props. These props impact the ' +
'timing of feedback events.',
render: function() {
return <TouchableDelayEvents />;
}
@@ -104,16 +107,18 @@ const examples = [
},
{
title: 'Touchable Hit Slop',
description: '<Touchable*> components accept hitSlop prop which extends the touch area ' +
'without changing the view bounds.',
description:
'<Touchable*> components accept hitSlop prop which extends the touch area ' +
'without changing the view bounds.',
render: function() {
return <TouchableHitSlop />;
}
},
{
title: 'Disabled Touchable*',
description: '<Touchable*> components accept disabled prop which prevents ' +
'any interaction with component',
description:
'<Touchable*> components accept disabled prop which prevents ' +
'any interaction with component',
render: function() {
return <TouchableDisabled />;
}
@@ -1,7 +1,4 @@
import createReactClass from 'create-react-class';
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import { StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native';
/* eslint-disable react/prefer-es6-class */
/**
* Copyright (c) 2013-present, Facebook, Inc.
@@ -26,6 +23,11 @@ import { StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native';
* @flow
*/
import createReactClass from 'create-react-class';
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import { StyleSheet, Text, TouchableWithoutFeedback, View } from 'react-native';
const styles = StyleSheet.create({
box: {
backgroundColor: '#527FE4',
@@ -1,7 +1,4 @@
import createReactClass from 'create-react-class';
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import { Animated, StyleSheet, Text, View } from 'react-native';
/* eslint-disable react/prefer-es6-class */
/**
* Copyright (c) 2013-present, Facebook, Inc.
@@ -25,6 +22,11 @@ import { Animated, StyleSheet, Text, View } from 'react-native';
* @flow
*/
import createReactClass from 'create-react-class';
import React from 'react';
import { storiesOf } from '@kadira/storybook';
import { Animated, StyleSheet, Text, View } from 'react-native';
const Flip = createReactClass({
getInitialState() {
return {
+5 -5
View File
@@ -1,4 +1,4 @@
/* eslint-disable react/jsx-no-bind */
/* eslint-disable react/jsx-no-bind, react/prefer-es6-class, react/prop-types */
/**
* The examples provided by Facebook are for non-commercial testing and
@@ -211,17 +211,17 @@ const TicTacToeApp = createReactClass({
},
render() {
const rows = this.state.board.grid.map((cells, row) => (
const rows = this.state.board.grid.map((cells, row) =>
<View key={'row' + row} style={styles.row}>
{cells.map((player, col) => (
{cells.map((player, col) =>
<Cell
key={'cell' + col}
onPress={this.handleCellPress.bind(this, row, col)}
player={player}
/>
))}
)}
</View>
));
);
return (
<View style={styles.container}>