Skip to content

Commit

Permalink
fix(web): drop @typescript-eslint/no-unused-vars complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Sep 16, 2024
1 parent 0813c49 commit e063e1a
Show file tree
Hide file tree
Showing 44 changed files with 40 additions and 96 deletions.
1 change: 0 additions & 1 deletion web/src/SimpleLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import { InstallerOptions } from "./components/core";
import { _ } from "~/i18n";
import { Loading } from "./components/layout";

/**
Expand Down
3 changes: 1 addition & 2 deletions web/src/api/storage/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
DevicesDirtyResponse,
Drive,
Filesystem,
LvmLv,
LvmVg,
Md,
Multipath,
Expand Down Expand Up @@ -109,7 +108,7 @@ const fetchDevices = async (scope: "result" | "system") => {
device.logicalVolumes = buildCollection(info.logicalVolumes, jsonDevices);
};

const addLvInfo = (device: StorageDevice, _info: LvmLv) => {
const addLvInfo = (device: StorageDevice) => {
device.type = "lvmLv";
};

Expand Down
4 changes: 2 additions & 2 deletions web/src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import { L10nClient } from "./l10n";
import { ManagerClient } from "./manager";
import { StorageClient } from "./storage";
import { HTTPClient, WSClient } from "./http";
import { HTTPClient } from "./http";

/**
* @typedef {object} InstallerClient
* @property {L10nClient} l10n - localization client.
* @property {ManagerClient} manager - manager client.
* @property {StorageClient} storage - storage client.
* @property {() => WSClient} ws - Agama WebSocket client.
* @property {() => import("./http").WSClient} ws - Agama WebSocket client.
* @property {() => boolean} isConnected - determines whether the client is connected
* @property {() => boolean} isRecoverable - determines whether the client is recoverable after disconnected
* @property {(handler: () => void) => (() => void)} onConnect - registers a handler to run
Expand Down
2 changes: 1 addition & 1 deletion web/src/client/manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe("#rebootSystem", () => {
});

it("returns whether the system reboot command was called or not", async () => {
const reboot = await client.finishInstallation();
await client.finishInstallation();
expect(mockPostFn).toHaveBeenCalledWith("/manager/finish", {});
});
});
Expand Down
18 changes: 0 additions & 18 deletions web/src/client/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@
* @return {void}
*/

const ISSUES_SOURCES = ["unknown", "system", "config"];

const buildIssue = ({ description, details, source, severity }) => {
return {
description,
details,
source: ISSUES_SOURCES[source],
severity: severity === 0 ? "warn" : "error",
};
};

/**
* Extends the given class with methods to get and track the service status
*
Expand Down Expand Up @@ -124,11 +113,4 @@ const WithStatus = (superclass, status_path, service_name) =>
* @return {void}
*/

/**
* @param {string} message - Error message
*/
const createError = (message) => {
return { message };
};

export { WithStatus };
7 changes: 2 additions & 5 deletions web/src/client/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@
// @ts-check
// cspell:ignore ptable

import { compact, hex, uniq } from "~/utils";
import { compact, uniq } from "~/utils";
import { WithStatus } from "./mixins";
import { HTTPClient } from "./http";
import { fetchDevices } from "~/api/storage/devices";

const SERVICE_NAME = "org.opensuse.Agama.Storage1";
const STORAGE_OBJECT = "/org/opensuse/Agama/Storage1";
const STORAGE_JOBS_NAMESPACE = "/org/opensuse/Agama/Storage1/jobs";
const STORAGE_JOB_IFACE = "org.opensuse.Agama.Storage1.Job";
const ISCSI_NODES_NAMESPACE = "/storage/iscsi/nodes";
const ZFCP_MANAGER_IFACE = "org.opensuse.Agama.Storage1.ZFCP.Manager";
const ZFCP_CONTROLLERS_NAMESPACE = "/org/opensuse/Agama/Storage1/zfcp_controllers";
Expand Down Expand Up @@ -240,7 +237,7 @@ const dbusBasename = (path) => path.split("/").slice(-1)[0];
*/
class ProposalManager {
/**
* @param {HTTPClient} client
* @param {import("./http").HTTPClien} client
*/
constructor(client) {
this.client = client;
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/Fieldset.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

import React from "react";
import { screen, within } from "@testing-library/react";
import { screen } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import { Fieldset } from "~/components/core";

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/PasswordInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

// @ts-check

import React, { useState, useRef } from "react";
import React, { useState } from "react";
import { Button, InputGroup, TextInput } from "@patternfly/react-core";
import { _ } from "~/i18n";
import { Icon } from "~/components/layout";
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/ProgressReport.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React from "react";

import { act, screen } from "@testing-library/react";
import { screen } from "@testing-library/react";
import { plainRender } from "~/test-utils";

import { ProgressReport } from "~/components/core";
Expand Down
2 changes: 0 additions & 2 deletions web/src/components/core/Section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ export default function Section({
path,
loading,
className,
id,
errors,
children,
"aria-label": ariaLabel,
}) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/layout/Loading.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React from "react";
import { EmptyState, EmptyStateIcon, EmptyStateHeader, Spinner } from "@patternfly/react-core";
import { Center, Icon } from "~/components/layout";
import { Center } from "~/components/layout";
import { _ } from "~/i18n";

const LoadingIcon = () => <Spinner size="xl" />;
Expand Down
1 change: 0 additions & 1 deletion web/src/components/layout/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { Outlet } from "react-router-dom";
import { Page } from "@patternfly/react-core";
import { Header, Loading, Sidebar } from "~/components/layout";
import { useProduct } from "~/queries/software";
import { _ } from "~/i18n";

/**
* Wrapper application component for laying out the content.
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/network/IpAddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const validationState = (value?: string): keyof typeof ValidatedOptions =>

const IpAddressInput = ({
label = _("IP Address"),
onError = (value) => null,
onError = () => null,
...props
}: TextInputProps & { defaultValue?: string }) => {
const [state, setState] = useState(validationState(props.defaultValue));
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/network/IpPrefixInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const validationState = (value?: string | number): keyof typeof ValidatedOptions

const IpPrefixInput = ({
label = _("Ip prefix or netmask"),
onError = (value) => null,
onError = () => null,
...props
}: Omit<TextInputProps, "defaultValue"> & { defaultValue?: string | number }) => {
const [state, setState] = useState(validationState(props.defaultValue));
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/network/NetworkPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React from "react";
import { screen, within } from "@testing-library/react";
import { installerRender, plainRender } from "~/test-utils";
import { installerRender } from "~/test-utils";
import NetworkPage from "~/components/network/NetworkPage";
import { Connection, ConnectionMethod, ConnectionStatus, ConnectionType } from "~/types/network";

Expand Down
4 changes: 2 additions & 2 deletions web/src/components/network/WifiConnectionForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
* To contact SUSE LLC about this file by physical or electronic mail, you may
* find current contact information at www.suse.com.
*/

import React from "react";
import { screen, waitFor } from "@testing-library/react";
import { plainRender } from "~/test-utils";
import WifiConnectionForm from "~/components/network/WifiConnectionForm";
import {
Connection,
ConnectionStatus,
SecurityProtocols,
WifiNetwork,
WifiNetworkStatus,
Expand Down Expand Up @@ -73,7 +73,7 @@ const renderForm = (network: WifiNetwork, errors = {}) =>
describe("WifiConnectionForm", () => {
it("renders a generic warning when mounted with no needsAuth erorr", () => {
renderForm(networkMock, { errorsId: true });
const connectButton = screen.getByText("Connect");
screen.getByText("Connect");
screen.getByText("Warning alert:");
});

Expand Down
2 changes: 0 additions & 2 deletions web/src/components/network/WifiConnectionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
FormGroup,
FormSelect,
FormSelectOption,
FormSelectProps,
TextInput,
} from "@patternfly/react-core";
import { PasswordInput } from "~/components/core";
Expand All @@ -38,7 +37,6 @@ import {
useSelectedWifiChange,
} from "~/queries/network";
import { Connection, WifiNetwork, Wireless } from "~/types/network";
import sprintf from "sprintf-js";
import { _ } from "~/i18n";

/*
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/network/WifiNetworksListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { Icon } from "~/components/layout";
import { Link, EmptyState } from "~/components/core";
import WifiConnectionForm from "~/components/network/WifiConnectionForm";
import { PATHS } from "~/routes/network";
import { DeviceState, WifiNetwork, Wireless } from "~/types/network";
import { DeviceState, WifiNetwork } from "~/types/network";
import { _ } from "~/i18n";
import { formatIp } from "~/utils/network";
import {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/overview/SoftwareSection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/

import React from "react";
import { act, screen } from "@testing-library/react";
import { screen } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import mockTestingPatterns from "~/components/software/patterns.test.json";
import testingProposal from "~/components/software/proposal.test.json";
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/overview/StorageSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

// @ts-check

import React, { useReducer, useEffect, useState, useCallback } from "react";
import React, { useEffect, useState, useCallback } from "react";
import { Text, TextContent, TextVariants } from "@patternfly/react-core";

import { deviceLabel } from "~/components/storage/utils";
Expand Down
10 changes: 4 additions & 6 deletions web/src/components/product/ProductSelectionProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
* find current contact information at www.suse.com.
*/

import React, { useEffect, useState } from "react";
import React from "react";
import { Navigate } from "react-router-dom";
import { _ } from "~/i18n";
import { useProduct } from "~/queries/software";
import { Page, ProgressReport } from "~/components/core";
import { IDLE } from "~/client/status";
import { useInstallerClient } from "~/context/installer";
import { PATHS } from "~/router";
import { useProduct } from "~/queries/software";
import { useInstallerStatus } from "~/queries/status";
import { PATHS } from "~/router";
import { _ } from "~/i18n";

/**
* @component
Expand Down
7 changes: 1 addition & 6 deletions web/src/components/software/SoftwarePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ import {
import { Link, IssuesHint, Page } from "~/components/core";
import UsedSize from "./UsedSize";
import { useIssues } from "~/queries/issues";
import {
selectedProductQuery,
usePatterns,
useProposal,
useProposalChanges,
} from "~/queries/software";
import { usePatterns, useProposal, useProposalChanges } from "~/queries/software";
import { Pattern, SelectedBy } from "~/types/software";
import { _ } from "~/i18n";
import { PATHS } from "~/routes/software";
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/BootSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React, { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { Card, CardBody, Form, FormGroup, Radio, Stack } from "@patternfly/react-core";
import { Form, FormGroup, Radio, Stack } from "@patternfly/react-core";
import { DevicesFormSelect } from "~/components/storage";
import { Page } from "~/components/core";
import { deviceLabel } from "~/components/storage/utils";
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/DASDFormatProgress.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React from "react";
import { screen } from "@testing-library/react";
import { installerRender, plainRender } from "~/test-utils";
import { installerRender } from "~/test-utils";
import DASDFormatProgress from "./DASDFormatProgress";
import { DASDDevice, FormatJob } from "~/types/dasd";

Expand Down
5 changes: 0 additions & 5 deletions web/src/components/storage/PartitionsField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -778,11 +778,6 @@ export type PartitionsFieldProps = {
onVolumesChange: (volumes: Volume[]) => void;
};

type BootConfig = {
configureBoot: boolean;
bootDevice: StorageDevice | undefined;
};

/**
* @todo This component should be restructured to use the same approach as other newer components:
* * Use a TreeTable, specially if we need to represent subvolumes.
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/ProposalActionsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React, { useState } from "react";
import { List, ListItem, ExpandableSection } from "@patternfly/react-core";
import { _, n_ } from "~/i18n";
import { n_ } from "~/i18n";
import { sprintf } from "sprintf-js";
import { partition } from "~/utils";
import { Action } from "~/types/storage";
Expand Down
1 change: 1 addition & 0 deletions web/src/components/storage/ProposalActionsSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export default function ProposalActionsSummary({
return (
<Page.Section
title={_("Actions")}
value={value}
actions={
isLoading ? (
<Skeleton fontSize="sm" width="100px" />
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/storage/ProposalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* find current contact information at www.suse.com.
*/

import React, { useEffect, useRef } from "react";
import React, { useRef } from "react";
import { Grid, GridItem, Stack } from "@patternfly/react-core";
import { Page, Drawer } from "~/components/core/";
import ProposalTransactionalInfo from "./ProposalTransactionalInfo";
Expand Down
3 changes: 0 additions & 3 deletions web/src/components/storage/ProposalResultTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* find current contact information at www.suse.com.
*/

// @ts-check

import React from "react";
import { Label, Flex } from "@patternfly/react-core";
import {
Expand All @@ -29,7 +27,6 @@ import {
DeviceSize,
toStorageDevice,
} from "~/components/storage/device-utils";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import DevicesManager from "~/components/storage/DevicesManager";
import { TreeTable } from "~/components/core";
import { _ } from "~/i18n";
Expand Down
2 changes: 0 additions & 2 deletions web/src/components/storage/ProposalSettingsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ import EncryptionField, { EncryptionConfig } from "~/components/storage/Encrypti
import InstallationDeviceField from "~/components/storage/InstallationDeviceField";
import PartitionsField from "~/components/storage/PartitionsField";
import { TargetConfig } from "~/components/storage/InstallationDeviceField";
import { BootConfig } from "~/components/storage/BootConfigField";
import { CHANGING, NOT_AFFECTED } from "~/components/storage/ProposalPage";
import { ProposalSettings, StorageDevice, Volume } from "~/types/storage";
import { _ } from "~/i18n";
import { compact } from "~/utils";

/**
Expand Down
4 changes: 0 additions & 4 deletions web/src/components/storage/VolumeLocationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* find current contact information at www.suse.com.
*/

// @ts-check

import React, { useState } from "react";
import { Form, FormGroup, Radio, Stack } from "@patternfly/react-core";
import { FormReadOnlyField, Popup } from "~/components/core";
Expand All @@ -30,8 +28,6 @@ import { sprintf } from "sprintf-js";
import { deviceChildren, volumeLabel } from "~/components/storage/utils";
import { StorageDevice, Volume, VolumeTarget } from "~/types/storage";

type LocationOption = "auto" | "device" | "reuse";

// TRANSLATORS: Description of the dialog for changing the location of a file system.
const DIALOG_DESCRIPTION = _(
"The file systems are allocated at the installation device by \
Expand Down
3 changes: 1 addition & 2 deletions web/src/components/users/RootPasswordPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import { Form } from "@patternfly/react-core";
import { PasswordAndConfirmationInput, Popup } from "~/components/core";

import { _ } from "~/i18n";
import { useInstallerClient } from "~/context/installer";
import { useRootUser, useRootUserMutation } from "~/queries/users";
import { useRootUserMutation } from "~/queries/users";

/**
* A dialog holding the form to change the root password
Expand Down
Loading

0 comments on commit e063e1a

Please sign in to comment.