From 91b3d48b2e9eb67d68f033e6b3e5fd8cf19edb8d Mon Sep 17 00:00:00 2001
From: Mason McElvain <52104630+masonmcelvain@users.noreply.github.com>
Date: Mon, 2 Oct 2023 08:11:04 -0700
Subject: [PATCH] chore(style): apply prettier diff
---
src/components/ActionBar.tsx | 2 +-
src/components/Card.tsx | 2 +-
src/components/Cell.tsx | 14 +++++++-------
src/components/LinkEditModal.tsx | 12 ++++++------
src/components/Page.tsx | 2 +-
src/hooks/useInitializeState.tsx | 2 +-
src/lib/links/delete-link.ts | 4 ++--
src/lib/links/reorder-links.ts | 4 ++--
src/lib/links/update-link.ts | 2 +-
src/lib/webextension.ts | 2 +-
src/public/index.tsx | 2 +-
tests/shortcuts.spec.ts | 4 ++--
tests/smoke.spec.ts | 2 +-
13 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/src/components/ActionBar.tsx b/src/components/ActionBar.tsx
index 18ad4131..466aa82d 100644
--- a/src/components/ActionBar.tsx
+++ b/src/components/ActionBar.tsx
@@ -49,7 +49,7 @@ export default function ActionBar({
aria-label="Toggle color mode"
icon={useColorModeValue(
,
-
+ ,
)}
onClick={onColorModeClick}
/>
diff --git a/src/components/Card.tsx b/src/components/Card.tsx
index 42a9de6c..01316c10 100644
--- a/src/components/Card.tsx
+++ b/src/components/Card.tsx
@@ -29,7 +29,7 @@ export function Card({ linkData, isInEditMode, onClick }: CardProps) {
isDragEventInProgress: !!monitor.getItem(),
}),
}),
- [id]
+ [id],
);
const conditionalButtonProps = isDragEventInProgress
diff --git a/src/components/Cell.tsx b/src/components/Cell.tsx
index efa5d40e..8be94579 100644
--- a/src/components/Cell.tsx
+++ b/src/components/Cell.tsx
@@ -37,10 +37,10 @@ export default function Cell({
() =>
(!isEmpty &&
links.find(
- (link) => link && getStorageKeyForLink(link) === linkKeys[index]
+ (link) => link && getStorageKeyForLink(link) === linkKeys[index],
)) ||
null,
- [isEmpty, index, links, linkKeys]
+ [isEmpty, index, links, linkKeys],
);
const onClick = React.useCallback(
@@ -53,7 +53,7 @@ export default function Cell({
navigateCurrentTab(link.url);
}
},
- [link?.url]
+ [link?.url],
);
const onKeyDown = React.useCallback(
(event: KeyboardEvent) => {
@@ -67,7 +67,7 @@ export default function Cell({
}
}
},
- [index, isEmpty, isInEditMode, onClick, openUpdateLinkModal]
+ [index, isEmpty, isInEditMode, onClick, openUpdateLinkModal],
);
React.useEffect(() => {
document.addEventListener("keydown", onKeyDown);
@@ -84,7 +84,7 @@ export default function Cell({
onClick={onClick}
/>
),
- [isInEditMode, link, onClick]
+ [isInEditMode, link, onClick],
);
const reorderLinks = useLinkStore((state) => state.reorderLinks);
@@ -104,7 +104,7 @@ export default function Cell({
isOver: monitor.isOver(),
}),
}),
- [index, linkKeys]
+ [index, linkKeys],
);
React.useEffect(() => {
@@ -121,7 +121,7 @@ export default function Cell({
event.preventDefault();
deleteLink(index);
},
- [deleteLink, index]
+ [deleteLink, index],
);
const isLastCellWithCard = index === links.length - 1;
diff --git a/src/components/LinkEditModal.tsx b/src/components/LinkEditModal.tsx
index 3f826a08..6ccbaecc 100644
--- a/src/components/LinkEditModal.tsx
+++ b/src/components/LinkEditModal.tsx
@@ -54,7 +54,7 @@ export default function LinkEditModal({
onClose,
}: LinkEditModalProps) {
const [formValues, setFormValues] = React.useState(
- getFormValuesForLink(link)
+ getFormValuesForLink(link),
);
const onKeyDown = React.useCallback>(
@@ -64,7 +64,7 @@ export default function LinkEditModal({
onClose();
}
},
- [isOpen, onClose]
+ [isOpen, onClose],
);
const populateFormWithTab = React.useCallback(async () => {
@@ -96,7 +96,7 @@ export default function LinkEditModal({
const nameError = name ? "" : "Please enter a name for the link";
setFormValues({ ...formValues, name, nameError });
},
- [formValues, setFormValues]
+ [formValues, setFormValues],
);
const handleLinkUrlChange = React.useCallback<
@@ -108,7 +108,7 @@ export default function LinkEditModal({
const urlError = url ? "" : "Please enter a URL for the link";
setFormValues({ ...formValues, url, urlError });
},
- [formValues, setFormValues]
+ [formValues, setFormValues],
);
const handleImageUrlChange = React.useCallback<
@@ -132,7 +132,7 @@ export default function LinkEditModal({
imageUrlError,
});
},
- [formValues, setFormValues]
+ [formValues, setFormValues],
);
const addLink = useLinkStore((state) => state.addLink);
@@ -153,7 +153,7 @@ export default function LinkEditModal({
: addLink(payload);
onClose();
},
- [addLink, formValues, link, onClose, updateLink]
+ [addLink, formValues, link, onClose, updateLink],
);
return (
diff --git a/src/components/Page.tsx b/src/components/Page.tsx
index 27d9c1ad..0c4ee572 100644
--- a/src/components/Page.tsx
+++ b/src/components/Page.tsx
@@ -28,7 +28,7 @@ export default function Page() {
onLinkEditModalOpen();
}
},
- [onLinkEditModalOpen, toggleEditMode]
+ [onLinkEditModalOpen, toggleEditMode],
);
React.useEffect(() => {
document.addEventListener("keydown", onKeyDown);
diff --git a/src/hooks/useInitializeState.tsx b/src/hooks/useInitializeState.tsx
index 3edebe90..f5c893c3 100644
--- a/src/hooks/useInitializeState.tsx
+++ b/src/hooks/useInitializeState.tsx
@@ -28,7 +28,7 @@ export function useInitializeState() {
if (nextLinkId && linkKeys?.length) {
const storedLinks = parseStoredLinks(
- await browser.storage.local.get(linkKeys)
+ await browser.storage.local.get(linkKeys),
);
const links =
(storedLinks && linkKeys.map((key) => storedLinks[key])) ?? [];
diff --git a/src/lib/links/delete-link.ts b/src/lib/links/delete-link.ts
index 3aece633..3b9c74d4 100644
--- a/src/lib/links/delete-link.ts
+++ b/src/lib/links/delete-link.ts
@@ -3,13 +3,13 @@ import { LinkState } from "@models/link-state";
export function deleteLink(
prevState: LinkState,
- linkKeyIndex: number
+ linkKeyIndex: number,
): LinkState {
const newLinkKeys = [...prevState.linkKeys];
const [deletedLinkKey] = newLinkKeys.splice(linkKeyIndex, 1);
const newLinks = prevState.links.filter(
- (link) => deletedLinkKey !== getStorageKeyForLink(link)
+ (link) => deletedLinkKey !== getStorageKeyForLink(link),
);
setStoredLinksAndKeys(newLinks, newLinkKeys);
diff --git a/src/lib/links/reorder-links.ts b/src/lib/links/reorder-links.ts
index aab952c1..022af23f 100644
--- a/src/lib/links/reorder-links.ts
+++ b/src/lib/links/reorder-links.ts
@@ -11,14 +11,14 @@ export type ReorderLinksData = {
*/
export function reorderLinks(
prevState: LinkState,
- data: ReorderLinksData
+ data: ReorderLinksData,
): LinkState {
const { sourceId } = data;
let { newLinkKeyIndex } = data;
const newLinkKeys = [...prevState.linkKeys];
const oldLinkKeyIndex = newLinkKeys.findIndex(
- (key) => getLinkIdForStorageKey(key) === sourceId
+ (key) => getLinkIdForStorageKey(key) === sourceId,
);
// If dropped in an empty cell, put the card at the end of the array
diff --git a/src/lib/links/update-link.ts b/src/lib/links/update-link.ts
index a2b863db..f69a8993 100644
--- a/src/lib/links/update-link.ts
+++ b/src/lib/links/update-link.ts
@@ -10,7 +10,7 @@ export type UpdateLinkData = {
export function updateLink(
prevState: LinkState,
- data: UpdateLinkData
+ data: UpdateLinkData,
): LinkState {
const { id, name, url, imageUrl } = data;
diff --git a/src/lib/webextension.ts b/src/lib/webextension.ts
index 10e53cfd..9230fbde 100644
--- a/src/lib/webextension.ts
+++ b/src/lib/webextension.ts
@@ -8,7 +8,7 @@ export function setStoredColorMode(colorMode: ColorMode): void {
export function setStoredLinksAndKeys(
links: LinkData[],
- linkKeys: string[]
+ linkKeys: string[],
): void {
setStoredLinkKeys(linkKeys);
setStoredLinks(links);
diff --git a/src/public/index.tsx b/src/public/index.tsx
index 6317f893..c2dd569a 100644
--- a/src/public/index.tsx
+++ b/src/public/index.tsx
@@ -13,5 +13,5 @@ createRoot(domNode).render(
-
+ ,
);
diff --git a/tests/shortcuts.spec.ts b/tests/shortcuts.spec.ts
index d656dbc8..07ba9b0f 100644
--- a/tests/shortcuts.spec.ts
+++ b/tests/shortcuts.spec.ts
@@ -53,7 +53,7 @@ test("can escape new link modal", async ({ page }) => {
await page.keyboard.down("n");
await page.keyboard.down("Escape");
await expect(
- page.getByRole("button", { name: "Create new link" })
+ page.getByRole("button", { name: "Create new link" }),
).toBeVisible();
});
@@ -61,6 +61,6 @@ test("can escape edit link modal", async ({ page }) => {
await page.keyboard.down("e");
await page.keyboard.down("Escape");
await expect(
- page.getByRole("button", { name: "Create new link" })
+ page.getByRole("button", { name: "Create new link" }),
).toBeVisible();
});
diff --git a/tests/smoke.spec.ts b/tests/smoke.spec.ts
index acf9a520..827c6641 100644
--- a/tests/smoke.spec.ts
+++ b/tests/smoke.spec.ts
@@ -2,6 +2,6 @@ import { test, expect } from "@fixtures/extension";
test("new link button is visible", async ({ page }) => {
await expect(
- page.getByRole("button", { name: "Create new link" })
+ page.getByRole("button", { name: "Create new link" }),
).toBeVisible();
});