Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/nervous-ladybugs-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"eslint-config-custom": patch
"usehooks-ts": patch
"www": patch
---

Update dev dependencies
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@
"[typescriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"files.associations": { "*.json": "jsonc" }
"files.associations": { "*.json": "jsonc" },
"typescript.tsdk": "node_modules/typescript/lib"
}
3 changes: 1 addition & 2 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"eslint-config-custom": "workspace:*",
"eslint-config-next": "14.1.4",
"next-sitemap": "^4.2.3",
"postcss": "8.4.38",
"typescript": "5.4.3"
"postcss": "8.4.38"
}
}
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: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
"changeset-publish": "npx changeset publish",
"generate-doc": "zx ./scripts/generate-doc.js"
},
"resolutions": {
"typescript": "^5.3.3"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@turbo/gen": "^1.12.4",
Expand All @@ -47,6 +44,7 @@
"typedoc-plugin-markdown": "^3.17.1",
"typedoc-plugin-mdn-links": "^3.1.17",
"typedoc-plugin-missing-exports": "^2.2.0",
"typescript": "5.4.3",
"zod": "3.22.4",
"zx": "^7.2.3"
},
Expand Down
7 changes: 3 additions & 4 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
"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",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-vitest": "^0.4.0",
"typescript": "^5.3.3"
"eslint-plugin-vitest": "^0.4.0"
}
}
1 change: 0 additions & 1 deletion packages/usehooks-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"jsdom": "^24.0.0",
"react": "18.2.0",
"tsup": "^8.0.2",
"typescript": "^5.3.3",
"vitest": "^1.3.1"
},
"dependencies": {
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()} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to use .toString() here. This would cause a difference in output. Template literals coerce their values to strings, which calls the .toString() method instead of .toFixed()

let x = 123.456
x.toString() // "123.456"
x.toFixed() // "123"
Suggested change
<Section key={index + 1} title={(index + 1).toFixed()} />
<Section key={index + 1} title={(index + 1).toString()} />

))}
</>
)
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`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment

)
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`
Comment thread
iwan-uschka marked this conversation as resolved.
Outdated
}

// Lock the scroll
Expand Down
Loading