Skip to content

Commit

Permalink
Update @typescript-eslint and fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
iwan-uschka committed Dec 22, 2024
1 parent 22d75a6 commit 761e629
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 87 deletions.
2 changes: 1 addition & 1 deletion apps/www/src/components/docs/table-of-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function Tree({ tree, level = 1, activeItem }: TreeProps) {
href={item.url}
className={cn(
'inline-block no-underline',
item.url === `#${activeItem}`
item.url === `#${activeItem ?? ''}`
? 'font-medium text-primary'
: 'text-sm text-muted-foreground',
)}
Expand Down
2 changes: 1 addition & 1 deletion apps/www/src/components/main-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function MainNav({ items, children }: MainNavProps) {
{siteConfig.name}
</span>
</Link>
{items?.length ? (
{items?.length && segment ? (
<nav className="hidden gap-6 md:flex">
{items?.map((item, index) => (
<Link
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"license": "MIT",
"type": "module",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function Component() {
.then(() => {
console.log('Copied!', { text })
})
.catch(error => {
.catch((error: unknown) => {
console.error('Failed to copy!', error)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function Component() {
return (
<>
{Array.from({ length: 5 }).map((_, index) => (
<Section key={index + 1} title={`${index + 1}`} />
<Section key={index + 1} title={(index + 1).toFixed()} />
))}
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function useOnClickOutside<T extends HTMLElement = HTMLElement>(
const target = event.target as Node

// Do nothing if the target is not connected element with document
if (!target || !target.isConnected) {
if (!target?.isConnected) {
return
}

Expand Down
4 changes: 3 additions & 1 deletion packages/usehooks-ts/src/useScrollLock/useScrollLock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ describe('useScrollLock()', () => {

const scrollbarWidth = window.innerWidth - document.body.scrollWidth

expect(document.body.style.paddingRight).toBe(`${scrollbarWidth}px`)
expect(document.body.style.paddingRight).toBe(
`${scrollbarWidth.toFixed()}px`,
)
unmount()
expect(document.body.style.paddingRight).toBe('')
})
Expand Down
2 changes: 1 addition & 1 deletion packages/usehooks-ts/src/useScrollLock/useScrollLock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function useScrollLock(
0

const scrollbarWidth = offsetWidth - target.current.scrollWidth
target.current.style.paddingRight = `${scrollbarWidth + currentPaddingRight}px`
target.current.style.paddingRight = `${(scrollbarWidth + currentPaddingRight).toFixed()}px`
}

// Lock the scroll
Expand Down
Loading

0 comments on commit 761e629

Please sign in to comment.