Skip to content

Commit

Permalink
chore: lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
masonmcelvain committed Dec 28, 2024
1 parent b94b580 commit 7b65ea5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .env-cmdrc.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
16 changes: 9 additions & 7 deletions src/components/LinkEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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],
Expand Down
8 changes: 5 additions & 3 deletions src/hooks/useInitializeColorMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions src/models/link-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof LinkStateSchema>;
export type LinkState = z.infer<typeof _LinkStateSchema>;

export function parseNextLinkId(input: unknown) {
return safeParse(input, NextLinkIdSchema);
Expand Down

0 comments on commit 7b65ea5

Please sign in to comment.