Skip to content

chore: bump the eslint group in /site with 5 updates #8636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,22 @@
"@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",
"eslint-plugin-eslint-comments": "3.2.0",
"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",
Expand Down
10 changes: 3 additions & 7 deletions site/src/api/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -74,19 +74,15 @@ 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
: []
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down
6 changes: 2 additions & 4 deletions site/src/components/DeploySettingsLayout/Option.tsx
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -19,9 +19,7 @@ const NotSet: FC = () => {
return <span className={styles.optionValue}>Not set</span>
}

export const OptionValue: FC<{ children?: ReactNode | unknown }> = ({
children,
}) => {
export const OptionValue: FC<{ children?: unknown }> = ({ children }) => {
const styles = useStyles()

if (typeof children === "boolean") {
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/DeploySettingsLayout/Options.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const defaultOption: DeploymentOption = {
describe("optionValue", () => {
it.each<{
option: DeploymentOption
expected: string | string[] | unknown
expected: unknown
}>([
{
option: {
Expand Down
4 changes: 1 addition & 3 deletions site/src/components/DeploySettingsLayout/OptionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Icons/VSCodeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const VSCodeIcon = (props: SvgIconProps) => (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none">
<mask
id="vscode_mask0"
mask-type="alpha"
style={{ maskType: "alpha" }}
maskUnits="userSpaceOnUse"
x="0"
y="0"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Icons/VSCodeInsidersIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const VSCodeInsidersIcon = (props: SvgIconProps) => (
>
<mask
id="mask0"
mask-type="alpha"
style={{ maskType: "alpha" }}
maskUnits="userSpaceOnUse"
x="0"
y="0"
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/LicenseBanner/LicenseBannerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const LicenseBannerView: React.FC<LicenseBannerViewProps> = ({
<Expander expanded={showDetails} setExpanded={setShowDetails}>
<ul className={styles.list}>
{messages.map((message) => (
<li className={styles.listItem} key={`${message}`}>
<li className={styles.listItem} key={message}>
{message}
</li>
))}
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/ServiceBanner/ServiceBannerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ServiceBannerView: React.FC<ServiceBannerViewProps> = ({
]
return (
<div
className={`${styles.container}`}
className={styles.container}
style={{ backgroundColor: backgroundColor }}
>
{preview && <Pill text="Preview" type="info" lightBorder />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface AccountFormProps {
isLoading: boolean
initialValues: AccountFormValues
onSubmit: (values: AccountFormValues) => void
updateProfileError?: Error | unknown
updateProfileError?: unknown
// initialTouched is only used for testing the error state of the form.
initialTouched?: FormikTouched<AccountFormValues>
}
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Workspace/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface WorkspaceProps {
canChangeVersions: boolean
hideSSHButton?: boolean
hideVSCodeDesktopButton?: boolean
workspaceErrors: Partial<Record<WorkspaceErrors, Error | unknown>>
workspaceErrors: Partial<Record<WorkspaceErrors, unknown>>
buildInfo?: TypesGen.BuildInfoResponse
sshPrefix?: string
template?: TypesGen.Template
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/WorkspacesTable/WorkspacesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface WorkspacesTableProps {
workspaces?: Workspace[]
isUsingFilter: boolean
onUpdateWorkspace: (workspace: Workspace) => void
error?: Error | unknown
error?: unknown
}

export const WorkspacesTable: FC<WorkspacesTableProps> = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface TableBodyProps {
workspaces?: Workspace[]
isUsingFilter: boolean
onUpdateWorkspace: (workspace: Workspace) => void
error?: Error | unknown
error?: unknown
}

export const WorkspacesTableBody: FC<
Expand Down
2 changes: 1 addition & 1 deletion site/src/contexts/ProxyContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface ProxyContextValue {
// isFetched is true when the 'proxies' api call is complete.
isFetched: boolean
isLoading: boolean
error?: Error | unknown
error?: unknown
// proxyLatencies is a map of proxy id to latency report. If the proxyLatencies[proxy.id] is undefined
// then the latency has not been fetched yet. Calculations happen async for each proxy in the list.
// Refer to the returned report for a given proxy for more information.
Expand Down
4 changes: 2 additions & 2 deletions site/src/contexts/useProxyLatency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const useProxyLatency = (
// dispatchProxyLatenciesGuarded will assign the latency to the proxy
// via the reducer. But it will only do so if the performance entry is
// a resource entry that we care about.
const dispatchProxyLatenciesGuarded = (entry: PerformanceEntry): void => {
const dispatchProxyLatenciesGuarded = (entry: PerformanceEntry) => {
if (entry.entryType !== "resource") {
// We should never get these, but just in case.
return
Expand Down Expand Up @@ -208,7 +208,7 @@ export const useProxyLatency = (
})

// When all the proxy requests finish
Promise.all(proxyRequests)
void Promise.all(proxyRequests)
// TODO: If there is an error on any request, we might want to store some indicator of that?
.finally(() => {
// takeRecords will return any entries that were not called via the callback yet.
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/AuditPage/AuditPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface AuditPageViewProps {
onPageChange: (page: number) => void
isNonInitialPage: boolean
isAuditLogVisible: boolean
error?: Error | unknown
error?: unknown
filterProps: ComponentProps<typeof AuditFilter>
}

Expand Down
4 changes: 2 additions & 2 deletions site/src/pages/CreateTokenPage/CreateTokenForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { Stack } from "components/Stack/Stack"
interface CreateTokenFormProps {
form: FormikContextType<CreateTokenData>
maxTokenLifetime?: number
formError: Error | unknown
setFormError: (arg0: Error | unknown) => void
formError: unknown
setFormError: (arg0: unknown) => void
isCreating: boolean
creationFailed: boolean
}
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/CreateTokenPage/CreateTokenPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const CreateTokenPage: FC = () => {
queryFn: getTokenConfig,
})

const [formError, setFormError] = useState<unknown | undefined>(undefined)
const [formError, setFormError] = useState<unknown>(undefined)

const onCreateSuccess = () => {
displaySuccess(t("createToken.createSuccess"))
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/GroupsPage/CreateGroupPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const validationSchema = Yup.object({

export type CreateGroupPageViewProps = {
onSubmit: (data: CreateGroupRequest) => void
formErrors: unknown | undefined
formErrors?: unknown
isLoading: boolean
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const Language = {
export interface SSHKeysPageViewProps {
isLoading: boolean
hasLoaded: boolean
getSSHKeyError?: Error | unknown
regenerateSSHKeyError?: Error | unknown
getSSHKeyError?: unknown
regenerateSSHKeyError?: unknown
sshKey?: GitSSHKey
onRegenerateClick: () => void
}
Expand Down
4 changes: 2 additions & 2 deletions site/src/pages/UserSettingsPage/TokensPage/TokensPageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ const lastUsedOrNever = (lastUsed: string) => {

export interface TokensPageViewProps {
tokens?: APIKeyWithOwner[]
getTokensError?: Error | unknown
getTokensError?: unknown
isLoading: boolean
hasLoaded: boolean
onDelete: (token: APIKeyWithOwner) => void
deleteTokenError?: Error | unknown
deleteTokenError?: unknown
}

export const TokensPageView: FC<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import { ErrorAlert } from "components/Alert/ErrorAlert"
export interface WorkspaceProxyViewProps {
proxies?: Region[]
proxyLatencies?: Record<string, ProxyLatencyReport>
getWorkspaceProxiesError?: Error | unknown
getWorkspaceProxiesError?: unknown
isLoading: boolean
hasLoaded: boolean
preferredProxy?: Region
selectProxyError?: Error | unknown
selectProxyError?: unknown
}

export const WorkspaceProxyView: FC<
Expand Down
4 changes: 2 additions & 2 deletions site/src/xServices/appearance/appearanceXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { AppearanceConfig } from "../../api/typesGenerated"

export type AppearanceContext = {
appearance?: AppearanceConfig
getAppearanceError?: Error | unknown
setAppearanceError?: Error | unknown
getAppearanceError?: unknown
setAppearanceError?: unknown
preview: boolean
}

Expand Down
2 changes: 1 addition & 1 deletion site/src/xServices/auth/authMethodsXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as API from "api/api"

export interface AuthMethodsContext {
authMethods?: TypeGen.AuthMethods
error?: Error | unknown
error?: unknown
}

export const authMethodsXService = createMachine(
Expand Down
4 changes: 2 additions & 2 deletions site/src/xServices/auth/authXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ const signOut = async () => {
} as UnauthenticatedData
}
export interface AuthContext {
error?: Error | unknown
updateProfileError?: Error | unknown
error?: unknown
updateProfileError?: unknown
data?: AuthData
}

Expand Down
2 changes: 1 addition & 1 deletion site/src/xServices/buildInfo/buildInfoXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as API from "../../api/api"
import * as TypesGen from "../../api/typesGenerated"

export interface BuildInfoContext {
getBuildInfoError?: Error | unknown
getBuildInfoError?: unknown
buildInfo?: TypesGen.BuildInfoResponse
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type CreateWorkspaceContext = {
templateName: string
mode: CreateWorkspaceMode
defaultName: string
error?: Error | unknown
error?: unknown
// Form
template?: Template
parameters?: TemplateVersionParameter[]
Expand Down
2 changes: 1 addition & 1 deletion site/src/xServices/entitlements/entitlementsXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Entitlements } from "../../api/typesGenerated"

export type EntitlementsContext = {
entitlements?: Entitlements
getEntitlementsError?: Error | unknown
getEntitlementsError?: unknown
}

export const entitlementsMachine = createMachine(
Expand Down
2 changes: 1 addition & 1 deletion site/src/xServices/experiments/experimentsMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createMachine, assign } from "xstate"

export interface ExperimentsContext {
experiments?: Experiment[]
getExperimentsError?: Error | unknown
getExperimentsError?: unknown
}

export const experimentsMachine = createMachine(
Expand Down
2 changes: 1 addition & 1 deletion site/src/xServices/quotas/quotasXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { WorkspaceQuota } from "../../api/typesGenerated"
export type QuotaContext = {
username: string
quota?: WorkspaceQuota
getQuotaError?: Error | unknown
getQuotaError?: unknown
}

export const quotaMachine = createMachine(
Expand Down
2 changes: 1 addition & 1 deletion site/src/xServices/roles/siteRolesXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const Language = {
type SiteRolesContext = {
hasPermission: boolean
roles?: TypesGen.AssignableRoles[]
getRolesError: Error | unknown
getRolesError: unknown
}

export const siteRolesMachine = createMachine(
Expand Down
4 changes: 2 additions & 2 deletions site/src/xServices/template/templateVariablesXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ type TemplateVariablesContext = {
createTemplateVersionRequest?: CreateTemplateVersionRequest
newTemplateVersion?: TemplateVersion

getTemplateDataError?: Error | unknown
updateTemplateError?: Error | unknown
getTemplateDataError?: unknown
updateTemplateError?: unknown

jobError?: TemplateVersion["job"]["error"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface TemplateVersionMachineContext {
template?: Template
currentVersion?: TemplateVersion
currentFiles?: TemplateVersionFiles
error?: Error | unknown
error?: unknown
// Get file diffs
previousVersion?: TemplateVersion
previousFiles?: TemplateVersionFiles
Expand Down
2 changes: 1 addition & 1 deletion site/src/xServices/templates/templatesXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface TemplatesContext {
permissions: Permissions
templates?: TypesGen.Template[]
examples?: TypesGen.TemplateExample[]
error?: Error | unknown
error?: unknown
}

export const templatesMachine = createMachine(
Expand Down
Loading