From 252a9bbc57cd415ff5cb18b25d458054ef456379 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 6 Sep 2017 16:03:16 -0700 Subject: [PATCH] Linted example project --- example/src/App.js | 10 +++---- example/src/components/FlyTo.js | 1 - example/src/components/SetPitch.js | 1 - .../src/components/SetUserTrackingModes.js | 1 - example/src/components/ShowClick.js | 25 +----------------- example/src/components/ShowMap.js | 1 - example/src/components/ShowRegionDidChange.js | 26 +------------------ example/src/components/common/Bubble.js | 4 +-- example/src/components/common/MapHeader.js | 4 +-- example/src/components/common/Page.js | 2 +- example/src/components/common/TabBarPage.js | 3 +-- example/src/styles/colors.js | 6 ++--- example/src/utils/config.js | 2 +- example/src/utils/index.js | 2 +- javascript/components/MapView.js | 2 +- javascript/utils/index.js | 2 +- 16 files changed, 19 insertions(+), 73 deletions(-) diff --git a/example/src/App.js b/example/src/App.js index 1c11fd6..55ceeb1 100644 --- a/example/src/App.js +++ b/example/src/App.js @@ -7,9 +7,7 @@ import { FlatList, StyleSheet, Modal, - Platform, TouchableOpacity, - NativeModules } from 'react-native'; import { Icon } from 'react-native-elements'; @@ -43,7 +41,7 @@ const styles = StyleSheet.create({ }, exampleList: { flex: 1, - marginTop: 60 + 12 // header + list padding, + marginTop: 60 + 12, // header + list padding, }, exampleListItemBorder: { borderBottomWidth: StyleSheet.hairlineWidth, @@ -62,7 +60,7 @@ const styles = StyleSheet.create({ flex: 1, backgroundColor: colors.primary.pinkFaint, }, -}) +}); class ExampleItem { constructor (label, Component) { @@ -127,7 +125,7 @@ class App extends React.Component { - ) + ); } renderActiveExample () { @@ -137,7 +135,7 @@ class App extends React.Component { visible: !!item, transparent: true, animationType: 'slide', - onRequestClose: this.onCloseExample + onRequestClose: this.onCloseExample, }; return ( diff --git a/example/src/components/FlyTo.js b/example/src/components/FlyTo.js index e483370..25495df 100644 --- a/example/src/components/FlyTo.js +++ b/example/src/components/FlyTo.js @@ -6,7 +6,6 @@ import BaseExamplePropTypes from './common/BaseExamplePropTypes'; import TabBarPage from './common/TabBarPage'; import sheet from '../styles/sheet'; -import colors from '../styles/colors'; class FlyTo extends React.Component { static SF_OFFICE_LOCATION = [-122.400021, 37.789085]; diff --git a/example/src/components/SetPitch.js b/example/src/components/SetPitch.js index c59aace..ca27d28 100644 --- a/example/src/components/SetPitch.js +++ b/example/src/components/SetPitch.js @@ -5,7 +5,6 @@ import BaseExamplePropTypes from './common/BaseExamplePropTypes'; import TabBarPage from './common/TabBarPage'; import sheet from '../styles/sheet'; -import colors from '../styles/colors'; class SetPitch extends React.Component { static propTypes = { diff --git a/example/src/components/SetUserTrackingModes.js b/example/src/components/SetUserTrackingModes.js index 9bcebb2..e8b20de 100644 --- a/example/src/components/SetUserTrackingModes.js +++ b/example/src/components/SetUserTrackingModes.js @@ -5,7 +5,6 @@ import BaseExamplePropTypes from './common/BaseExamplePropTypes'; import TabBarPage from './common/TabBarPage'; import sheet from '../styles/sheet'; -import colors from '../styles/colors'; import { onSortOptions } from '../utils'; class SetUserTrackingModes extends React.Component { diff --git a/example/src/components/ShowClick.js b/example/src/components/ShowClick.js index 1f90fb5..1bbf083 100644 --- a/example/src/components/ShowClick.js +++ b/example/src/components/ShowClick.js @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet, Text } from 'react-native'; +import { Text } from 'react-native'; import MapboxGL from 'react-native-mapbox-gl'; import BaseExamplePropTypes from './common/BaseExamplePropTypes'; @@ -7,30 +7,9 @@ import Page from './common/Page'; import Bubble from './common/Bubble'; import sheet from '../styles/sheet'; -import colors from '../styles/colors'; import { DEFAULT_CENTER_COORDINATE } from '../utils'; -const styles = StyleSheet.create({ - containter: { - flex: 1, - alignItems: 'center', - justifyContent: 'center', - }, - lastClickBanner: { - borderRadius: 30, - position: 'absolute', - bottom: 16, - left: 48, - right: 48, - paddingVertical: 16, - minHeight: 60, - alignItems: 'center', - justifyContent: 'center', - backgroundColor: 'white', - }, -}); - class ShowClick extends React.Component { static propTypes = { ...BaseExamplePropTypes, @@ -65,8 +44,6 @@ class ShowClick extends React.Component { } renderLastClicked () { - let childView; - if (!this.hasValidLastClick) { return ( diff --git a/example/src/components/ShowMap.js b/example/src/components/ShowMap.js index f58cad8..0fc3e90 100644 --- a/example/src/components/ShowMap.js +++ b/example/src/components/ShowMap.js @@ -5,7 +5,6 @@ import BaseExamplePropTypes from './common/BaseExamplePropTypes'; import TabBarPage from './common/TabBarPage'; import sheet from '../styles/sheet'; -import colors from '../styles/colors'; import { onSortOptions } from '../utils'; class ShowMap extends React.Component { diff --git a/example/src/components/ShowRegionDidChange.js b/example/src/components/ShowRegionDidChange.js index 43038da..f279c33 100644 --- a/example/src/components/ShowRegionDidChange.js +++ b/example/src/components/ShowRegionDidChange.js @@ -1,5 +1,5 @@ import React from 'react'; -import { View, StyleSheet, Text } from 'react-native'; +import { Text } from 'react-native'; import MapboxGL from 'react-native-mapbox-gl'; import BaseExamplePropTypes from './common/BaseExamplePropTypes'; @@ -7,30 +7,8 @@ import Page from './common/Page'; import Bubble from './common/Bubble'; import sheet from '../styles/sheet'; -import colors from '../styles/colors'; - import { DEFAULT_CENTER_COORDINATE } from '../utils'; -const styles = StyleSheet.create({ - containter: { - flex: 1, - alignItems: 'center', - justifyContent: 'center', - }, - lastClickBanner: { - borderRadius: 30, - position: 'absolute', - bottom: 16, - left: 48, - right: 48, - paddingVertical: 16, - minHeight: 60, - alignItems: 'center', - justifyContent: 'center', - backgroundColor: 'white', - }, -}); - class ShowRegionDidChange extends React.Component { static propTypes = { ...BaseExamplePropTypes, @@ -58,8 +36,6 @@ class ShowRegionDidChange extends React.Component { } renderRegionChange () { - let childView; - if (!this.state.regionFeature || !this.isValidCoordinate(this.state.regionFeature.geometry)) { return ( diff --git a/example/src/components/common/Bubble.js b/example/src/components/common/Bubble.js index fbe9c23..5200b08 100644 --- a/example/src/components/common/Bubble.js +++ b/example/src/components/common/Bubble.js @@ -13,7 +13,7 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'center', backgroundColor: 'white', - } + }, }); class Bubble extends React.PureComponent { @@ -22,7 +22,7 @@ class Bubble extends React.PureComponent { {this.props.children} - ) + ); } } diff --git a/example/src/components/common/MapHeader.js b/example/src/components/common/MapHeader.js index 67761fc..83535b1 100644 --- a/example/src/components/common/MapHeader.js +++ b/example/src/components/common/MapHeader.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, Text, TouchableOpacity, StyleSheet } from 'react-native'; +import { Text, StyleSheet } from 'react-native'; import { Icon, Header } from 'react-native-elements'; import colors from '../../styles/colors'; @@ -60,7 +60,7 @@ class MapHeader extends React.PureComponent { render () { const statusBarProps = { barStyle: this.props.statusBarTextTheme, - backgroundColor: this.props.statusBarColor + backgroundColor: this.props.statusBarColor, }; return ( diff --git a/example/src/components/common/Page.js b/example/src/components/common/Page.js index 56dd086..c2e4113 100644 --- a/example/src/components/common/Page.js +++ b/example/src/components/common/Page.js @@ -24,7 +24,7 @@ class Page extends React.Component { label={this.props.label} onBack={this.props.onDismissExample} /> - ) + ); } } diff --git a/example/src/components/common/TabBarPage.js b/example/src/components/common/TabBarPage.js index 5fb0f98..c2d1e71 100644 --- a/example/src/components/common/TabBarPage.js +++ b/example/src/components/common/TabBarPage.js @@ -1,13 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, StyleSheet, ScrollView, Text } from 'react-native'; +import { StyleSheet, ScrollView } from 'react-native'; import { ButtonGroup } from 'react-native-elements'; import BaseExamplePropTypes from './BaseExamplePropTypes'; import Page from './Page'; -import sheet from '../../styles/sheet'; import colors from '../../styles/colors'; const TAB_BAR_HEIGHT = 70; diff --git a/example/src/styles/colors.js b/example/src/styles/colors.js index b555584..07aa4f2 100644 --- a/example/src/styles/colors.js +++ b/example/src/styles/colors.js @@ -11,7 +11,7 @@ const colors = { pinkDark: '#b43b71', pink: '#ee4e8b', pinkLight: '#f8c8da', - pinkFaint: '#fbe5ee' + pinkFaint: '#fbe5ee', }, secondary: { @@ -42,7 +42,7 @@ const colors = { white: '#ffffff', black: '#000000', - } -} + }, +}; export default colors; diff --git a/example/src/utils/config.js b/example/src/utils/config.js index 337ae1a..9e180f7 100644 --- a/example/src/utils/config.js +++ b/example/src/utils/config.js @@ -1,7 +1,7 @@ import env from './../../env.json'; class Config { - get(key) { + get (key) { return env[key]; } } diff --git a/example/src/utils/index.js b/example/src/utils/index.js index 94c575c..68cf59d 100644 --- a/example/src/utils/index.js +++ b/example/src/utils/index.js @@ -3,7 +3,7 @@ import { Platform } from 'react-native'; export const IS_ANDROID = Platform.OS === 'android'; export const DEFAULT_CENTER_COORDINATE = [-77.036086, 38.910233]; -export function onSortOptions(a, b) { +export function onSortOptions (a, b) { if (a.label < b.label) { return -1; } diff --git a/javascript/components/MapView.js b/javascript/components/MapView.js index 4d02826..04edfb6 100644 --- a/javascript/components/MapView.js +++ b/javascript/components/MapView.js @@ -7,7 +7,7 @@ import { isFunction, isNumber, runNativeCommand, - toJSONString + toJSONString, } from '../utils'; const MapboxGL = NativeModules.MGLModule; diff --git a/javascript/utils/index.js b/javascript/utils/index.js index 1dd30ff..3c26ef1 100644 --- a/javascript/utils/index.js +++ b/javascript/utils/index.js @@ -32,6 +32,6 @@ export function runNativeCommand (module, name, nativeRef, args = []) { ); } -export function toJSONString(json = '') { +export function toJSONString (json = '') { return JSON.stringify(json); }