Skip to content

Commit

Permalink
update typescript-eslint/parser + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ashharrison90 committed Sep 6, 2023
1 parent 3d315ff commit ed2cc87
Show file tree
Hide file tree
Showing 26 changed files with 164 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const config: StorybookConfig = {
(rule) =>
typeof rule !== 'string' &&
rule.test instanceof RegExp &&
rule.test.test('.svg')
rule.test.test('.svg'),
)
if (imageRule && typeof imageRule !== 'string') {
imageRule.exclude = /\.svg$/
Expand Down
4 changes: 2 additions & 2 deletions __test__/e2e/theming.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ test.describe('theming', () => {
}) => {
const mainPage = page.locator('[role="main"]')
await expect(mainPage).toBeVisible()
await page.evaluate(() =>
document.querySelector('[role="main"]')?.scrollTo(0, 100)
await page.evaluate(
() => document.querySelector('[role="main"]')?.scrollTo(0, 100),
)
expect(await page.isChecked(themeToggleSelector)).toEqual(false)

Expand Down
2 changes: 1 addition & 1 deletion components/Button/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Button', () => {
render(
<Button href={myMockLink} className={myMockClass}>
{myMockLabel}
</Button>
</Button>,
)
})

Expand Down
4 changes: 2 additions & 2 deletions components/JobSummary/JobSummary.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('JobSummary', () => {
website={mockWebsite}
>
{mockSummary}
</JobSummary>
</JobSummary>,
)
})

Expand Down Expand Up @@ -65,7 +65,7 @@ describe('JobSummary', () => {
website={mockWebsite}
>
{mockSummary}
</JobSummary>
</JobSummary>,
)
const dateRange = screen.getByText('January 2020 - Present')
expect(dateRange).toBeInTheDocument()
Expand Down
4 changes: 2 additions & 2 deletions components/JobSummary/JobSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const JobSummary = forwardRef<HTMLDivElement, Props>(
endDate,
website,
},
ref
ref,
) => {
return (
<div
Expand Down Expand Up @@ -63,7 +63,7 @@ const JobSummary = forwardRef<HTMLDivElement, Props>(
{children}
</div>
)
}
},
)

export default JobSummary
10 changes: 5 additions & 5 deletions components/Layout/Layout.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Layout', () => {
component = render(
<Layout metaTitle={mockMetaTitle} metaDescription={mockMetaDescription}>
{mockChild}
</Layout>
</Layout>,
)

// need to wait for the theme toggle to render
Expand All @@ -53,7 +53,7 @@ describe('Layout', () => {
metaDescription={mockMetaDescription}
>
{mockChild}
</Layout>
</Layout>,
)
const link = screen.getByTestId(foregroundId)
expect(link).toBeInTheDocument()
Expand All @@ -67,7 +67,7 @@ describe('Layout', () => {
metaDescription={mockMetaDescription}
>
{mockChild}
</Layout>
</Layout>,
)
const link = screen.getByTestId(backgroundId)
expect(link).toBeInTheDocument()
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('Layout', () => {
metaDescription={mockMetaDescription}
>
{mockChild}
</Layout>
</Layout>,
)

// need to wait for the theme toggle to render
Expand Down Expand Up @@ -148,7 +148,7 @@ describe('Layout', () => {
metaDescription={mockMetaDescription}
>
{mockChild}
</Layout>
</Layout>,
)

// need to wait for the theme toggle to render
Expand Down
4 changes: 2 additions & 2 deletions components/PostCard/PostCard.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('PostCard', () => {
slug={mockSlug}
tags={mockTags}
title={mockTitle}
/>
/>,
)
})

Expand Down Expand Up @@ -56,7 +56,7 @@ describe('PostCard', () => {
const link = screen.getByTestId('PostCard-image')
expect(link).toHaveAttribute(
'style',
`background-image: url(${mockCoverImage});`
`background-image: url(${mockCoverImage});`,
)
})
})
2 changes: 1 addition & 1 deletion components/PostLayout/PostLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function PostLayout({ children, metadata }: Props) {
scriptElement.setAttribute('src', 'https://utteranc.es/client.js')
scriptElement.setAttribute(
'repo',
'ashharrison90/ashharrison90.github.io'
'ashharrison90/ashharrison90.github.io',
)
scriptElement.setAttribute('issue-term', 'pathname')
scriptElement.setAttribute('label', 'post-comments')
Expand Down
16 changes: 8 additions & 8 deletions components/PostTitle/PostTitle.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('PostTitle', () => {
excerpt={mockExcerpt}
tags={mockTags}
title={mockTitle}
/>
/>,
)
const title = screen.getByText(mockTitle)
expect(title).toBeInTheDocument()
Expand All @@ -37,7 +37,7 @@ describe('PostTitle', () => {
excerpt={mockExcerpt}
tags={mockTags}
title={mockTitle}
/>
/>,
)
const date = screen.getByText(mockDate)
expect(date).toBeInTheDocument()
Expand All @@ -50,7 +50,7 @@ describe('PostTitle', () => {
excerpt={mockExcerpt}
tags={mockTags}
title={mockTitle}
/>
/>,
)
const excerpt = screen.getByText(mockExcerpt)
expect(excerpt).toBeInTheDocument()
Expand All @@ -63,7 +63,7 @@ describe('PostTitle', () => {
excerpt={mockExcerpt}
tags={mockTags}
title={mockTitle}
/>
/>,
)
mockTags.forEach((mockTag) => {
const tag = screen.getByText(mockTag)
Expand All @@ -78,7 +78,7 @@ describe('PostTitle', () => {
excerpt={mockExcerpt}
tags={mockTags}
title={mockTitle}
/>
/>,
)
const link = screen.getByRole('link', { name: 'Share to LinkedIn' })
expect(link).toBeInTheDocument()
Expand All @@ -91,7 +91,7 @@ describe('PostTitle', () => {
excerpt={mockExcerpt}
tags={mockTags}
title={mockTitle}
/>
/>,
)
const link = screen.getByRole('link', { name: 'Share to Reddit' })
expect(link).toBeInTheDocument()
Expand All @@ -104,7 +104,7 @@ describe('PostTitle', () => {
excerpt={mockExcerpt}
tags={mockTags}
title={mockTitle}
/>
/>,
)
const link = screen.getByRole('link', { name: 'Share to Twitter' })
expect(link).toBeInTheDocument()
Expand All @@ -119,7 +119,7 @@ describe('PostTitle', () => {
excerpt={mockExcerpt}
tags={mockTags}
title={mockTitle}
/>
/>,
)
const button = screen.getByRole('button', { name: 'Share' })
expect(button).toBeInTheDocument()
Expand Down
2 changes: 1 addition & 1 deletion components/PostTitle/PostTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default function PostTitle({ date, excerpt, tags, title }: Props) {
ariaLabel={`Share to ${shareData[item].label}`}
href={shareData[item].getShareLink(
encodeURIComponent(pageUrl),
encodeURIComponent(title)
encodeURIComponent(title),
)}
kind={ButtonType.Icon}
>
Expand Down
2 changes: 1 addition & 1 deletion components/Search/Search.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('Search', () => {
className={mockClassName}
placeholder={mockPlaceholder}
onChange={mockOnChange}
/>
/>,
)
})

Expand Down
4 changes: 2 additions & 2 deletions components/Tag/Tag.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Tag', () => {
render(
<ThemeContextProvider>
<Tag label={mockLabel} />
</ThemeContextProvider>
</ThemeContextProvider>,
)
const tag = screen.getByTestId('tag')
const label = screen.getByText(mockLabel)
Expand All @@ -39,7 +39,7 @@ describe('Tag', () => {
render(
<ThemeContextProvider>
<Tag label={mockLabel} />
</ThemeContextProvider>
</ThemeContextProvider>,
)
const tag = screen.getByTestId('tag')
const label = screen.getByText(mockLabel)
Expand Down
21 changes: 13 additions & 8 deletions components/ThemeToggle/ThemeToggle.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@
left: calc(100% - 30px);
line-height: 24px;
position: absolute;
text-rendering: optimizeLegibility; // handle a weird bug in safari with emojis not aligning correctly
text-rendering: optimizelegibility; // handle a weird bug in safari with emojis not aligning correctly
transform: rotate(120deg);
top: 4px;
transition: left, opacity, 0.5s ease;
transition:
left,
opacity,
0.5s ease;
}

.lightIcon {
filter: drop-shadow(1px 1px 1px rgb(0 0 0 / 95%));
opacity: 0%;
opacity: 0;
}

.darkIcon {
filter: drop-shadow(1px -1px 1px rgb(0 0 0 / 95%));
opacity: 100%;
opacity: 1;
}

.toggleButton {
Expand All @@ -50,13 +53,15 @@
top: 4px;
left: 4px;
width: 24px;
transition: transform 0.5s ease, left 0.5s ease;
transition:
transform 0.5s ease,
left 0.5s ease;
}

.input {
height: 0;
margin: 0;
opacity: 0%;
opacity: 0;
width: 0;
}

Expand All @@ -73,11 +78,11 @@
}

.lightIcon {
opacity: 100%;
opacity: 1;
}

.darkIcon {
opacity: 0%;
opacity: 0;
}
}

Expand Down
6 changes: 3 additions & 3 deletions components/ThemeToggle/ThemeToggle.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('ThemeToggle', () => {
render(
<ThemeContextProvider>
<ThemeToggle />
</ThemeContextProvider>
</ThemeContextProvider>,
)
})

Expand Down Expand Up @@ -44,14 +44,14 @@ describe('ThemeToggle', () => {
await user.click(toggle)
expect(toggle.checked).toEqual(false)
expect(document.documentElement.getAttribute('data-theme')).toEqual(
Theme.LIGHT
Theme.LIGHT,
)
expect(localStorage.getItem('theme')).toEqual(Theme.LIGHT)

await user.click(toggle)
expect(toggle.checked).toEqual(true)
expect(document.documentElement.getAttribute('data-theme')).toEqual(
Theme.DARK
Theme.DARK,
)
expect(localStorage.getItem('theme')).toEqual(Theme.DARK)
})
Expand Down
4 changes: 3 additions & 1 deletion components/WordlePoem/CharacterTile.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
font-size: 30px;
justify-content: center;
text-transform: uppercase;
transition: transform 0.5s ease-in-out, color 0.25s step-end;
transition:
transform 0.5s ease-in-out,
color 0.25s step-end;
width: 60px;
}

Expand Down
2 changes: 1 addition & 1 deletion components/WordlePoem/CharacterTile.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('CharacterTile', () => {

it('changes the class correctly based on the matchType', () => {
const { rerender } = render(
<CharacterTile character='f' matchType={MatchType.None} />
<CharacterTile character='f' matchType={MatchType.None} />,
)
const characterTile = screen.getByText('f')
expect(characterTile).toHaveClass('matchNone')
Expand Down
4 changes: 2 additions & 2 deletions components/WordlePoem/CharacterTileIntersectionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const CharacterTileIntersectionContextProvider = ({
},
{
threshold: 1,
}
)
},
),
)

useEffect(() => {
Expand Down
6 changes: 3 additions & 3 deletions components/WordlePoem/WordlePoem.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('WordlePoem', () => {
<WordlePoem
lines={['tread', 'feign blues', 'scope whose moose']}
answer={answer}
/>
/>,
)
expect(screen.getByText(customMatcher('tread'))).toBeInTheDocument()
expect(screen.getByText(customMatcher('feign'))).toBeInTheDocument()
Expand All @@ -50,7 +50,7 @@ describe('WordlePoem', () => {
<WordlePoem
lines={['tread', 'feign blues', 'scope whose moose']}
answer={answer}
/>
/>,
)

const characterTiles = screen.getAllByTestId('wordle-character')
Expand All @@ -65,7 +65,7 @@ describe('WordlePoem', () => {
<WordlePoem
lines={['tread', 'feign blues', 'scope whose moose']}
answer={answer}
/>
/>,
)

const characterTiles = screen.getAllByTestId('wordle-character')
Expand Down
Loading

0 comments on commit ed2cc87

Please sign in to comment.