From 29cbffcf389f19929fc22eae1e18d6788a0bea48 Mon Sep 17 00:00:00 2001 From: Bart Akeley Date: Sun, 4 Jun 2017 11:37:38 -0500 Subject: [PATCH] lint script and some fixes --- js/components/Modal.js | 1 + js/components/QuantityPicker.js | 9 ++++----- js/pages/FoodItemDetail.js | 4 ++-- js/records/FoodItemRecord.js | 5 +++-- package.json | 1 + 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/js/components/Modal.js b/js/components/Modal.js index ae2ce5d..92d369c 100644 --- a/js/components/Modal.js +++ b/js/components/Modal.js @@ -4,6 +4,7 @@ import { View, TouchableOpacity, Text, TextInput } from 'react-native'; import Modal from 'react-native-modal'; import { pure } from 'recompose'; import style from '../ui-theme'; +import { Icon } from 'react-native-material-ui'; export default pure(({ children, isVisible }) => ( diff --git a/js/components/QuantityPicker.js b/js/components/QuantityPicker.js index 3c25b53..65d8429 100644 --- a/js/components/QuantityPicker.js +++ b/js/components/QuantityPicker.js @@ -4,13 +4,12 @@ import { getQuantityText } from '../helpers/QuantityHelpers'; import { Picker, View } from 'react-native'; import theme from '../ui-theme'; import { pure } from 'recompose'; -import { type Quantity } from '../records/FoodItemRecord'; +import { type Quantity, QUANTITIES } from '../records/FoodItemRecord'; const { quantityPicker: style } = theme; -const possibleQuantities = ['none', 'few', 'alot', 'plenty']; - -const renderQuantityItem = (selectedQuantity: Quantity) => quantity => ( +/* eslint-disable react/display-name */ +const renderQuantityItem = (selectedQuantity: Quantity) => (quantity: Quantity) => ( ( - {possibleQuantities.map(renderQuantityItem(quantity))} + {QUANTITIES.map(renderQuantityItem(quantity))} )); diff --git a/js/pages/FoodItemDetail.js b/js/pages/FoodItemDetail.js index cfacd2a..926955f 100644 --- a/js/pages/FoodItemDetail.js +++ b/js/pages/FoodItemDetail.js @@ -3,7 +3,7 @@ import React, { Component } from 'react'; import { Image, View } from 'react-native'; import theme from '../ui-theme'; import { NameAndPlace } from '../components/ItemTile'; -import { type FoodItem, type Quantity, QUANTIY_MANY } from '../records/FoodItemRecord'; +import { type FoodItem, type Quantity, QUANTITY_MANY } from '../records/FoodItemRecord'; import typeof PlaceRecord from '../records/PlaceRecord'; import { compose, pure } from 'recompose'; import IconButton from '../components/IconButton'; @@ -39,7 +39,7 @@ export class FoodItemDetail extends Component { state = { currentImage: 0, - quantity: QUANTIY_MANY, + quantity: QUANTITY_MANY, }; // TODO placeholder implementation until we get a backend diff --git a/js/records/FoodItemRecord.js b/js/records/FoodItemRecord.js index 0a047b4..2bf6824 100644 --- a/js/records/FoodItemRecord.js +++ b/js/records/FoodItemRecord.js @@ -3,8 +3,9 @@ import { Record } from 'immutable'; export const QUANTITY_NONE: 'none' = 'none'; export const QUANTITY_FEW: 'few' = 'few'; -export const QUANTIY_MANY: 'many' = 'many'; -export type Quantity = typeof QUANTITY_NONE | typeof QUANTITY_FEW | typeof QUANTIY_MANY; +export const QUANTITY_MANY: 'many' = 'many'; +export type Quantity = typeof QUANTITY_NONE | typeof QUANTITY_FEW | typeof QUANTITY_MANY; +export const QUANTITIES = [QUANTITY_NONE, QUANTITY_FEW, QUANTITY_MANY]; export type FoodItem = { id: ?number, diff --git a/package.json b/package.json index e82e830..3b02c0c 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest", + "lint": "flow && eslint js", "android": "react-native run-android" }, "dependencies": {