Skip to content

Commit fb59679

Browse files
committed
style: fix eslint errors and misc fixes
1 parent 88ed5dd commit fb59679

File tree

5 files changed

+23
-19
lines changed

5 files changed

+23
-19
lines changed

src/js/App.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import CssModulesTransform from 'react-css-modules'
44
import { functions } from 'react-flag-icon-css'
55

66
import type { CountryType } from 'react-flag-icon-css/lib/types/flow'
7-
import type { default as ReactType } from 'react'
7+
import type ReactType from 'react'
88
import type { AppPropsType, AppFactoryOptionsType } from '../types/flow'
99

1010
import styles from '../styles/app.scss'
@@ -18,11 +18,11 @@ const aCountries = getCountries()
1818
const CssModules = CssModulesTransform(styles, { allowMultiple: true })
1919

2020

21-
const renderFlagBlock = (oCountry: CountryType) : React$Element<*> =>
21+
const renderFlagBlock = (oCountry: CountryType): React$Element<*> =>
2222
<FlagBlock key={oCountry.code} {...oCountry} />
2323

24-
const AppFactory = (options: AppFactoryOptionsType) : ReactType.createElement =>
25-
(props: AppPropsType) : React$Element<*> => {
24+
const AppFactory = (options: AppFactoryOptionsType): ReactType.createElement =>
25+
(props: AppPropsType): React$Element<*> => {
2626
const propsHeader = { [options.stylePropName]: 'header' }
2727
const propsHeading = { [options.stylePropName]: 'heading' }
2828
const propsSubHeading = { [options.stylePropName]: 'sub-heading' }
@@ -37,7 +37,7 @@ const AppFactory = (options: AppFactoryOptionsType) : ReactType.createElement =>
3737
<FlagBlock name="Custom 1" code="w1" />
3838
<FlagBlock name="Custom 2" code="w2" />
3939
<FlagBlock name="Custom 3" code="w3" />
40-
{ aCountries.map((obj: CountryType) : React$Element<FlagBlock> => renderFlagBlock(obj)) }
40+
{ aCountries.map((obj: CountryType): React$Element<FlagBlock> => renderFlagBlock(obj)) }
4141
</div>
4242
</span>)
4343
}

src/js/CustomFlag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { CustomFlagPropsType } from '../types/flow'
88
import themeStyles from '../meta-flags-css'
99

1010

11-
export default ({ ...props, children }: CustomFlagPropsType) : React$Element<*> => {
11+
export default ({ ...props, children }: CustomFlagPropsType): React$Element<*> => {
1212
const FlagIcon = FlagIconFactory(React, { useCssModules: __USE_CSS_MODULES__, themeStyles })
1313
const { className } = props
1414
const flagIconProps = pick(props, ['code', 'size', 'flip', 'rotate', 'squared', 'Component'])

src/js/FlagBlock.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ import type { FlagBlockPropsType } from '../types/flow'
77
import styles from '../styles/FlagBlock.scss'
88

99

10-
const renderCustomFlagChildren = (i: number,
11-
props: FlagBlockPropsType) : React$Element<*> | null => {
10+
const renderCustomFlagChildren = (
11+
i: number,
12+
props: FlagBlockPropsType
13+
): React$Element<*> | null => {
1214
const { name, code } = props
1315
const containerProps = { [getStylePropName()]: 'country-name' }
1416
const codeProps = { [getStylePropName()]: 'country-code' }
@@ -25,7 +27,7 @@ renderCustomFlagChildren.propTypes = {
2527
code: React.PropTypes.string.isRequired
2628
}
2729

28-
const FlagBlock = (props: FlagBlockPropsType) : React$Element<*> => {
30+
const FlagBlock = (props: FlagBlockPropsType): React$Element<*> => {
2931
const { code, name } = props
3032
const sizes = ['', 'lg', '2x', '3x', '4x']
3133
const flip = ['', '', '', 'vertical', 'horizontal']
@@ -35,7 +37,7 @@ const FlagBlock = (props: FlagBlockPropsType) : React$Element<*> => {
3537
const randomFlips: Array<string | number> = getRandomElements(flip, flip.length)
3638

3739
return (<div {...containerProps}>
38-
{ sizes.map((size: string, i: number) : React$Element<CustomFlag> => {
40+
{ sizes.map((size: string, i: number): React$Element<CustomFlag> => {
3941
const customFlagProps = Object.assign({},
4042
{ code, name, [getStylePropName()]: 'flag' }
4143
, size ? { size } : {}

src/js/functions.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
// @flow
22
import type { ObjectType, KeyType, GetRandomElementsReturnType } from '../types/flow'
33

4-
export const getStylePropName = () : string => (__USE_CSS_MODULES__ ? 'styleName' : 'className')
4+
export const getStylePropName = (): string => (__USE_CSS_MODULES__ ? 'styleName' : 'className')
55

6-
export const makeSlug = (str: string) : string => str.toLowerCase().split(' ').join('_')
6+
export const makeSlug = (str: string): string => str.toLowerCase().split(' ').join('_')
77

8-
export const generateFlagLink = (name: string) : string => `https://en.wikipedia.org/wiki/${makeSlug(name)}`
8+
export const generateFlagLink = (name: string): string => `https://en.wikipedia.org/wiki/${makeSlug(name)}`
99

10-
export const getRandomElements = (list: Array<string | number>,
11-
count?: number = 0) : GetRandomElementsReturnType => {
10+
export const getRandomElements = (
11+
list: Array<string | number>,
12+
count?: number = 0
13+
): GetRandomElementsReturnType => {
1214
if (!count || count <= 1) return list[Math.floor((Math.random() * list.length))]
1315
let randomElements = []
1416
for (let n = 0; n < count; n += 1) {
@@ -17,7 +19,7 @@ export const getRandomElements = (list: Array<string | number>,
1719
return randomElements
1820
}
1921

20-
export const pick = (sourceObj: ObjectType, keys: Array<KeyType>) : ObjectType =>
21-
keys.reduce((inObj: ObjectType, key: KeyType) : ObjectType => { // eslint-disable-line arrow-body-style, max-len
22+
export const pick = (sourceObj: ObjectType, keys: Array<KeyType>): ObjectType =>
23+
keys.reduce((inObj: ObjectType, key: KeyType): ObjectType => { // eslint-disable-line arrow-body-style, max-len
2224
return {}.hasOwnProperty.call(sourceObj, key) ? { ...inObj, [key]: sourceObj[key] } : inObj
2325
}, {})

src/styles/mixins.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
// Landings
6161

6262
@mixin flag-block-mq-content($items-per-row) {
63+
width: calc(100% / #{$items-per-row});
64+
6365
&:nth-child(#{$items-per-row}n+#{$items-per-row}) {
6466
border-right: 0;
6567
}
6668

6769
&:nth-last-child(-n+#{$items-per-row - 1}) {
6870
border-bottom: 0;
6971
}
70-
71-
width: calc(100% / #{$items-per-row});
7272
}

0 commit comments

Comments
 (0)