Skip to content
2 changes: 1 addition & 1 deletion frontend/components/ActionsDropdown/ActionsDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface IActionsDropdownProps {
variant?: "button" | "brand-button" | "small-button";
}

const getOptionBackgroundColor = (state: any) => {
const getOptionBackgroundColor = (state: { isFocused: boolean }) => {
return state.isFocused ? COLORS["ui-fleet-black-5"] : "transparent";
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
baseUrl,
} from "test/test-utils";
import mockServer from "test/mock-server";
import { getDeviceVppCommandResultHandler } from "test/handlers/device-handler";
import {
createMockHostAppStoreApp,
createMockHostSoftware,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ const platformSubNav: IPlatformSubNav[] = [
interface IPlatformWrapperProps {
enrollSecret: string;
onCancel: () => void;
certificate: any;
certificate: string | undefined;
isFetchingCertificate: boolean;
fetchCertificateError: any;
fetchCertificateError: Error | null;
config: IConfig | null;
}

Expand Down Expand Up @@ -419,7 +419,7 @@ const PlatformWrapper = ({
<br />
{fetchCertificateError ? (
<span className={`${baseClass}__error`}>
{fetchCertificateError}
{fetchCertificateError?.message}
</span>
) : (
<Button variant="inverse" onClick={onDownloadFlagfile}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const AuthenticationNav = ({
return () => {
document.removeEventListener("keydown", closeWithEscapeKey);
};
}, []);
}, [router]);

const onClick = (): void => {
if (previousLocation) {
Expand Down
5 changes: 0 additions & 5 deletions frontend/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useState, useCallback } from "react";
import classnames from "classnames";

import { COLORS } from "styles/var/colors";
import { DEFAULT_GRAVATAR_LINK } from "utilities/constants";

interface IFleetAvatarProps {
className?: string;
Expand Down Expand Up @@ -123,10 +122,6 @@ const APIOnlyAvatar = ({ className }: IAPIOnlyAvatar) => {
);
};

interface IDefaultAvatar {
className?: string;
}

const DefaultAvatar = ({ className }: IAPIOnlyAvatar) => {
return (
<svg
Expand Down
1 change: 1 addition & 0 deletions frontend/components/ClickableUrls/ClickableUrls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ClickableUrls = ({ text, className }: IClickableUrls): JSX.Element => {
return (
<div
className={clickableUrlClasses}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: sanitizedTextWithLinks }}
/>
);
Expand Down
1 change: 1 addition & 0 deletions frontend/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ interface IEditorProps {
isFormField?: boolean;
maxLines?: number;
className?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onChange?: (value: string, event?: any) => void;
onBlur?: () => void;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const meta: Meta<typeof FileUploader> = {
accept: ".pdf",
isLoading: false,
onFileUpload: () => {
alert("File uploaded!");
console.log("File uploaded!");
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import ReactTooltip, { Place } from "react-tooltip";

interface IHumanTimeDiffWithDateTip {
timeString: string;
// eslint-disable-next-line react/no-unused-prop-types
cutoffBeforeFleetLaunch?: boolean;
tooltipPosition?: Place;
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/LiveQuery/SelectTargets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const SelectTargets = ({
useEffect(() => {
const selected = [...targetedHosts, ...targetedLabels, ...targetedTeams];
setSelectedTargets(selected);
}, [targetedHosts, targetedLabels, targetedTeams]);
}, [targetedHosts, targetedLabels, targetedTeams, setSelectedTargets]);

useEffect(() => {
labelsSummary && setLabels(parseLabels(labelsSummary));
Expand All @@ -294,7 +294,7 @@ const SelectTargets = ({
useEffect(() => {
setIsDebouncing(true);
debounceSearch(searchTextHosts);
}, [searchTextHosts]);
}, [searchTextHosts, debounceSearch]);

const handleClickCancel = () => {
goToQueryEditor();
Expand Down
1 change: 1 addition & 0 deletions frontend/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const Modal = ({
document.removeEventListener("keydown", closeOrSaveWithEnterKey);
};
}
return undefined;
}, [onEnter]);

const backgroundClasses = classnames(`${baseClass}__background`, {
Expand Down
7 changes: 0 additions & 7 deletions frontend/components/PaginatedList/PaginatedList.tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ describe("PaginatedList", () => {
},
];

const fetchTinyPage = (pageNumber: number) => {
if (pageNumber <= 2) {
return [items[pageNumber]];
}
throw new Error("Invalid page number");
};

const fetchSmallPage = (pageNumber: number) => {
if (pageNumber === 0) {
return [items[0], items[1]];
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/PaginatedList/PaginatedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ interface IPaginatedListProps<TItem> {
helpText?: React.ReactNode;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function PaginatedListInner<TItem extends Record<string, any>>(
{
data,
Expand Down Expand Up @@ -104,7 +105,7 @@ function PaginatedListInner<TItem extends Record<string, any>>(
const [dirtyItems, setDirtyItems] = useState<Record<string | number, TItem>>(
{}
);
const [error, setError] = useState<Error | null>(null);
const [error] = useState<Error | null>(null);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wut

const idKey = _idKey ?? "id";
const labelKey = _labelKey ?? "name";
const pageSize = _pageSize ?? 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("Platform compatibility", () => {
it("renders error state", () => {
render(
<PlatformCompatibility
compatiblePlatforms={["macos"]}
compatiblePlatforms={["darwin"]}
error={{ name: "Error", message: "The resource was not found." }}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TooltipWrapper from "components/TooltipWrapper";
import Icon from "components/Icon";

interface IPlatformCompatibilityProps {
compatiblePlatforms: any[] | null;
compatiblePlatforms: QueryablePlatform[] | null;
error: Error | null;
}

Expand Down
8 changes: 4 additions & 4 deletions frontend/components/SQLEditor/SQLEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ const SQLEditor = ({
[`${baseClass}__wrapper--readonly-copy`]: !!isReadonlyCopy,
});

const onClickCopy = () => {
const onClickCopy = useCallback(() => {
stringToClipboard(value || "").then(() => {
setCopied(true);
setTimeout(() => setCopied(false), 2000);
});
};
}, [value]);

const fixHotkeys = (editor: Ace.Editor) => {
editor.commands.removeCommand("gotoline");
Expand Down Expand Up @@ -261,7 +261,7 @@ const SQLEditor = ({
onLoad && onLoad(editor);
};

const onBlurHandler = (event: any, editor?: Ace.Editor): void => {
const onBlurHandler = (_event: unknown, editor?: Ace.Editor): void => {
onBlur && onBlur(editor);
};

Expand Down Expand Up @@ -313,7 +313,7 @@ const SQLEditor = ({
</div>
</div>
);
}, [error, label, labelActionComponent, enableCopy, copied]);
}, [error, label, labelActionComponent, enableCopy, copied, onClickCopy]);

const renderHelpText = () => {
if (helpText) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";

import { syntaxHighlight } from "utilities/helpers";

interface ISyntaxHighlightedCodeProps {
json: unknown;
className?: string;
}

/**
* Renders a JSON object as syntax-highlighted HTML inside a <pre> tag.
*
* This component wraps the `syntaxHighlight` utility which generates safe HTML
* from trusted JSON data (all HTML entities are escaped before span tags are
* added for styling). The dangerouslySetInnerHTML usage is intentional and safe
* because the content is never derived from user input — it is always
* serialized from a controlled JavaScript object.
*/
const SyntaxHighlightedCode = ({
json,
className,
}: ISyntaxHighlightedCodeProps): JSX.Element => {
return (
<pre
className={className}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: syntaxHighlight(json) }}
/>
);
};

export default SyntaxHighlightedCode;
1 change: 1 addition & 0 deletions frontend/components/SyntaxHighlightedCode/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./SyntaxHighlightedCode";
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function useActionCallback(
callbackFn: (targetIds: number[]) => void | undefined
) {
return useCallback(
(targetIds: any) => {
(targetIds: number[]) => {
callbackFn(targetIds);
},
[callbackFn]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ describe("DataTable - component", () => {
},
];

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const data: any = [];

render(
Expand Down
Loading
Loading