Skip to content

Commit

Permalink
fix: apply biome unsafe lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ndom91 committed Dec 15, 2023
1 parent f5a3b8f commit f67eb21
Show file tree
Hide file tree
Showing 25 changed files with 110 additions and 110 deletions.
9 changes: 8 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
"linter": {
"enabled": true,
"rules": {
"recommended": true
"recommended": true,
"security": {
"noDangerouslySetInnerHtml": "off"
},
"a11y": {
"useValidAnchor": "off",
"noSvgWithoutTitle": "off"
}
}
},
"formatter": {
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"biome format --write"
],
"*.{js,jsx}": [
"eslint --fix"
]
}
}
4 changes: 2 additions & 2 deletions src/components/bookmark-card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ export default function BookmarkCard({ bookmark, toggleSidebar, session }) {
r="10"
stroke="currentColor"
strokeWidth="4"
></circle>
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
/>
</svg>
) : (
<button
Expand Down
4 changes: 2 additions & 2 deletions src/components/bookmarkTableRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ export default function BookmarkTableRow({ item, toggleSidebar }) {
r="10"
stroke="currentColor"
strokeWidth="4"
></circle>
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
/>
</svg>
) : (
<button
Expand Down
4 changes: 2 additions & 2 deletions src/components/categoryTableRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ export default function CategoryTableRow({ item }) {
r="10"
stroke="currentColor"
strokeWidth="4"
></circle>
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
/>
</svg>
) : null}
</td>
Expand Down
8 changes: 4 additions & 4 deletions src/components/footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function Footer() {
<path
fill="currentColor"
d="M437 152a72 72 0 01-40 12a72 72 0 0032-40a72 72 0 01-45 17a72 72 0 00-122 65a200 200 0 01-145-74a72 72 0 0022 94a72 72 0 01-32-7a72 72 0 0056 69a72 72 0 01-32 1a72 72 0 0067 50a200 200 0 01-105 29a200 200 0 00309-179a200 200 0 0035-37"
></path>
/>
</svg>
</a>
<a
Expand All @@ -23,9 +23,9 @@ export default function Footer() {
className="rounded-lg bg-gray-100 p-1 text-gray-500 transition hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-gray-200 focus:ring-offset-2 focus:ring-offset-white"
>
<svg name="linkedin" className="h-6 w-6" fill="currentColor" viewBox="0 0 512 512">
<circle cx="142" cy="138" r="37"></circle>
<path stroke="currentColor" strokeWidth="66" d="M244 194v198M142 194v198"></path>
<path d="M276 282c0-20 13-40 36-40 24 0 33 18 33 45v105h66V279c0-61-32-89-76-89-34 0-51 19-59 32"></path>
<circle cx="142" cy="138" r="37" />
<path stroke="currentColor" strokeWidth="66" d="M244 194v198M142 194v198" />
<path d="M276 282c0-20 13-40 36-40 24 0 33 18 33 45v105h66V279c0-61-32-89-76-89-34 0-51 19-59 32" />
</svg>
</a>
<a
Expand Down
4 changes: 2 additions & 2 deletions src/components/modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ export default function Modal({ open, toggleModal, saveBookmark, url, loading })
r="10"
stroke="currentColor"
strokeWidth="4"
></circle>
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
/>
</svg>
) : null}
Add
Expand Down
4 changes: 2 additions & 2 deletions src/components/quick-add.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,12 @@ export default function QuickAdd({ categories, session }) {
r="10"
stroke="currentColor"
strokeWidth="4"
></circle>
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
/>
</svg>
) : (
<svg className="h-4 w-4 text-white sm:mr-1" viewBox="0 0 24 24">
Expand Down
10 changes: 5 additions & 5 deletions src/components/rating.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Rating() {
aria-label="Rating 1 of 5"
>
<svg className="h-5 w-5 shrink-0 fill-amber-400" viewBox="0 0 256 256">
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z"></path>
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z" />
</svg>
</button>

Expand All @@ -17,7 +17,7 @@ export default function Rating() {
aria-label="Rating 2 of 5"
>
<svg className="h-5 w-5 shrink-0 fill-amber-400" viewBox="0 0 256 256">
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z"></path>
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z" />
</svg>
</button>

Expand All @@ -27,7 +27,7 @@ export default function Rating() {
aria-label="Rating 3 of 5"
>
<svg className="h-5 w-5 shrink-0 fill-amber-400" viewBox="0 0 256 256">
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z"></path>
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z" />
</svg>
</button>

Expand All @@ -37,7 +37,7 @@ export default function Rating() {
aria-label="Rating 4 of 5"
>
<svg className="h-5 w-5 shrink-0 fill-gray-300" viewBox="0 0 256 256">
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z"></path>
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z" />
</svg>
</button>

Expand All @@ -47,7 +47,7 @@ export default function Rating() {
aria-label="Rating 5 of 5"
>
<svg className="h-5 w-5 shrink-0 fill-gray-300" viewBox="0 0 256 256">
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z"></path>
<path d="M239.2,97.4A16.4,16.4,0,0,0,224.6,86l-59.4-4.1-22-55.5A16.4,16.4,0,0,0,128,16h0a16.4,16.4,0,0,0-15.2,10.4L90.4,82.2,31.4,86A16.5,16.5,0,0,0,16.8,97.4,16.8,16.8,0,0,0,22,115.5l45.4,38.4L53.9,207a18.5,18.5,0,0,0,7,19.6,18,18,0,0,0,20.1.6l46.9-29.7h.2l50.5,31.9a16.1,16.1,0,0,0,8.7,2.6,16.5,16.5,0,0,0,15.8-20.8l-14.3-58.1L234,115.5A16.8,16.8,0,0,0,239.2,97.4Z" />
</svg>
</button>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/components/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default function Sidebar({ session }) {
className="h-10 w-10 rounded-full bg-slate-700 p-2 text-white"
viewBox="0 0 24 24"
>
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"></path>
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" />
</svg>
{open && (
<span className="ml-3 font-serif text-xl font-semibold text-slate-200">
Expand Down Expand Up @@ -160,7 +160,7 @@ export default function Sidebar({ session }) {
strokeLinejoin="round"
strokeWidth="2"
d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"
></path>
/>
</svg>
<span className={`ml-4 font-serif text-lg text-slate-200 ${!open && "hidden"}`}>
{" "}
Expand Down Expand Up @@ -285,7 +285,7 @@ export default function Sidebar({ session }) {
>
{cat.name}
<span className="ml-2 rounded-md bg-slate-700 px-1 text-center text-sm text-slate-200">
{cat["_count"]?.bookmarks ?? 0}
{cat._count?.bookmarks ?? 0}
</span>
</button>
))}
Expand Down Expand Up @@ -401,7 +401,7 @@ export default function Sidebar({ session }) {
>
{tag.emoji} <span className="ml-1">{tag.name}</span>{" "}
<span className="ml-1 rounded-md bg-slate-700 px-1 text-center text-sm text-slate-200">
{tag["_count"]?.bookmarks ?? 0}
{tag._count?.bookmarks ?? 0}
</span>
</button>
))}
Expand Down
8 changes: 4 additions & 4 deletions src/components/skeleton.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export default function Skeleton() {
return (
<div className="m-8 flex h-96 w-60 animate-pulse flex-col rounded shadow-md sm:w-80">
<div className="h-48 rounded-t dark:bg-gray-700"></div>
<div className="h-48 rounded-t dark:bg-gray-700" />
<div className="flex-1 space-y-4 px-4 py-8 dark:bg-gray-900 sm:p-8">
<div className="h-6 w-full rounded dark:bg-gray-700"></div>
<div className="h-6 w-full rounded dark:bg-gray-700"></div>
<div className="h-6 w-3/4 rounded dark:bg-gray-700"></div>
<div className="h-6 w-full rounded dark:bg-gray-700" />
<div className="h-6 w-full rounded dark:bg-gray-700" />
<div className="h-6 w-3/4 rounded dark:bg-gray-700" />
</div>
</div>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/slide-out.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,12 @@ export default function SlideOut({ open, toggleOpen, session }) {
r="10"
stroke="currentColor"
strokeWidth="4"
></circle>
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
/>
</svg>
) : (
<svg className="h-4 w-4 text-white sm:mr-2" viewBox="0 0 24 24">
Expand Down
15 changes: 7 additions & 8 deletions src/components/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ export default function DataTable({ items, initEdit }) {
</tr>
</thead>
<tbody>
{items &&
items.map((bookmark) => (
<BookmarkTableRow
item={bookmark}
key={bookmark.id}
toggleSidebar={() => initEdit(bookmark)}
/>
))}
{items?.map((bookmark) => (
<BookmarkTableRow
item={bookmark}
key={bookmark.id}
toggleSidebar={() => initEdit(bookmark)}
/>
))}
</tbody>
</table>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/tagTableRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ export default function TagTableRow({ item }) {
r="10"
stroke="currentColor"
strokeWidth="4"
></circle>
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
/>
</svg>
) : null}
</td>
Expand Down
19 changes: 9 additions & 10 deletions src/components/toastContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ export default function ToastContainer() {

return (
<div className="pointer-events-none fixed top-4 right-4 z-50 flex w-2/3 max-w-md flex-col items-end sm:top-10 sm:right-10 sm:w-2/6">
{toasts &&
toasts.map((toast) => (
<Toast
id={toast.id}
key={toast.id}
type={toast.type}
title={toast.title}
body={toast.body}
/>
))}
{toasts?.map((toast) => (
<Toast
id={toast.id}
key={toast.id}
type={toast.type}
title={toast.title}
body={toast.body}
/>
))}
</div>
)
}
5 changes: 2 additions & 3 deletions src/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ export const asyncFileReader = async (blob) => {
reject(e)
}
})
} else {
const buffer = Buffer.from(await blob.arrayBuffer())
return `data:image/png;bas64,${buffer.toString("base64")}`
}
const buffer = Buffer.from(await blob.arrayBuffer())
return `data:image/png;bas64,${buffer.toString("base64")}`
}

export const perf = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/toastContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function ToastReducer(state, action) {
}
}
case "DELETE_TOAST": {
const updatedToasts = state.toasts.filter((e) => e.id != action.id)
const updatedToasts = state.toasts.filter((e) => e.id !== action.id)
return {
...state,
toasts: updatedToasts,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/api/auth/[...nextauth].js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ const adapterOverwrite = PrismaAdapter(prisma)
authOptions.adapter = {
...adapterOverwrite,
linkAccount: (account) => {
delete account["not-before-policy"]
delete account["refresh_expires_in"]
account["not-before-policy"] = undefined
account.refresh_expires_in = undefined
return adapterOverwrite.linkAccount(account)
},
}
Expand Down
14 changes: 6 additions & 8 deletions src/pages/api/bookmarks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const handler = async (req, res) => {

// Next, if there are tags, insert them sequentially
let updateTagRes
if (tags && tags.filter(Boolean).length) {
if (tags?.filter(Boolean).length) {
serverTiming.measure("tagMapUpdate")
updateTagRes = await Promise.all(
tags.map(async (tag) => {
Expand Down Expand Up @@ -105,10 +105,9 @@ const handler = async (req, res) => {

// Return response to client
return res.status(200).json({ data: { ...updateBookmarkRes, tags: updateTagRes ?? [] } })
} else {
console.error("ERR - Unauthorized attempt to PUT /api/bookmarks")
return res.status(403).end("Unauthorized")
}
console.error("ERR - Unauthorized attempt to PUT /api/bookmarks")
return res.status(403).end("Unauthorized")
}
case "POST": {
serverTiming.start()
Expand Down Expand Up @@ -187,7 +186,7 @@ const handler = async (req, res) => {

let upsertTagRes
// Next, if there are tags, insert them sequentially
if (tags && tags.filter(Boolean).length) {
if (tags?.filter(Boolean).length) {
serverTiming.measure("tagMapUpsert")
upsertTagRes = await Promise.all(
tags.map(async (tag) => {
Expand Down Expand Up @@ -331,10 +330,9 @@ const handler = async (req, res) => {
return res.status(500).json({ message: error })
}
return res.status(200).json({ message: "Deleted" })
} else {
console.error("ERR - Unauthorized attempt to DELETE /api/bookmarks")
return res.status(403).end("Unauthorized")
}
console.error("ERR - Unauthorized attempt to DELETE /api/bookmarks")
return res.status(403).end("Unauthorized")
}
default: {
res.setHeader("Allow", ["GET", "DELETE", "POST", "PUT"])
Expand Down
5 changes: 2 additions & 3 deletions src/pages/api/categories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ export default withSentry(async function handler(req, res) {
return res.status(405).end(`Method ${method} Not Allowed`)
}
}
} else {
console.error("ERR - Unauthorized attempt at /api/categories")
return res.status(403).end("Unauthorized")
}
console.error("ERR - Unauthorized attempt at /api/categories")
return res.status(403).end("Unauthorized")
})
Loading

0 comments on commit f67eb21

Please sign in to comment.