diff --git a/.env-cmdrc.js b/.env-cmdrc.js index 6170486e..9d7e03d1 100644 --- a/.env-cmdrc.js +++ b/.env-cmdrc.js @@ -1,4 +1,4 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires +// eslint-disable-next-line @typescript-eslint/no-require-imports const { parsed: overrides } = require("dotenv").config(); module.exports = { diff --git a/src/components/LinkEditModal.tsx b/src/components/LinkEditModal.tsx index 6ccbaecc..56317184 100644 --- a/src/components/LinkEditModal.tsx +++ b/src/components/LinkEditModal.tsx @@ -119,7 +119,7 @@ export default function LinkEditModal({ const urlValue = event.target.value ? event.target.value : ""; let imageUrlError = ""; try { - urlValue && new URL(urlValue); + const _ = urlValue && new URL(urlValue); } catch (e) { if (!(e instanceof TypeError)) { throw e; @@ -145,12 +145,14 @@ export default function LinkEditModal({ url: formValues.url, imageUrl: formValues.imageUrl, }; - link - ? updateLink({ - id: link.id, - ...payload, - }) - : addLink(payload); + if (link) { + updateLink({ + id: link.id, + ...payload, + }); + } else { + addLink(payload); + } onClose(); }, [addLink, formValues, link, onClose, updateLink], diff --git a/src/hooks/useInitializeColorMode.tsx b/src/hooks/useInitializeColorMode.tsx index 8bb42c20..247968a0 100644 --- a/src/hooks/useInitializeColorMode.tsx +++ b/src/hooks/useInitializeColorMode.tsx @@ -12,9 +12,11 @@ export function useInitializeColorMode() { const initializeColorMode = async () => { const data = await browser.storage.local.get(StorageKey.COLOR_MODE); const storedMode = parseColorMode(data[StorageKey.COLOR_MODE]); - storedMode - ? setColorMode(storedMode) - : setStoredColorMode(initialColorMode); + if (storedMode) { + setColorMode(storedMode); + } else { + setStoredColorMode(initialColorMode); + } }; initializeColorMode(); }, [initialColorMode, setColorMode]); diff --git a/src/models/link-state.ts b/src/models/link-state.ts index 01125c5a..63e3da37 100644 --- a/src/models/link-state.ts +++ b/src/models/link-state.ts @@ -13,12 +13,12 @@ const LinkKeysSchema = z.array(z.string()); const StoredLinkDataListSchema = z.record(z.string(), LinkDataSchema); const NextLinkIdSchema = z.number(); -const LinkStateSchema = z.object({ +const _LinkStateSchema = z.object({ linkKeys: LinkKeysSchema, links: z.array(LinkDataSchema), nextLinkId: NextLinkIdSchema, }); -export type LinkState = z.infer; +export type LinkState = z.infer; export function parseNextLinkId(input: unknown) { return safeParse(input, NextLinkIdSchema);