Fix 16 linter warnings in Examples/

Summary: Partially fixes #3316 by addressing 16 linter warnings:
 - Strings should be singlequote
 - Missing semicolon

Travis build jobs 1.1 through 1.4 complete successfully. 1.5 fails through what appears to be an unrelated issue on master.
Closes https://github.com/facebook/react-native/pull/3332

Reviewed By: @​svcscm

Differential Revision: D2531718

Pulled By: @javache

fb-gh-sync-id: ca22fbeac5fe3b4f725775a72f21b6dd7a75d94b
This commit is contained in:
Bill Glover
2015-10-16 04:02:18 -07:00
committed by facebook-github-bot-4
parent 79e33078f2
commit 8fb9cc8fc1
14 changed files with 18 additions and 24 deletions

View File

@@ -23,7 +23,6 @@ var {
ProgressBarAndroid, ProgressBarAndroid,
StyleSheet, StyleSheet,
Text, Text,
TextInput,
View, View,
} = React; } = React;
var TimerMixin = require('react-timer-mixin'); var TimerMixin = require('react-timer-mixin');
@@ -271,7 +270,7 @@ var SearchScreen = React.createClass({
style = [style, styles.rowSeparatorHide]; style = [style, styles.rowSeparatorHide];
} }
return ( return (
<View key={"SEP_" + sectionID + "_" + rowID} style={style}/> <View key={'SEP_' + sectionID + '_' + rowID} style={style}/>
); );
}, },

View File

@@ -44,7 +44,7 @@ var AccessibilityIOSExample = React.createClass({
Accessibility label example Accessibility label example
</Text> </Text>
</View> </View>
<View accessibilityTraits={["button", "selected"]} <View accessibilityTraits={['button', 'selected']}
accessible={true}> accessible={true}>
<Text> <Text>
Accessibility traits example Accessibility traits example

View File

@@ -99,7 +99,7 @@ var ShareActionSheetExample = React.createClass({
} else { } else {
text = 'You didn\'t share'; text = 'You didn\'t share';
} }
this.setState({text}) this.setState({text});
}); });
} }
}); });

View File

@@ -40,7 +40,7 @@ var AppStateSubscription = React.createClass({
AppStateIOS.removeEventListener('memoryWarning', this._handleMemoryWarning); AppStateIOS.removeEventListener('memoryWarning', this._handleMemoryWarning);
}, },
_handleMemoryWarning: function() { _handleMemoryWarning: function() {
this.setState({memoryWarnings: this.state.memoryWarnings + 1}) this.setState({memoryWarnings: this.state.memoryWarnings + 1});
}, },
_handleAppStateChange: function(appState) { _handleAppStateChange: function(appState) {
var previousAppStates = this.state.previousAppStates.slice(); var previousAppStates = this.state.previousAppStates.slice();
@@ -92,7 +92,7 @@ exports.examples = [
}, },
{ {
title: 'Memory Warnings', title: 'Memory Warnings',
description: "In the simulator, hit Shift+Command+M to simulate a memory warning.", description: 'In the simulator, hit Shift+Command+M to simulate a memory warning.',
render(): ReactElement { return <AppStateSubscription showMemoryWarnings={true} />; } render(): ReactElement { return <AppStateSubscription showMemoryWarnings={true} />; }
}, },
]; ];

View File

@@ -21,8 +21,7 @@ var {
ScrollView, ScrollView,
Text, Text,
TouchableHighlight, TouchableHighlight,
TouchableOpacity, TouchableOpacity
View,
} = React; } = React;
var _getRandomRoute = function() { var _getRandomRoute = function() {
@@ -82,19 +81,19 @@ var BreadcrumbNavSample = React.createClass({
return ( return (
<ScrollView style={styles.scene}> <ScrollView style={styles.scene}>
<NavButton <NavButton
onPress={() => { navigator.push(_getRandomRoute()) }} onPress={() => { navigator.push(_getRandomRoute()); }}
text="Push" text="Push"
/> />
<NavButton <NavButton
onPress={() => { navigator.immediatelyResetRouteStack([_getRandomRoute(), _getRandomRoute()]) }} onPress={() => { navigator.immediatelyResetRouteStack([_getRandomRoute(), _getRandomRoute()]); }}
text="Reset w/ 2 scenes" text="Reset w/ 2 scenes"
/> />
<NavButton <NavButton
onPress={() => { navigator.popToTop() }} onPress={() => { navigator.popToTop(); }}
text="Pop to top" text="Pop to top"
/> />
<NavButton <NavButton
onPress={() => { navigator.replace(_getRandomRoute()) }} onPress={() => { navigator.replace(_getRandomRoute()); }}
text="Replace" text="Replace"
/> />
<NavButton <NavButton

View File

@@ -23,7 +23,6 @@ var {
Text, Text,
TouchableHighlight, TouchableHighlight,
TouchableOpacity, TouchableOpacity,
View,
} = React; } = React;
var cssVar = require('cssVar'); var cssVar = require('cssVar');

View File

@@ -134,7 +134,7 @@ var TabBarExample = React.createClass({
<Navigator <Navigator
ref={this._setNavigatorRef} ref={this._setNavigatorRef}
style={styles.container} style={styles.container}
initialRoute={{ message: "First Scene", }} initialRoute={{ message: 'First Scene', }}
renderScene={this.renderScene} renderScene={this.renderScene}
configureScene={(route) => { configureScene={(route) => {
if (route.sceneConfig) { if (route.sceneConfig) {

View File

@@ -56,7 +56,7 @@ var SwitchAndroidExample = React.createClass({
onValueChange={(value) => this.setState({eventSwitchIsOn: value})} onValueChange={(value) => this.setState({eventSwitchIsOn: value})}
style={{marginBottom: 10}} style={{marginBottom: 10}}
value={this.state.eventSwitchIsOn} /> value={this.state.eventSwitchIsOn} />
<Text>{this.state.eventSwitchIsOn ? "On" : "Off"}</Text> <Text>{this.state.eventSwitchIsOn ? 'On' : 'Off'}</Text>
</UIExplorerBlock> </UIExplorerBlock>
<UIExplorerBlock title="Switches are controlled components"> <UIExplorerBlock title="Switches are controlled components">
<SwitchAndroid /> <SwitchAndroid />

View File

@@ -107,7 +107,7 @@ var EventSwitchExample = React.createClass({
onValueChange={(value) => this.setState({eventSwitchIsOn: value})} onValueChange={(value) => this.setState({eventSwitchIsOn: value})}
style={{marginBottom: 10}} style={{marginBottom: 10}}
value={this.state.eventSwitchIsOn} /> value={this.state.eventSwitchIsOn} />
<Text>{this.state.eventSwitchIsOn ? "On" : "Off"}</Text> <Text>{this.state.eventSwitchIsOn ? 'On' : 'Off'}</Text>
</View> </View>
<View> <View>
<SwitchIOS <SwitchIOS
@@ -118,7 +118,7 @@ var EventSwitchExample = React.createClass({
onValueChange={(value) => this.setState({eventSwitchRegressionIsOn: value})} onValueChange={(value) => this.setState({eventSwitchRegressionIsOn: value})}
style={{marginBottom: 10}} style={{marginBottom: 10}}
value={this.state.eventSwitchRegressionIsOn} /> value={this.state.eventSwitchRegressionIsOn} />
<Text>{this.state.eventSwitchRegressionIsOn ? "On" : "Off"}</Text> <Text>{this.state.eventSwitchRegressionIsOn ? 'On' : 'Off'}</Text>
</View> </View>
</View> </View>
); );

View File

@@ -19,9 +19,7 @@ var React = require('react-native');
var { var {
AlertIOS, AlertIOS,
Platform, Platform,
Text,
ToastAndroid, ToastAndroid,
TouchableHighlight,
View, View,
} = React; } = React;
var TimerMixin = require('react-timer-mixin'); var TimerMixin = require('react-timer-mixin');

View File

@@ -114,7 +114,7 @@ function stackFrameToString(stackFrame, maxLength) {
var fileName = fileNameParts[fileNameParts.length - 1]; var fileName = fileNameParts[fileNameParts.length - 1];
if (fileName.length > 18) { if (fileName.length > 18) {
fileName = fileName.substr(0, 17) + '\u2026' /* ... */; fileName = fileName.substr(0, 17) + '\u2026'; /* ... */
} }
var spaces = fillSpaces(maxLength - stackFrame.methodName.length); var spaces = fillSpaces(maxLength - stackFrame.methodName.length);

View File

@@ -48,7 +48,7 @@ function fetchSourceMap(): Promise {
return Promise.resolve(url); return Promise.resolve(url);
}) })
.then(fetch) .then(fetch)
.then(response => response.text()) .then(response => response.text());
} }
function extractSourceMapURL({url, text, fullSourceMappingURL}): ?string { function extractSourceMapURL({url, text, fullSourceMappingURL}): ?string {

View File

@@ -135,12 +135,12 @@ var WarningRow = React.createClass({
}); });
this.panGesture = PanResponder.create({ this.panGesture = PanResponder.create({
onStartShouldSetPanResponder: () => { onStartShouldSetPanResponder: () => {
return !! this.dismissalSpring.getCurrentValue(); return !!this.dismissalSpring.getCurrentValue();
}, },
onMoveShouldSetPanResponder: () => true, onMoveShouldSetPanResponder: () => true,
onPanResponderGrant: () => { onPanResponderGrant: () => {
this.isResponderOnlyToBlockTouches = this.isResponderOnlyToBlockTouches =
!! this.dismissalSpring.getCurrentValue(); !!this.dismissalSpring.getCurrentValue();
}, },
onPanResponderMove: (e, gestureState) => { onPanResponderMove: (e, gestureState) => {
if (this.isResponderOnlyToBlockTouches) { if (this.isResponderOnlyToBlockTouches) {

View File

@@ -113,7 +113,6 @@ var Text = React.createClass({
isHighlighted: false, isHighlighted: false,
}); });
}, },
getDefaultProps: function(): Object { getDefaultProps: function(): Object {
return { return {
allowFontScaling: true, allowFontScaling: true,