Skip to content

Commit

Permalink
Adds TS linter
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Jul 24, 2018
1 parent 6fecba8 commit 9706ed6
Show file tree
Hide file tree
Showing 110 changed files with 1,571 additions and 2,000 deletions.
15 changes: 8 additions & 7 deletions components/anchor/index.tsx
Expand Up @@ -6,23 +6,24 @@ import * as React from 'react'
import StyledAnchor from './style'

export interface AnchorTheme {
textDecoration?: string,
color?: string,
fontSize?: string,
textDecoration?: string
color?: string
fontSize?: string
userSelect?: string
}

export interface AnchorProps {
id?: string,
href: string,
target?: '_blank' | '_parent' | '_self' | '_top',
text?: string | number,
id?: string
href: string
target?: '_blank' | '_parent' | '_self' | '_top'
text?: string | number
theme?: AnchorTheme
}

class Anchor extends React.PureComponent<AnchorProps, {}> {
render () {
const { id, href, target, theme, text } = this.props

return (
<StyledAnchor
id={id}
Expand Down
1 change: 0 additions & 1 deletion components/anchor/style.ts
Expand Up @@ -16,4 +16,3 @@ const StyledAnchor = styled.a`
` as any

export default StyledAnchor

10 changes: 5 additions & 5 deletions components/boxedContent/index.tsx
Expand Up @@ -7,15 +7,15 @@ import * as React from 'react'
import StyledBoxedContent from './style'

export interface BoxedContentTheme {
maxWidth?: string,
margin?: string,
fontFamily?: string,
maxWidth?: string
margin?: string
fontFamily?: string
color?: string
}

export interface BoxedContentProps {
id?: string,
theme?: BoxedContentTheme,
id?: string
theme?: BoxedContentTheme
children?: React.ReactNode
}

Expand Down
10 changes: 5 additions & 5 deletions components/clock/index.tsx
Expand Up @@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

import * as React from 'react'
import * as React from 'react'

import {
import {
StyledClock,
StyledPeriod,
StyledTime,
Expand All @@ -15,12 +15,12 @@ export interface ClockTheme {
color?: string
}
export interface ClockProps {
id?: string,
id?: string
theme?: ClockTheme
}

export interface ClockState {
currentTime: Array<{type: string, value: string}>,
currentTime: Array<{type: string, value: string}>
date: Date
}

Expand Down Expand Up @@ -91,4 +91,4 @@ class Clock extends React.PureComponent<ClockProps, ClockState> {
}
}

export default Clock
export default Clock
1 change: 0 additions & 1 deletion components/clock/style.ts
Expand Up @@ -56,4 +56,3 @@ export {
StyledPeriod,
StyledTimeSeparator
}

18 changes: 9 additions & 9 deletions components/contentToggleArrow/index.tsx
Expand Up @@ -13,12 +13,12 @@ import {
} from './style'

export interface ContentToggleArrowProps {
id?: string,
summary: string,
open?: boolean,
defaultOpen?: boolean,
withSeparator?: boolean,
children?: React.ReactNode,
id?: string
summary: string
open?: boolean
defaultOpen?: boolean
withSeparator?: boolean
children?: React.ReactNode
onClick?: (e: any) => void
}

Expand All @@ -31,7 +31,7 @@ class ContentToggleArrow extends React.PureComponent<ContentToggleArrowProps, Co
super(props)
// defaultOpen is only valid when there's no user activity
// which means open is undefined
this.state = { open: props.open != null ? props.open : props.defaultOpen }
this.state = { open: props.open !== undefined ? props.open : props.defaultOpen }
this.handleClick = this.handleClick.bind(this)
}

Expand All @@ -42,7 +42,7 @@ class ContentToggleArrow extends React.PureComponent<ContentToggleArrowProps, Co
}

handleClick (e: any) {
this.setState((prevState: ContentToggleArrowState) => ({open: !prevState.open}))
this.setState((prevState: ContentToggleArrowState) => ({ open: !prevState.open }))

this.props.onClick!({
target: {
Expand All @@ -52,7 +52,7 @@ class ContentToggleArrow extends React.PureComponent<ContentToggleArrowProps, Co
})
}

render() {
render () {
const { id, summary, withSeparator, children } = this.props
const { open } = this.state

Expand Down
28 changes: 16 additions & 12 deletions components/dataBlock/index.tsx
Expand Up @@ -9,8 +9,8 @@ import {
} from './style'

export interface DataProps {
id?: string,
asList?: boolean,
id?: string
asList?: boolean
children?: React.ReactNode
}

Expand All @@ -23,18 +23,18 @@ class DataBlock extends React.PureComponent<DataProps, {}> {
}
}
export interface DataItemTheme {
counterColor?: string,
descriptionColor?: string,
counterColor?: string
descriptionColor?: string
userSelect?: string
}

export interface DataItemProps {
id?: string,
counter?: string | number,
text?: string,
description?: string,
size?: 'medium' | 'small',
onClick?: (e: any) => void,
id?: string
counter?: string | number
text?: string
description?: string
size?: 'medium' | 'small'
onClick?: (e: any) => void
theme?: DataItemTheme
}

Expand All @@ -54,10 +54,14 @@ class DataItem extends React.PureComponent<DataItemProps, {}> {
<StyledDataItem id={id} theme={theme} onClick={onClick} size={size}>
<StyledDataItemCounter theme={theme} size={size}>{counter}</StyledDataItemCounter>
{
text && <StyledDataItemText theme={theme} size={size}>{text}</StyledDataItemText>
text
? <StyledDataItemText theme={theme} size={size}>{text}</StyledDataItemText>
: null
}
{
description && <StyledDataItemDescription theme={theme} size={size}>{description}</StyledDataItemDescription>
description
? <StyledDataItemDescription theme={theme} size={size}>{description}</StyledDataItemDescription>
: null
}
</StyledDataItem>
)
Expand Down
38 changes: 19 additions & 19 deletions components/gridSystem/index.tsx
Expand Up @@ -6,22 +6,22 @@ import * as React from 'react'
import { StyledGrid, StyledColumn } from './style'

export interface GridTheme {
padding?: string,
gridGap?: string,
maxWidth?: string,
height?: string,
color?: string,
padding?: string
gridGap?: string
maxWidth?: string
height?: string
color?: string
backgroundColor?: string
margin?: string
alignItems?: string
}

export interface GridProps {
id?: string,
disabled?: boolean,
columns?: number,
onClick?: (e: any) => void,
children?: React.ReactNode,
id?: string
disabled?: boolean
columns?: number
onClick?: (e: any) => void
children?: React.ReactNode
theme?: GridTheme
}

Expand All @@ -43,19 +43,19 @@ class Grid extends React.PureComponent<GridProps, {}> {
}

export interface ColumnTheme {
justifyContent?: string,
alignItems?: string,
backgroundColor?: string,
flexDirection?: string,
flexWrap?: string,
justifyContent?: string
alignItems?: string
backgroundColor?: string
flexDirection?: string
flexWrap?: string
overflow?: string
}

export interface ColumnProps {
id?: string,
size?: number | string,
theme?: ColumnTheme,
onClick?: (e: any) => void,
id?: string
size?: number | string
theme?: ColumnTheme
onClick?: (e: any) => void
children?: React.ReactNode
}

Expand Down
26 changes: 14 additions & 12 deletions components/headings/index.tsx
Expand Up @@ -14,8 +14,8 @@ import {
} from './style'

export interface TitleHeadingProps {
id?: string,
text?: string,
id?: string
text?: string
label?: string
}

Expand All @@ -26,15 +26,17 @@ class TitleHeading extends React.PureComponent<TitleHeadingProps, {}> {
<StyledHeadingTitle id={id}>
{text}
{
label && <StyledHeadingTitleLabel>{label}</StyledHeadingTitleLabel>
label
? <StyledHeadingTitleLabel>{label}</StyledHeadingTitleLabel>
: null
}
</StyledHeadingTitle>
)
}
}

export interface SectionHeadingProps {
id?: string,
id?: string
text?: string
}

Expand All @@ -48,7 +50,7 @@ class SectionHeading extends React.PureComponent<SectionHeadingProps, {}> {
}

export interface FeatureHeadingProps {
id?: string,
id?: string
text?: string
}

Expand All @@ -62,16 +64,16 @@ class FeatureHeading extends React.PureComponent<FeatureHeadingProps, {}> {
}

export interface HeadingTheme {
color?: string,
fontFamily?: string,
fontWeight?: string,
color?: string
fontFamily?: string
fontWeight?: string
margin?: string
}

export interface HeadingProps {
id?: string,
level?: 1 | 2 | 3 | 4 | 5 | 6,
text?: string,
id?: string
level?: 1 | 2 | 3 | 4 | 5 | 6
text?: string
theme?: HeadingTheme
}

Expand Down Expand Up @@ -99,7 +101,7 @@ class Heading extends React.PureComponent<HeadingProps, {}> {

export {
TitleHeading, // to be used as a page's title
SectionHeading, // the main title coveering one/more features
SectionHeading, // the main title covering one/more features
FeatureHeading, // to be used as a feature title
Heading // general heading styles ranging from 1-6
}
6 changes: 3 additions & 3 deletions components/headings/style.ts
Expand Up @@ -24,7 +24,7 @@ const StyledHeadingTitle = StyledSharedHeading.withComponent('h1').extend`
white-space: nowrap;
font-size: 28px;
color: rgb(255, 80, 0);
` as any
`

const StyledHeadingTitleLabel = styled.sup`
box-sizing: border-box;
Expand All @@ -37,15 +37,15 @@ const StyledSectionHeading = StyledSharedHeading.withComponent('h2').extend`
font-size: 20px;
margin: 0 0 20px;
font-weight: 400;
` as any
`

const StyledFeatureHeading = StyledSharedHeading.withComponent('h2').extend`
color: #444444;
font-weight: normal;
font-size: 14px;
margin: 18px 0 8px;
min-width: 160px;
` as any
`

const StyledH1 = styled.h1`
box-sizing: border-box;
Expand Down
8 changes: 4 additions & 4 deletions components/mediaContent/index.tsx
Expand Up @@ -11,14 +11,14 @@ import {
} from './style'

export interface MediaTheme {
width?: string,
width?: string
margin?: string
}

export interface MediaContentProps {
id?: string,
media?: string,
children?: React.ReactNode,
id?: string
media?: string
children?: React.ReactNode
theme?: MediaTheme
}

Expand Down

0 comments on commit 9706ed6

Please sign in to comment.