Skip to content

Commit

Permalink
Fixed linting issues. Updated babel-eslint.
Browse files Browse the repository at this point in the history
  • Loading branch information
mflodin authored and patcito committed May 19, 2018
1 parent 5b1cce9 commit 87b0483
Show file tree
Hide file tree
Showing 33 changed files with 161 additions and 375 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
"rules": {
"no-console": "warn",
"react/prop-types": "off"
},
"globals": {
"fetch": false
}
}
3 changes: 1 addition & 2 deletions App.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from "react";
import { Asset, AppLoading, Font, Updates } from "expo";
import { AsyncStorage, Alert, Platform, View } from "react-native";
import { Platform } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { loadSavedTalksAsync } from "./src/utils/storage";
import { SafeAreaView } from "react-navigation";
import { ScheduleQuery } from "./src/data/schedulequery";

if (Platform.OS === "android") {
SafeAreaView.setStatusBarHeight(0);
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
},
"scripts": {
"test": "jest",
"devtools": "react-devtools"
"devtools": "react-devtools",
"lint": "eslint . --ext .js --quiet"
},
"dependencies": {
"crypto-js": "^3.1.9-1",
Expand All @@ -33,7 +34,7 @@
"urql": "^0.2.0"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"babel-eslint": "^8.1.1",
"babel-plugin-transform-remove-console": "^6.9.1",
"eslint": "^4.5.0",
"eslint-plugin-react": "^7.3.0",
Expand Down
41 changes: 4 additions & 37 deletions src/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,21 @@ import {
StackNavigator,
createNavigator,
createNavigationContainer,
SafeAreaView,
} from 'react-navigation';
import withCachedChildNavigation from 'react-navigation/src/withCachedChildNavigation';
import SceneView from 'react-navigation/src/views/SceneView';
import {
BackHandler,
Platform,
Image,
Text,
StyleSheet,
StatusBar,
View,
Button,
Alert,
AsyncStorage,
View
} from 'react-native';
import { Constants, BarCodeScanner, Permissions, Notifications } from 'expo';
import { Constants } from 'expo';
import { TabViewAnimated } from 'react-native-tab-view';
import {
DrawerLayoutAndroid,
BorderlessButton,
RectButton,
} from 'react-native-gesture-handler';
import DrawerLayout from 'react-native-gesture-handler/DrawerLayout';
Expand All @@ -37,11 +31,10 @@ import { Colors, FontSizes, Layout } from './constants';
import Screens from './screens';
import TabBarBottom from './components/TabBarBottom';
import CachedImage from './components/CachedImage';
import { SemiBoldText, BoldText } from './components/StyledText';
import { SemiBoldText } from './components/StyledText';
import _ from 'lodash';
import Schedule from './data/schedule.json';
import moment from 'moment';
import { Provider, Client, Connect, query } from 'urql';

import QRScannerModalNavigation from './screens/QRScreens/Identify';
import QRCheckinScannerModalNavigation from './screens/QRScreens/CheckIn';
Expand All @@ -51,7 +44,7 @@ const DrawerComponent =
Platform.OS === 'android' ? DrawerLayoutAndroid : DrawerLayout;
const FullSchedule = Schedule.events[0].groupedSchedule;
let navSchedule = {};
_.each(FullSchedule, (day, i) => {
_.each(FullSchedule, (day) => {
navSchedule[day.title] = {
screen: Screens.ScheduleDay({
day: day.title,
Expand Down Expand Up @@ -425,11 +418,6 @@ class DrawerButton extends React.Component {
state = {
me: null,
};
componentDidMount() {
AsyncStorage.getItem('@MySuperStore:tickets').then(value => {
const mytickets = value;
});
}
render() {
return (
<RectButton
Expand All @@ -454,27 +442,6 @@ class DrawerButton extends React.Component {
);
}
}
class ErrorBoundary extends React.Component {
constructor(props) {
super(props);
this.state = { hasError: false };
}

componentDidCatch(error, info) {
// Display fallback UI
this.setState({ hasError: true });
// You can also log the error to an error reporting service
console.log('ERROR', error, info);
}

render() {
if (this.state.hasError) {
// You can render any custom fallback UI
return null;
}
return this.props.children;
}
}

const styles = StyleSheet.create({
container: {
Expand Down
6 changes: 0 additions & 6 deletions src/components/CloseButton.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import React from 'react';
import {
I18nManager,
Image,
Text,
View,
Platform,
StyleSheet,
Expand All @@ -23,11 +20,8 @@ class CloseButton extends React.PureComponent {

render() {
const {
buttonImage,
onPress,
pressColorAndroid,
width,
tintColor,
} = this.props;

return (
Expand Down
9 changes: 2 additions & 7 deletions src/components/ContactCard.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import React from "react";
import { Image, Platform, StyleSheet, View, Linking } from "react-native";
import { Svg, FileSystem, WebBrowser } from "expo";
import { RectButton } from "react-native-gesture-handler";
import FadeIn from "react-native-fade-in-image";
import { Platform, StyleSheet, View, Linking } from "react-native";
import { WebBrowser } from "expo";
import { withNavigation } from "react-navigation";
import GravatarImage from '../components/GravatarImage';
import SaveIconWhenSaved from "./SaveIconWhenSaved";
import { BoldText, RegularText, SemiBoldText } from "./StyledText";
import { conferenceHasEnded, getSpeakerAvatarURL } from "../utils";
import { Colors, FontSizes } from "../constants";
import {
Button,
Expand Down
1 change: 0 additions & 1 deletion src/components/GravatarImage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import CachedImage from './CachedImage';
import { Image, View } from 'react-native'
import md5 from 'crypto-js/md5';

export default class GravatarImage extends React.PureComponent {
Expand Down
12 changes: 3 additions & 9 deletions src/components/MyContacts.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import React from "react";
import { Image, Platform, StyleSheet, View, AsyncStorage } from "react-native";
import moment from "moment-timezone";
import { View, AsyncStorage } from "react-native";

import { BoldText, RegularText, SemiBoldText } from "./StyledText";
import { SemiBoldText } from "./StyledText";
import ContactCard from "./ContactCard";
import { Colors, FontSizes } from "../constants";
import _ from "lodash";
import {
convertUtcDateToEventTimezoneDaytime,
conferenceHasEnded
} from "../utils";
import { FontSizes } from "../constants";

export default class MyContacts extends React.Component {
state = {
Expand Down
3 changes: 1 addition & 2 deletions src/components/SaveButton.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from "react";
import { Platform } from "react-native";
import { BorderlessButton } from "react-native-gesture-handler";
import { Ionicons } from "@expo/vector-icons";
import { Colors, Icons } from "../constants";
import { Icons } from "../constants";
import { toggleSaved, withSaveState } from "../utils/storage";

@withSaveState
Expand Down
10 changes: 2 additions & 8 deletions src/components/TabBarBottom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import {
StyleSheet,
View,
Platform,
Keyboard
} from "react-native";
import SafeAreaView from "react-native-safe-area-view";
import { BorderlessButton } from "react-native-gesture-handler";

import TabBarIcon from "react-navigation/src/views/TabView/TabBarIcon";
import withOrientation from "react-navigation/src/views/withOrientation";
Expand Down Expand Up @@ -40,7 +38,6 @@ class TabBarBottom extends React.PureComponent {
labelStyle,
showLabel,
showIcon,
isLandscape,
allowFontScaling
} = this.props;
if (showLabel === false) {
Expand Down Expand Up @@ -158,7 +155,7 @@ class TabBarBottom extends React.PureComponent {

_shouldUseHorizontalTabs() {
const { routes } = this.props.navigation.state;
const { isLandscape, layout, adaptive, tabStyle } = this.props;
const { isLandscape, layout, adaptive } = this.props;

if (!adaptive) {
return false;
Expand All @@ -183,13 +180,11 @@ class TabBarBottom extends React.PureComponent {
navigation,
jumpToIndex,
getOnPress,
getTestIDProps,
activeBackgroundColor,
inactiveBackgroundColor,
style,
animateStyle,
tabStyle,
isLandscape
tabStyle
} = this.props;
const { routes } = navigation.state;
const previousScene = routes[navigation.state.index];
Expand Down Expand Up @@ -225,7 +220,6 @@ class TabBarBottom extends React.PureComponent {
outputRange: outputRange
});

const justifyContent = this.props.showIcon ? "flex-end" : "center";
const extraProps = this._renderTestIDProps(scene) || {};
const { testID, accessibilityLabel } = extraProps;

Expand Down
4 changes: 2 additions & 2 deletions src/components/TalkCard.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from "react";
import { Image, Platform, StyleSheet, View } from "react-native";
import { Platform, StyleSheet, View } from "react-native";
import { RectButton } from "react-native-gesture-handler";
import FadeIn from "react-native-fade-in-image";
import { withNavigation } from "react-navigation";

import SaveIconWhenSaved from "./SaveIconWhenSaved";
import CachedImage from './CachedImage';
import { BoldText, RegularText, SemiBoldText } from "./StyledText";
import { conferenceHasEnded, getSpeakerAvatarURL } from "../utils";
import { conferenceHasEnded } from "../utils";
import { Colors, FontSizes } from "../constants";

@withNavigation
Expand Down
7 changes: 3 additions & 4 deletions src/components/TalksUpNext.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from "react";
import { Image, Platform, StyleSheet, View } from "react-native";
import moment from "moment-timezone";
import { StyleSheet, View } from "react-native";

import { BoldText, RegularText, SemiBoldText } from "./StyledText";
import { RegularText, SemiBoldText } from "./StyledText";
import TalkCard from "./TalkCard";
import { Colors, FontSizes } from "../constants";
import { findRandomTalk, findNextTalksAfterDate } from "../data";
Expand Down Expand Up @@ -121,7 +120,7 @@ export default class TalksUpNext extends React.Component {
return null;
}

const { dateTime, time } = this.state;
const { dateTime } = this.state;

if (dateTime) {
return (
Expand Down
13 changes: 3 additions & 10 deletions src/components/TicketCard.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import React from "react";
import { Image, Platform, StyleSheet, View } from "react-native";
import { Svg } from "expo";
import { RectButton } from "react-native-gesture-handler";
import FadeIn from "react-native-fade-in-image";
import { Platform, StyleSheet, View } from "react-native";
import { withNavigation } from "react-navigation";
import QRCode from "react-native-qrcode";

import SaveIconWhenSaved from "./SaveIconWhenSaved";
import { BoldText, RegularText, SemiBoldText } from "./StyledText";
import { conferenceHasEnded, getSpeakerAvatarURL } from "../utils";
import { RegularText } from "./StyledText";
import { Colors, FontSizes } from "../constants";
import {
Button,
Card,
CardActions,
CardContent,
Title,
Paragraph
Title
} from "react-native-paper";

@withNavigation
Expand Down
8 changes: 3 additions & 5 deletions src/components/Tickets.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React from "react";
import { Image, Platform, StyleSheet, View, AsyncStorage } from "react-native";
import moment from "moment-timezone";
import { StyleSheet, View, AsyncStorage } from "react-native";

import { BoldText, RegularText, SemiBoldText } from "./StyledText";
import { RegularText } from "./StyledText";
import TicketCard from "./TicketCard";
import { Colors, FontSizes } from "../constants";
import _ from "lodash";
import {
convertUtcDateToEventTimezoneDaytime,
conferenceHasEnded
Expand Down Expand Up @@ -54,7 +52,7 @@ export default class Tickets extends React.Component {
return null;
}

const { dateTime, time } = this.state;
const { dateTime } = this.state;

if (dateTime) {
return (
Expand Down
1 change: 0 additions & 1 deletion src/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Dimensions, Platform } from "react-native";
import { Constants } from "expo";
import { Header } from "react-navigation";

const X_WIDTH = 375;
Expand Down
18 changes: 2 additions & 16 deletions src/data/index.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
import _ from "lodash";
import moment from "moment-timezone";
import { convertUtcDateToEventTimezone, conferenceHasEnded } from "../utils";

export const Schedule = require("../data/schedule.json");
const FullSchedule = Schedule.events[0].groupedSchedule;

const Speakers = Schedule.events[0].speakers;
const Event = Schedule.events[0];
export const Talks = Schedule.events[0].schedule;

export function findNextTalksAfterDate(date = new Date(), allTalks = Talks) {
export function findNextTalksAfterDate() {
let talks = Event.status.nextFiveScheduledItems;
return talks.slice(0, 3);
}

export function findRandomTalk(allTalks = Talks) {
export function findRandomTalk() {
let talks = _.filter(Talks, talk => talk.type === 0);
return [_.sample(talks)];
}

const NextYearTalk = {
talk: true,
keynote: true,
room: "Unknown",
summary: "",
time: "-",
title: "ReactEurope 2019",
speaker: "Maybe you?"
};

export function findTalkData(speakerName) {
return _.find(Talks, talk => talk.speaker === speakerName);
}
Loading

0 comments on commit 87b0483

Please sign in to comment.