diff --git a/site/package.json b/site/package.json index d81d6f3b0fc68..2f9d37b79aa35 100644 --- a/site/package.json +++ b/site/package.json @@ -129,11 +129,11 @@ "@types/react-window": "1.8.5", "@types/ua-parser-js": "0.7.36", "@types/uuid": "9.0.2", - "@typescript-eslint/eslint-plugin": "5.62.0", - "@typescript-eslint/parser": "5.62.0", + "@typescript-eslint/eslint-plugin": "6.1.0", + "@typescript-eslint/parser": "6.1.0", "@xstate/cli": "0.5.2", "chromatic": "6.20.0", - "eslint": "8.44.0", + "eslint": "8.45.0", "eslint-config-prettier": "8.8.0", "eslint-import-resolver-typescript": "3.5.5", "eslint-plugin-compat": "4.1.4", @@ -141,10 +141,10 @@ "eslint-plugin-import": "2.27.5", "eslint-plugin-jest": "27.2.2", "eslint-plugin-jsx-a11y": "6.7.1", - "eslint-plugin-react": "7.31.1", + "eslint-plugin-react": "7.33.0", "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-storybook": "0.6.12", - "eslint-plugin-unicorn": "47.0.0", + "eslint-plugin-unicorn": "48.0.0", "jest": "29.5.0", "jest-canvas-mock": "2.4.0", "jest-fetch-mock": "3.0.3", diff --git a/site/src/api/errors.ts b/site/src/api/errors.ts index 3a39cd0dcfc1d..33e06ae686231 100644 --- a/site/src/api/errors.ts +++ b/site/src/api/errors.ts @@ -59,7 +59,7 @@ export const mapApiErrorToFieldErrors = ( * @returns error's message if ApiError or Error, else defaultMessage */ export const getErrorMessage = ( - error: Error | ApiError | unknown, + error: unknown, defaultMessage: string, ): string => isApiError(error) @@ -74,9 +74,7 @@ export const getErrorMessage = ( * @returns a combined validation error message if the error is an ApiError * and contains validation messages for different form fields. */ -export const getValidationErrorMessage = ( - error: Error | ApiError | unknown, -): string => { +export const getValidationErrorMessage = (error: unknown): string => { const validationErrors = isApiError(error) && error.response.data.validations ? error.response.data.validations @@ -84,9 +82,7 @@ export const getValidationErrorMessage = ( return validationErrors.map((error) => error.detail).join("\n") } -export const getErrorDetail = ( - error: Error | ApiError | unknown, -): string | undefined | null => +export const getErrorDetail = (error: unknown): string | undefined | null => isApiError(error) ? error.response.data.detail : error instanceof Error diff --git a/site/src/components/AuditLogRow/AuditLogDiff/AuditLogDiff.tsx b/site/src/components/AuditLogRow/AuditLogDiff/AuditLogDiff.tsx index 4ebeffcaf9bf6..6cb1c44cd53b8 100644 --- a/site/src/components/AuditLogRow/AuditLogDiff/AuditLogDiff.tsx +++ b/site/src/components/AuditLogRow/AuditLogDiff/AuditLogDiff.tsx @@ -19,7 +19,7 @@ const getDiffValue = (value: unknown): string => { return "null" } - return value.toString() + return String(value) } export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => { diff --git a/site/src/components/DeploySettingsLayout/Option.tsx b/site/src/components/DeploySettingsLayout/Option.tsx index f4d5b10c0ee6c..49b680b55e98a 100644 --- a/site/src/components/DeploySettingsLayout/Option.tsx +++ b/site/src/components/DeploySettingsLayout/Option.tsx @@ -1,5 +1,5 @@ import { makeStyles } from "@mui/styles" -import { PropsWithChildren, FC, ReactNode } from "react" +import { PropsWithChildren, FC } from "react" import { MONOSPACE_FONT_FAMILY } from "theme/constants" import { DisabledBadge, EnabledBadge } from "./Badges" @@ -19,9 +19,7 @@ const NotSet: FC = () => { return Not set } -export const OptionValue: FC<{ children?: ReactNode | unknown }> = ({ - children, -}) => { +export const OptionValue: FC<{ children?: unknown }> = ({ children }) => { const styles = useStyles() if (typeof children === "boolean") { diff --git a/site/src/components/DeploySettingsLayout/Options.test.tsx b/site/src/components/DeploySettingsLayout/Options.test.tsx index 9842778510eb4..57bf5da8abeb4 100644 --- a/site/src/components/DeploySettingsLayout/Options.test.tsx +++ b/site/src/components/DeploySettingsLayout/Options.test.tsx @@ -13,7 +13,7 @@ const defaultOption: DeploymentOption = { describe("optionValue", () => { it.each<{ option: DeploymentOption - expected: string | string[] | unknown + expected: unknown }>([ { option: { diff --git a/site/src/components/DeploySettingsLayout/OptionsTable.tsx b/site/src/components/DeploySettingsLayout/OptionsTable.tsx index 75d165dd46429..b573d41b5505b 100644 --- a/site/src/components/DeploySettingsLayout/OptionsTable.tsx +++ b/site/src/components/DeploySettingsLayout/OptionsTable.tsx @@ -62,9 +62,7 @@ const OptionsTable: FC<{ } // optionValue is a helper function to format the value of a specific deployment options -export function optionValue( - option: DeploymentOption, -): string[] | string | unknown { +export function optionValue(option: DeploymentOption) { switch (option.name) { case "Max Token Lifetime": case "Session Duration": diff --git a/site/src/components/Icons/VSCodeIcon.tsx b/site/src/components/Icons/VSCodeIcon.tsx index 29cd70a41494a..cb7200ca68523 100644 --- a/site/src/components/Icons/VSCodeIcon.tsx +++ b/site/src/components/Icons/VSCodeIcon.tsx @@ -5,7 +5,7 @@ export const VSCodeIcon = (props: SvgIconProps) => ( ( > = ({