Skip to content

Commit 0d895b5

Browse files
committed
fix lint errors
1 parent 91c52ee commit 0d895b5

File tree

5 files changed

+32
-20
lines changed

5 files changed

+32
-20
lines changed

app/src/DesignTokens/BorderRadius/BorderRadius.stories.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
COLORS,
66
DIRECTION_COLUMN,
77
Flex,
8-
LegacyStyledText,
98
SPACING,
9+
StyledText,
1010
TYPOGRAPHY,
1111
} from '@opentrons/components'
1212

@@ -17,13 +17,13 @@ export default {
1717
} as Meta
1818

1919
interface BorderRadiusStorybookProps {
20-
borderRadius: string[]
20+
borderRadius: Array<[string, string]>
2121
}
2222

2323
const Template: Story<BorderRadiusStorybookProps> = args => {
2424
const targetBorderRadiuses = args.borderRadius
2525
.filter(s => s[0].includes('borderRadius'))
26-
.sort((a, b) => {
26+
.sort((a: [string, string], b: [string, string]) => {
2727
const aValue = parseInt(a[1])
2828
const bValue = parseInt(b[1])
2929
return aValue - bValue
@@ -45,9 +45,9 @@ const Template: Story<BorderRadiusStorybookProps> = args => {
4545
width="100%"
4646
height="6rem"
4747
>
48-
<LegacyStyledText as="h2" fontWeight={TYPOGRAPHY.fontWeightRegular}>
48+
<StyledText as="h2" fontWeight={TYPOGRAPHY.fontWeightRegular}>
4949
{`${br[0]}" ${br[1]}`}
50-
</LegacyStyledText>
50+
</StyledText>
5151
<Box
5252
width="10rem"
5353
height="4rem"

app/src/DesignTokens/Spacing/Spacing.stories.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,21 @@ export default {
1919
} as Meta
2020

2121
interface SpacingsStorybookProps {
22-
spacings: string[]
22+
spacings: Array<[string, string]>
2323
}
2424

2525
const Template: Story<SpacingsStorybookProps> = args => {
26-
const targetSpacings = args.spacings.filter(s => !s[1].includes('auto'))
26+
const targetSpacings = args.spacings.filter(
27+
(s: [string, string]) => !s[1].includes('auto')
28+
)
2729
// sort by rem value
28-
const sortedSpacing = targetSpacings.sort((a, b) => {
29-
const aValue = parseFloat(a[1].replace('rem', ''))
30-
const bValue = parseFloat(b[1].replace('rem', ''))
31-
return aValue - bValue
32-
})
30+
const sortedSpacing = targetSpacings.sort(
31+
(a: [string, string], b: [string, string]) => {
32+
const aValue = parseFloat(a[1].replace('rem', ''))
33+
const bValue = parseFloat(b[1].replace('rem', ''))
34+
return aValue - bValue
35+
}
36+
)
3337

3438
const convertToPx = (remFormat: string): string => {
3539
const pxVal = Number(remFormat.replace('rem', '')) * 16
@@ -42,7 +46,7 @@ const Template: Story<SpacingsStorybookProps> = args => {
4246
gridGap={SPACING.spacing8}
4347
padding={SPACING.spacing24}
4448
>
45-
{sortedSpacing.map((spacing, index) => (
49+
{sortedSpacing.map((spacing: [string, string], index) => (
4650
<Flex
4751
key={`spacing_${index}`}
4852
flexDirection={DIRECTION_COLUMN}

app/src/DesignTokens/Typography/Typography.stories.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default {
7171
title: 'Design Tokens/Typography',
7272
argTypes: {
7373
text: {
74-
type: 'text',
74+
type: 'string',
7575
},
7676
styles: {
7777
control: {
@@ -139,10 +139,17 @@ const fontWeightForPairForLegacy = (style: string, weight: string): string => {
139139

140140
const valueFromFlattenedInterp = (
141141
style: FlattenSimpleInterpolation,
142-
valueName: str
142+
valueName: string
143143
): string => {
144-
return style.reduce(
145-
([sawKey, value]: [boolean, null | string], el) => {
144+
if (style == null) {
145+
return ''
146+
}
147+
const styleArray = Array.isArray(style) ? style : [style]
148+
const result = styleArray.reduce<[boolean, null | string]>(
149+
([sawKey, value], el) => {
150+
if (el == null || typeof el !== 'string') {
151+
return [sawKey, value]
152+
}
146153
const thisEl = el.trim()
147154
if (sawKey && value == null) {
148155
return [sawKey, el]
@@ -157,6 +164,7 @@ const valueFromFlattenedInterp = (
157164
},
158165
[false, null]
159166
)[1]
167+
return result ?? ''
160168
}
161169

162170
const styleForPair = (

components/src/forms/RadioGroup.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Template: Story<React.ComponentProps<typeof RadioGroupComponent>> = ({
2222
...args
2323
}) => {
2424
const [controlledValue, setControlledValue] = React.useState<string>(
25-
args?.options?.[0] != null ? args.options[0].value : ''
25+
args?.options?.[0] != null ? (args.options[0].value as string) : ''
2626
)
2727
return (
2828
<Box width={SIZE_6}>

components/src/molecules/TextListTableContent/TextListTableContent.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default {
1717
description: 'The text that appears above the table',
1818
},
1919
listTableHeaders: {
20-
control: 'array',
20+
control: { type: 'array' },
2121
description: 'Headers for the list table',
2222
},
2323
rowCount: {
@@ -59,7 +59,7 @@ const Template: Story<TextListTableContentStoryProps> = args => {
5959
return Array.from({ length: rowCount }, (_, i) => {
6060
return (
6161
// @ts-expect-error Works.
62-
<tr key={`row-${i}`} css={rowStyle(numColumns)}>
62+
<tr key={`row-${i}`} css={rowStyle(numColumns as number)}>
6363
{Array.from({ length: numColumns }, (_, j) => {
6464
const textIndex = (i + j) % loremIpsumSentences.length
6565
return (

0 commit comments

Comments
 (0)