Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
[Cleanup] Enable noUnusedLocals, remove all refs
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Dec 7, 2017
1 parent 2ac6319 commit d6c64f6
Show file tree
Hide file tree
Showing 123 changed files with 442 additions and 609 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@
"stylelint.additionalDocumentSelectors": ["typescript", "typescriptreact"],
"todohighlight.exclude": ["node_modules/**", ".vscode/**", "externals/**"],
"tslint.autoFixOnSave": true,
"typescript.format.enable": false
"typescript.format.enable": false,
"[json]": {
"editor.formatOnSave": false
}
}
26 changes: 12 additions & 14 deletions src/lib/AppRegistry.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as _ from "lodash"
import React from "react"
import { AppRegistry, View, ViewProperties } from "react-native"
import { TrackingInfo } from "react-tracking"
import { AppRegistry, View } from "react-native"

import Consignments from "./Components/Consignments"
import Containers from "./Containers/index"
Expand All @@ -12,19 +10,18 @@ import {
InboxRenderer,
InquiryRenderer,
MyProfileRenderer,
RenderCallback,
SaleRenderer,
WorksForYouRenderer,
} from "./relay/QueryRenderers"
import FavoritesScene from "./Scenes/Favorites"
import HomeScene from "./Scenes/Home"
import renderWithLoadProgress from "./utils/renderWithLoadProgress"
import { Schema, screenTrack as track, Track } from "./utils/track"
import { Schema, screenTrack as track } from "./utils/track"

// FIXME: This isnt being used
// Analytics wrapper for all of our top level React components
function AddTrack(pageName: string) {
return component => component
}
// function AddTrack(_pageName: string) {
// return component => component
// }

interface ArtistProps {
artistID: string
Expand All @@ -38,7 +35,7 @@ const Artist: React.SFC<ArtistProps> = track<ArtistProps>(props => {
}
})(props => <ArtistRenderer {...props} render={renderWithLoadProgress(Containers.Artist, props)} />)

const Inbox: React.SFC<{}> = track<{}>(props => {
const Inbox: React.SFC<{}> = track<{}>(_props => {
return { context_screen: Schema.PageNames.InboxPage, context_screen_owner_type: null }
})(() => <InboxRenderer render={renderWithLoadProgress(Containers.Inbox)} />)

Expand All @@ -52,10 +49,11 @@ const Gene: React.SFC<GeneProps> = ({ geneID, refineSettings: { medium, price_ra
return <GeneRenderer {...initialProps} render={renderWithLoadProgress(Containers.Gene, initialProps)} />
}

const Sale: React.SFC<{ saleID: string }> = ({ saleID }) => {
const initialProps = { saleID }
return <SaleRenderer {...initialProps} render={renderWithLoadProgress(Containers.Sale, initialProps)} />
}
// FIXME: This isn't being used
// const Sale: React.SFC<{ saleID: string }> = ({ saleID }) => {
// const initialProps = { saleID }
// return <SaleRenderer {...initialProps} render={renderWithLoadProgress(Containers.Sale, initialProps)} />
// }

// TODO: This was required to trigger the 1px wake-up hack (in case the scrollview goes blank)
//
Expand Down
25 changes: 13 additions & 12 deletions src/lib/Components/Artist/Articles/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@ export default createFragmentContainer(
`
)

interface RelayProps {
article: {
thumbnail_title: string | null
href: string | null
author: {
name: string | null
} | null
thumbnail_image: {
url: string | null
} | null
}
}
// FIXME: This is being unused in code
// interface RelayProps {
// article: {
// thumbnail_title: string | null
// href: string | null
// author: {
// name: string | null
// } | null
// thumbnail_image: {
// url: string | null
// } | null
// }
// }
11 changes: 6 additions & 5 deletions src/lib/Components/Artist/Articles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ export default createFragmentContainer(
`
)

interface RelayProps {
articles: Array<{
__id: string
} | null> | null
}
// FIXME: This is being unused in code
// interface RelayProps {
// articles: Array<{
// __id: string
// } | null> | null
// }
21 changes: 11 additions & 10 deletions src/lib/Components/Artist/Artworks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ export default createFragmentContainer(
`
)

interface RelayProps {
artist: {
counts: {
artworks: boolean | number | string | null
for_sale_artworks: boolean | number | string | null
} | null
for_sale_artworks: Array<boolean | number | string | null> | null
not_for_sale_artworks: Array<boolean | number | string | null> | null
}
}
// FIXME: This is unused in code
// interface RelayProps {
// artist: {
// counts: {
// artworks: boolean | number | string | null
// for_sale_artworks: boolean | number | string | null
// } | null
// for_sale_artworks: Array<boolean | number | string | null> | null
// not_for_sale_artworks: Array<boolean | number | string | null> | null
// }
// }
13 changes: 7 additions & 6 deletions src/lib/Components/Artist/Biography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ export default createFragmentContainer(
`
)

interface RelayProps {
artist: {
bio: string | null
blurb: string | null
}
}
// FIXME: This isn't being used in code
// interface RelayProps {
// artist: {
// bio: string | null
// blurb: string | null
// }
// }
6 changes: 4 additions & 2 deletions src/lib/Components/Artist/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { createFragmentContainer, graphql } from "react-relay"
import { Dimensions, NativeModules, StyleSheet, TextStyle, View, ViewStyle } from "react-native"
const { ARTemporaryAPIModule } = NativeModules

import Events from "lib/NativeModules/Events"

import colors from "lib/data/colors"
import InvertedButton from "../Buttons/InvertedButton"
import Headline from "../Text/Headline"
Expand Down Expand Up @@ -49,6 +47,10 @@ class Header extends React.Component<Props, State> {

componentDidMount() {
NativeModules.ARTemporaryAPIModule.followStatusForArtist(this.props.artist._id, (error, following) => {
if (error) {
// FIXME: Handle error
console.error("Artist/Header.tsx |", error)
}
this.setState({ following })
})
}
Expand Down
31 changes: 16 additions & 15 deletions src/lib/Components/Artist/Shows/Metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,19 @@ export default createFragmentContainer(
`
)

interface RelayProps {
show: {
kind: string | null
name: string | null
exhibition_period: string | null
status_update: string | null
status: string | null
partner: {
name: string | null
} | null
location: {
city: string | null
} | null
}
}
// FIXME: This isn't being used in code
// interface RelayProps {
// show: {
// kind: string | null
// name: string | null
// exhibition_period: string | null
// status_update: string | null
// status: string | null
// partner: {
// name: string | null
// } | null
// location: {
// city: string | null
// } | null
// }
// }
19 changes: 10 additions & 9 deletions src/lib/Components/Artist/Shows/Show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface Props extends ViewProperties {
}
}

class Show extends React.Component<Props, {}> {
class Show extends React.Component<Props> {
handleTap() {
SwitchBoard.presentNavigationViewController(this, this.props.show.href)
}
Expand Down Expand Up @@ -56,11 +56,12 @@ export default createFragmentContainer(
`
)

interface RelayProps {
show: {
href: string | null
cover_image: {
url: string | null
} | null
}
}
// FIXME: This isn't being used in code
// interface RelayProps {
// show: {
// href: string | null
// cover_image: {
// url: string | null
// } | null
// }
// }
7 changes: 4 additions & 3 deletions src/lib/Components/Artist/Shows/SmallList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default createFragmentContainer(
`
)

interface RelayProps {
shows: Array<{} | null> | null
}
// FIXME: This isn't being used in code
// interface RelayProps {
// shows: Array<{} | null> | null
// }
11 changes: 6 additions & 5 deletions src/lib/Components/Artist/Shows/VariableSizeShowsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export default createFragmentContainer(
`
)

interface RelayProps {
shows: Array<{
__id: string
} | null> | null
}
// FIXME: This isn't being used in code
// interface RelayProps {
// shows: Array<{
// __id: string
// } | null> | null
// }
4 changes: 1 addition & 3 deletions src/lib/Components/Artist/Shows/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React from "react"
import { createFragmentContainer, graphql } from "react-relay"

import { Dimensions, StyleSheet, TextStyle, View, ViewProperties, ViewStyle } from "react-native"
import { StyleSheet, TextStyle, View, ViewStyle } from "react-native"

import Separator from "../../Separator"
import SerifText from "../../Text/Serif"
import SmallList from "./SmallList"
import VariableSizeShowsList from "./VariableSizeShowsList"

const windowDimensions = Dimensions.get("window")

class Shows extends React.Component<RelayProps, any> {
render() {
return (
Expand Down
2 changes: 0 additions & 2 deletions src/lib/Components/Artist/__stories__/ArtistHeader.story.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { storiesOf } from "@storybook/react-native"
import React from "react"
import { View } from "react-native"
import { Environment, Network, RecordSource, Store } from "relay-runtime"
// import StubContainer from "react-storybooks-relay-container"

import Header from "../Header"

Expand Down
8 changes: 4 additions & 4 deletions src/lib/Components/ArtworkGrids/InfiniteScrollGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import React from "react"
import { Dimensions, LayoutChangeEvent, ScrollView, StyleSheet, View, ViewStyle } from "react-native"
import { RelayPaginationProp } from "react-relay"

import { get } from "lodash"

import Spinner from "../Spinner"
import Artwork from "./Artwork"

Expand Down Expand Up @@ -110,8 +108,6 @@ class InfiniteScrollArtworksGrid extends React.Component<Props, State> {
fetchingNextPage: false,
}

private sentEndForContentLength: null | number = null

artworksConnection(): ArtworksConnection {
return this.props.mapPropsToArtworksConnection(this.props)
}
Expand All @@ -122,6 +118,10 @@ class InfiniteScrollArtworksGrid extends React.Component<Props, State> {
}
this.setState({ fetchingNextPage: true })
this.props.relay.loadMore(PageSize, error => {
if (error) {
// FIXME: Handle error
console.error("InfiniteScrollGrid.tsx |", error)
}
this.setState({ fetchingNextPage: false })
if (!this.artworksConnection().pageInfo.hasNextPage && this.props.onComplete) {
this.props.onComplete()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPaginationContainer, graphql } from "react-relay"
import InfiniteScrollArtworksGrid, { PageSize } from "../InfiniteScrollGrid"
import InfiniteScrollArtworksGrid from "../InfiniteScrollGrid"

import Artwork from "../Artwork"
// tslint:disable-next-line:no-unused-expression
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPaginationContainer, graphql } from "react-relay"
import InfiniteScrollArtworksGrid, { PageSize } from "../InfiniteScrollGrid"
import InfiniteScrollArtworksGrid from "../InfiniteScrollGrid"

import Artwork from "../Artwork"
// tslint:disable-next-line:no-unused-expression
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPaginationContainer, graphql } from "react-relay"
import InfiniteScrollArtworksGrid, { PageSize } from "../InfiniteScrollGrid"
import InfiniteScrollArtworksGrid from "../InfiniteScrollGrid"

import Artwork from "../Artwork"
// tslint:disable-next-line:no-unused-expression
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPaginationContainer, graphql } from "react-relay"
import InfiniteScrollArtworksGrid, { PageSize, Props as GridProps } from "../InfiniteScrollGrid"
import InfiniteScrollArtworksGrid, { Props as GridProps } from "../InfiniteScrollGrid"

import Artwork from "../Artwork"
// tslint:disable-next-line:no-unused-expression
Expand Down
5 changes: 2 additions & 3 deletions src/lib/Components/Buttons/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react"
import { Animated, StyleSheet, TouchableWithoutFeedback, View, ViewProperties } from "react-native"
import { Animated, StyleSheet, TouchableWithoutFeedback, View } from "react-native"

import colors from "lib/data/colors"
import Headline from "../Text/Headline"

import { ButtonProps } from "./"
Expand Down Expand Up @@ -61,7 +60,7 @@ export default class Button extends React.Component<Props, State> {
}
}

componentDidUpdate(prevProps: any, prevState: any) {
componentDidUpdate(_prevProps: any, prevState: any) {
if (this.state.displayState !== prevState.displayState) {
// Don't animate in when it's the initial press down
const showHighlight =
Expand Down
3 changes: 1 addition & 2 deletions src/lib/Components/Buttons/DarkNavigationButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React from "react"
import { Image, TouchableWithoutFeedback, View } from "react-native"
import { Image, TouchableWithoutFeedback } from "react-native"
import styled from "styled-components/native"

import { Colors } from "lib/data/colors"
import { Fonts } from "lib/data/fonts"
import SwitchBoard from "lib/NativeModules/SwitchBoard"
import Separator from "../Separator"

interface Props extends React.Props<DarkNavigationButton> {
href?: string
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Components/Buttons/FlatWhite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default class WhiteButton extends React.Component<Props, State> {
}
}

componentDidUpdate(prevProps: any, prevState: any) {
componentDidUpdate(prevProps: any) {
if (this.props.selected !== prevProps.selected) {
const duration = AnimationDuration
Animated.parallel([
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Components/Buttons/InvertedButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class InvertedButton extends React.Component<InvertedButtonProps,
}
}

componentDidUpdate(prevProps: any, prevState: any) {
componentDidUpdate(prevProps: any) {
if (this.props.selected !== prevProps.selected) {
const duration = AnimationDuration
Animated.parallel([
Expand Down
Loading

0 comments on commit d6c64f6

Please sign in to comment.