Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: clean up eslint-disable lines #4735

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 2 commits into from
Oct 25, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export interface WorkspaceScheduleFormValues {
ttl: number
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it and ESLint was still happy 🤷🏼‍♂️ maybe it couldn't infer the type and now it can

export const validationSchema = Yup.object({
sunday: Yup.boolean(),
monday: Yup.boolean().test(
Expand Down
26 changes: 20 additions & 6 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,15 +814,29 @@ export const MockCancellationMessage = {
message: "Job successfully canceled",
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, ESLint was unable because we weren't defining the return type.

I decided to break it out into three type aliases: input, output and the function. Makes it a bit more readable too 👍🏼

export const makeMockApiError = ({
message,
detail,
validations,
}: {
type MockAPIInput = {
message?: string
detail?: string
validations?: FieldError[]
}

type MockAPIOutput = {
response: {
data: {
message: string
detail: string | undefined
validations: FieldError[] | undefined
}
}
isAxiosError: boolean
}

type MakeMockApiErrorFunction = (input: MockAPIInput) => MockAPIOutput

export const makeMockApiError: MakeMockApiErrorFunction = ({
message,
detail,
validations,
}) => ({
response: {
data: {
Expand Down