Skip to content

Commit 8b6623a

Browse files
committed
fix: Address coding standards warnings from TiCS dashboard
1 parent 29ecda5 commit 8b6623a

26 files changed

Lines changed: 89 additions & 69 deletions

File tree

static/js/config/swiper.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ const SCREENSHOTS: {
55
roundLengths: boolean;
66
spaceBetween: number;
77
resizeObserver: boolean;
8-
breakpoints: {
9-
[key: number]: {
10-
spaceBetween: number;
11-
};
12-
};
8+
breakpoints: Record<string, { spaceBetween: number }>;
139
navigation: {
1410
nextEl: string;
1511
prevEl: string;
@@ -22,7 +18,7 @@ const SCREENSHOTS: {
2218
spaceBetween: 32,
2319
resizeObserver: true,
2420
breakpoints: {
25-
620: {
21+
"620": {
2622
spaceBetween: 16,
2723
},
2824
},

static/js/publisher/components/AppPagination/AppPagination.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type {
77
SigningKey,
88
} from "../../types/shared";
99

10-
export type ItemType = SigningKey | Policy | ModelType;
10+
export type ItemType = ModelType | Policy | SigningKey;
1111

1212
type Props<T extends ItemType> = {
1313
keyword: string;

static/js/publisher/components/EmptySnapList/EmptySnapList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Col, Link, Row } from "@canonical/react-components";
22

3-
function EmptySnapList() {
3+
function EmptySnapList(): React.JSX.Element {
44
return (
55
<>
66
<div className="u-fixed-width">

static/js/publisher/components/Filter/Filter.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { useSearchParams } from "react-router-dom";
2-
import { RecoilState, useSetRecoilState } from "recoil";
2+
import { useSetRecoilState } from "recoil";
33
import { Button, Icon } from "@canonical/react-components";
4+
5+
import type { RecoilState } from "recoil";
6+
47
type Props = {
58
state: RecoilState<string>;
69
label: string;

static/js/publisher/components/NewSnapNotification/NewSnapNotification.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Link, Notification } from "@canonical/react-components";
2-
import { ISnap } from "../../types";
32

4-
function NewSnapNotification({ snap }: { snap: ISnap }) {
3+
import type { ISnap } from "../../types";
4+
5+
function NewSnapNotification({ snap }: { snap: ISnap }): React.JSX.Element {
56
const latestRelease = snap.latest_release;
67
const snapName = snap.snapName;
78

static/js/publisher/components/PublishedSnapList/PublishedSnapList.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { Link } from "react-router-dom";
22
import { MainTable, Pagination, Strip } from "@canonical/react-components";
3-
import { ISnap } from "../../types";
43
import SnapNameEntry from "./SnapNameEntry";
54
import NewSnapNotification from "../NewSnapNotification";
65
import EmptySnapList from "../EmptySnapList";
76
import { ITEMS_PER_PAGE } from "../../constants";
87

8+
import type { ISnap } from "../../types";
9+
910
function PublishedSnapList({
1011
snaps,
1112
currentUser,
@@ -18,7 +19,7 @@ function PublishedSnapList({
1819
currentPage: number;
1920
setCurrentPage: (page: number) => void;
2021
totalItems: number;
21-
}) {
22+
}): React.JSX.Element {
2223
const shouldShowNewSnapNotification =
2324
snaps && snaps.length === 1 && snaps[0].is_new;
2425

@@ -119,7 +120,9 @@ function PublishedSnapList({
119120
<Pagination
120121
currentPage={currentPage}
121122
itemsPerPage={ITEMS_PER_PAGE}
122-
paginate={(page) => setCurrentPage(page)}
123+
paginate={(page) => {
124+
setCurrentPage(page);
125+
}}
123126
totalItems={totalItems}
124127
/>
125128
</div>

static/js/publisher/components/PublishedSnapList/SnapNameEntry.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Link } from "react-router-dom";
22
import { Tooltip } from "@canonical/react-components";
33

4-
import { ISnap } from "../../types";
4+
import type { ISnap } from "../../types";
55

6-
function SnapNameEntry({ snap }: { snap: ISnap }) {
6+
function SnapNameEntry({ snap }: { snap: ISnap }): React.JSX.Element {
77
const { snapName, status, icon_url } = snap;
88
return (
99
<Link to={`/${snapName}/listing`} className="p-heading-icon--small">

static/js/publisher/components/PublishedSnapSection/PublishedSnapSection.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { useState } from "react";
22
import { Accordion } from "@canonical/react-components";
3-
import { ISnap } from "../../types";
43
import PublishedSnapList from "../PublishedSnapList";
54
import PublisherMetrics from "../PublisherMetrics";
65
import { ITEMS_PER_PAGE } from "../../constants";
76

7+
import type { ISnap } from "../../types";
8+
89
function PublishedSnapSection({
910
snaps,
1011
currentUser,
1112
}: {
1213
snaps: ISnap[];
1314
currentUser: string;
14-
}) {
15+
}): React.JSX.Element {
1516
const [currentPage, setCurrentPage] = useState<number>(1);
1617

1718
const firstItemOfPage = (currentPage - 1) * ITEMS_PER_PAGE;

static/js/publisher/components/PublisherMetrics/PublisherMetrics.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Col, Notification, Row, Strip } from "@canonical/react-components";
2-
import { ISnap } from "../../types";
32
import { renderPublisherMetrics } from "../../../publisher/pages/Metrics/metrics/metrics";
43
import { useEffect } from "react";
54
import { useFetchPublishedSnapMetrics } from "../../hooks";
65

7-
function PublisherMetrics({ snaps }: { snaps: ISnap[] }) {
6+
import type { ISnap } from "../../types";
7+
8+
function PublisherMetrics({ snaps }: { snaps: ISnap[] }): React.JSX.Element {
89
const { status, data: metricsData } = useFetchPublishedSnapMetrics(snaps);
910

1011
useEffect(() => {

static/js/publisher/components/RegisteredSnaps/RegisteredSnaps.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import {
88
Row,
99
Tooltip,
1010
} from "@canonical/react-components";
11-
12-
import { ISnap } from "../../types";
1311
import { ITEMS_PER_PAGE } from "../../constants";
1412

13+
import type { ISnap } from "../../types";
14+
1515
function RegisteredSnaps({
1616
snaps,
1717
currentUser,
@@ -20,14 +20,16 @@ function RegisteredSnaps({
2020
snaps: ISnap[];
2121
currentUser: string;
2222
refetchSnaps: () => void;
23-
}) {
23+
}): React.JSX.Element {
2424
const [unregisterSnapModal, setUnregisterSnapModal] = useState<string | null>(
2525
null,
2626
);
2727
const [isError, setIsError] = useState<boolean>(false);
2828
const [unregisterLoading, setUnregisterLoading] = useState<boolean>(false);
2929

30-
const closeModal = () => setUnregisterSnapModal(null);
30+
const closeModal = (): void => {
31+
setUnregisterSnapModal(null);
32+
};
3133

3234
const getData = () => {
3335
return snaps.map((snap) => {

0 commit comments

Comments
 (0)