Skip to content

Commit

Permalink
chore: fix the existing formatting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chillkang committed Aug 1, 2024
1 parent 4152877 commit 20158b2
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 61 deletions.
6 changes: 3 additions & 3 deletions static/js/brand-store/components/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ function Navigation({
const storeName =
store.name.toLowerCase();
return storeName.includes(
value.toLowerCase()
value.toLowerCase(),
);
})
}),
);
} else {
setFilteredBrandstores(
brandStoresList
brandStoresList,
);
}
}}
Expand Down
4 changes: 2 additions & 2 deletions static/js/brand-store/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;

export function usePolicies(
brandId: string | undefined,
modelId: string | undefined
modelId: string | undefined,
) {
return useQuery({
queryKey: ["policies", brandId],
queryFn: async () => {
const response = await fetch(
`/admin/store/${brandId}/models/${modelId}/policies`
`/admin/store/${brandId}/models/${modelId}/policies`,
);

if (!response.ok) {
Expand Down
2 changes: 1 addition & 1 deletion static/js/libs/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Events {
addEvent(
type: string,
selector: string | HTMLElement | Window,
func: unknown
func: unknown,
) {
if (!this.events[type]) {
this.events[type] = [];
Expand Down
10 changes: 5 additions & 5 deletions static/js/public/snap-details/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function renderMap(
number_of_users: number;
percentage_of_users: number;
};
}
},
) {
const mapEl = select(el);

Expand All @@ -39,7 +39,7 @@ export default function renderMap(
percentage_of_users: number;
};
},
world: Topology<Objects<GeoJsonProperties>>
world: Topology<Objects<GeoJsonProperties>>,
) {
const width = mapEl.property("clientWidth");
const height = width * 0.5;
Expand Down Expand Up @@ -137,7 +137,7 @@ export default function renderMap(
.style("left", pos[0] + "px")
.style("display", "block");

let content = [
const content = [
'<span class="u-no-margin--top">',
countrySnapData.name,
];
Expand All @@ -151,7 +151,7 @@ export default function renderMap(
style="background-color: rgb(${countrySnapData.color_rgb[0]}, ${
countrySnapData.color_rgb[1]
}, ${countrySnapData.color_rgb[2]})"></span>
${content.join(" ")}`
${content.join(" ")}`,
);
}
})
Expand All @@ -164,7 +164,7 @@ export default function renderMap(
// @ts-expect-error
mesh(world, world.objects.countries, function (a, b) {
return a !== b;
})
}),
)
.attr("class", "snapcraft-territories__boundary")
.attr("d", path);
Expand Down
8 changes: 4 additions & 4 deletions static/js/publisher/build-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ function getStatuses() {

function addBuildStatus(
row: HTMLElement,
data: Array<{ name: string; status: string }>
data: Array<{ name: string; status: string }>,
): void {
const snapName: string | undefined = row.dataset.snapName;
const releaseData: { name: string; status: string } | undefined = data.find(
(d) => d.name === snapName
(d) => d.name === snapName,
);

let buildStatus: string | undefined;
Expand All @@ -20,7 +20,7 @@ function addBuildStatus(
}

const buildColumn = row.querySelector(
"[data-js='snap-build-status']"
"[data-js='snap-build-status']",
) as HTMLElement;

const failedStatuses: string[] = ["failed_to_build", "release_failed"];
Expand Down Expand Up @@ -49,7 +49,7 @@ function buildStatus(): void {
getStatuses()
.then((data) => {
const snapListRows = document.querySelectorAll(
"[data-js='snap-list-row']"
"[data-js='snap-list-row']",
) as NodeListOf<HTMLElement>;

snapListRows.forEach((row) => addBuildStatus(row, data));
Expand Down
8 changes: 4 additions & 4 deletions static/js/publisher/builds/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ export const UserFacingStatus: {
"Built, won’t be released",
"Built",
6,
WONT_RELEASE
WONT_RELEASE,
),
[RELEASED]: createStatus("Released", "Released", 5, "released"),
[RELEASE_FAILED]: createStatus(
"Built, failed to release",
"Failed",
4,
RELEASE_FAILED
RELEASE_FAILED,
),
[RELEASING_SOON]: createStatus("Releasing", "Releasing", 3, RELEASING_SOON),
[IN_PROGRESS]: createStatus("In progress", "In progress", 2, IN_PROGRESS),
[FAILED_TO_BUILD]: createStatus(
"Failed to build",
"Failed",
1,
FAILED_TO_BUILD
FAILED_TO_BUILD,
),
[CANCELLED]: createStatus("Cancelled", "Cancelled", 8, CANCELLED),
[UNKNOWN]: createStatus("Unknown", "Unknown", 8, NEVER_BUILT),
Expand All @@ -55,7 +55,7 @@ export function createStatus(
statusMessage: string,
shortStatusMessage: string,
priority: number,
badge: string
badge: string,
) {
const loadingStatus = [IN_PROGRESS, RELEASING_SOON];
let icon;
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/listing/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function App() {

useEffect(() => {
const tourContainer = document.getElementById(
"tour-container"
"tour-container",
) as HTMLElement;
initListingTour({
snapName,
Expand Down
2 changes: 1 addition & 1 deletion static/js/publisher/tour.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function initTour({
onTourStarted={onTourStarted}
onTourClosed={onTourClosed}
startTour={startTour}
/>
/>,
);
}

Expand Down
16 changes: 8 additions & 8 deletions static/js/publisher/tour/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function prepareSteps(
elements: HTMLElement[];
content: string;
title: string;
}>
}>,
): Array<{
id: string;
position: string;
Expand All @@ -26,7 +26,7 @@ export function prepareSteps(
return {
...step,
elements: [].slice.apply(
document.querySelectorAll(`[data-tour="${step.id}"]`)
document.querySelectorAll(`[data-tour="${step.id}"]`),
),
position: step.position || "bottom-left",
};
Expand All @@ -37,15 +37,15 @@ export function prepareSteps(
// get rectangle of given DOM element
// relative to the page, taking scroll into account
const getRectFromEl = (
el: HTMLElement
el: HTMLElement,
): {
top: number;
left: number;
width: number;
height: number;
} => {
let clientRect = el.getBoundingClientRect();
let ret = {
const clientRect = el.getBoundingClientRect();
const ret = {
top:
clientRect.top +
(window.pageYOffset || document.documentElement.scrollTop),
Expand Down Expand Up @@ -81,8 +81,8 @@ const getMaskFromRect = (rect: {
left = 0;
}

let bottom = rect.top + rect.height + MASK_OFFSET;
let right = rect.left + rect.width + MASK_OFFSET;
const bottom = rect.top + rect.height + MASK_OFFSET;
const right = rect.left + rect.width + MASK_OFFSET;

return {
top,
Expand Down Expand Up @@ -116,6 +116,6 @@ export const getMaskFromElements = (elements: Array<HTMLElement>) => {
left: Infinity,
right: 0,
bottom: 0,
}
},
);
};
8 changes: 4 additions & 4 deletions static/js/publisher/tour/metricsEvents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("metricsEvents", () => {
"tour-started-by-user",
expect.anything(),
expect.anything(),
expect.anything()
expect.anything(),
);
});
});
Expand All @@ -28,7 +28,7 @@ describe("metricsEvents", () => {
"tour-started-automatically",
expect.anything(),
expect.anything(),
expect.anything()
expect.anything(),
);
});
});
Expand All @@ -40,7 +40,7 @@ describe("metricsEvents", () => {
"tour-finished",
expect.anything(),
expect.anything(),
expect.stringContaining("test-step")
expect.stringContaining("test-step"),
);
});
});
Expand All @@ -52,7 +52,7 @@ describe("metricsEvents", () => {
"tour-skipped",
expect.anything(),
expect.anything(),
expect.stringContaining("test-step")
expect.stringContaining("test-step"),
);
});
});
Expand Down
8 changes: 4 additions & 4 deletions static/js/publisher/tour/metricsEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ export const tourStartedByUser = () =>
"tour-started-by-user",
window.location.href,
"",
`Tour started manually by user on "${document.title}" page`
`Tour started manually by user on "${document.title}" page`,
);

export const tourStartedAutomatically = () =>
triggerEvent(
"tour-started-automatically",
window.location.href,
"",
`Tour started automatically on "${document.title}" page`
`Tour started automatically on "${document.title}" page`,
);

export const tourFinished = (stepId: string) =>
triggerEvent(
"tour-finished",
window.location.href,
"",
`Tour finished on "${document.title}" page on step ${stepId}`
`Tour finished on "${document.title}" page on step ${stepId}`,
);

export const tourSkipped = (stepId: string) =>
triggerEvent(
"tour-skipped",
window.location.href,
"",
`Tour skipped on "${document.title}" page on step ${stepId}`
`Tour skipped on "${document.title}" page on step ${stepId}`,
);
20 changes: 10 additions & 10 deletions static/js/publisher/tour/tour.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("Tour", () => {
startTour={false}
onTourClosed={jest.fn()}
onTourStarted={jest.fn()}
/>
/>,
);

const button = getByText("Tour");
Expand All @@ -46,7 +46,7 @@ describe("Tour", () => {
startTour={false}
onTourClosed={jest.fn()}
onTourStarted={jest.fn()}
/>
/>,
);
const button = getByText("Tour");

Expand All @@ -56,7 +56,7 @@ describe("Tour", () => {
expect.objectContaining({
steps,
}),
expect.any(Object)
expect.any(Object),
);
});
});
Expand All @@ -69,14 +69,14 @@ describe("Tour", () => {
startTour={true}
onTourClosed={jest.fn()}
onTourStarted={jest.fn()}
/>
/>,
);

expect(TourOverlay).toBeCalledWith(
expect.objectContaining({
steps,
}),
expect.any(Object)
expect.any(Object),
);
});

Expand All @@ -87,7 +87,7 @@ describe("Tour", () => {
startTour={true}
onTourClosed={jest.fn()}
onTourStarted={jest.fn()}
/>
/>,
);
expect(tourStartedAutomatically).toBeCalled();
});
Expand All @@ -107,7 +107,7 @@ describe("Tour", () => {
startTour={true}
onTourStarted={onTourStarted}
onTourClosed={jest.fn()}
/>
/>,
);

expect(onTourStarted).toBeCalled();
Expand All @@ -120,7 +120,7 @@ describe("Tour", () => {
onTourStarted={onTourStarted}
startTour={false}
onTourClosed={jest.fn()}
/>
/>,
);
fireEvent.click(getByText("Tour"));

Expand All @@ -142,7 +142,7 @@ describe("Tour", () => {
startTour={true}
onTourClosed={onTourClosed}
onTourStarted={jest.fn()}
/>
/>,
);

expect(onTourClosed).not.toBeCalled();
Expand All @@ -155,7 +155,7 @@ describe("Tour", () => {
onTourClosed={onTourClosed}
startTour={false}
onTourStarted={jest.fn()}
/>
/>,
);

expect(onTourClosed).toBeCalled();
Expand Down
Loading

0 comments on commit 20158b2

Please sign in to comment.