Skip to content
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

Upgrade prettier and eslint-config-prettier #5485

Merged
merged 2 commits into from
Jan 20, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ ed6cdae66d80d46c74b8f29d14c488831d5d6e5c
6eda6fe7ed03b3c09fb855f92666f1fa2affe1a6
# One TX per RPC
9ed49242767f050a4f157c102e2c388b995f458b
# Prettier update to 3.4.2
81c0f8bf5494e8c92dce72e4baf98a2e8bf5906b
2 changes: 1 addition & 1 deletion app/web/__mocks__/nextFontMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module.exports = new Proxy(
style: { fontFamily: "fontFamily" },
});
},
}
},
);
2 changes: 1 addition & 1 deletion app/web/cms/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
Copy link
Member

Choose a reason for hiding this comment

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

I think this is historical legacy stuff and technically better to be uppercase.

Copy link
Member Author

Choose a reason for hiding this comment

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

According to html standards doc looks like it's case insensitive:

https://html.spec.whatwg.org/multipage/syntax.html#the-doctype

Copy link
Member Author

Choose a reason for hiding this comment

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

Also here's the discussion on this change in the prettier repo, looks like no one reported any bugs:

prettier/prettier#15096

Copy link
Member

Choose a reason for hiding this comment

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

OK no worries if it's not causing issues.

<html>
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion app/web/components/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Alert({
}: AlertProps) {
const oldErrorKey = Object.keys(grpcErrorStrings).find(
(oldError): oldError is ObscureGrpcErrorMessages =>
children.includes(oldError)
children.includes(oldError),
);

return (
Expand Down
2 changes: 1 addition & 1 deletion app/web/components/AppRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const GlobalStyles = styled("div")(({ theme }) => ({

[theme.breakpoints.up("sm")]: {
scrollPaddingTop: `calc(${theme.shape.navPaddingSmUp} + ${theme.spacing(
2
2,
)})`,
},
},
Expand Down
4 changes: 2 additions & 2 deletions app/web/components/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type AutocompleteProps<
T,
Multiple extends boolean | undefined,
DisableClearable extends boolean | undefined,
FreeSolo extends boolean | undefined
FreeSolo extends boolean | undefined,
> = Omit<
MuiAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>,
"renderInput"
Expand All @@ -34,7 +34,7 @@ export default function Autocomplete<
T,
Multiple extends boolean | undefined,
DisableClearable extends boolean | undefined,
FreeSolo extends boolean | undefined
FreeSolo extends boolean | undefined,
>({
className,
error,
Expand Down
2 changes: 1 addition & 1 deletion app/web/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function Avatar({
className,
{ [classes.defaultSize]: !className },
classes.root,
{ [classes.grow]: grow }
{ [classes.grow]: grow },
)}
{...otherProps}
>
Expand Down
2 changes: 1 addition & 1 deletion app/web/components/Button/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ it.skip("should try to log the error to Sentry if one is thrown when the button
>
Test button
</Button>,
{ wrapper }
{ wrapper },
);

const user = userEvent.setup();
Expand Down
2 changes: 1 addition & 1 deletion app/web/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function InternalButton<D extends ElementType = "button">(
color = "primary",
...otherProps
}: AppButtonProps<D>,
ref: ForwardedRef<any> // eslint-disable-line
ref: ForwardedRef<any>, // eslint-disable-line
) {
const isMounted = useIsMounted();
const [waiting, setWaiting] = useSafeState(isMounted, false);
Expand Down
2 changes: 1 addition & 1 deletion app/web/components/CenteredSpinner/CenteredSpinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const StyledCenteredLoaderContainer = styled("div")<StyleProps>(
justifyContent: "center",
alignItems: "center",
marginBlockStart: theme.spacing(6),
})
}),
);

export default function CenteredSpinner({
Expand Down
2 changes: 1 addition & 1 deletion app/web/components/CircularProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, { ForwardedRef } from "react";

function _CircularProgress(
{ className, ...otherProps }: CircularProgressProps,
ref: ForwardedRef<HTMLElement>
ref: ForwardedRef<HTMLElement>,
) {
return (
<MuiCircularProgress {...otherProps} className={className} ref={ref} />
Expand Down
8 changes: 4 additions & 4 deletions app/web/components/Comments/CommentBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export default function CommentBox({ threadId }: CommentBoxProps) {
.repliesList
: [],
};
})
)
}),
),
);
} catch (e) {
console.error(e);
Expand All @@ -80,8 +80,8 @@ export default function CommentBox({ threadId }: CommentBoxProps) {
.repliesList
: [],
};
})
)
}),
),
);
} catch (e) {
console.error(e);
Expand Down
14 changes: 7 additions & 7 deletions app/web/components/ContributorForm/ContributorForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,28 @@ describe("contributor form", () => {
await user.type(screen.getByLabelText(IDEAS_LABEL), "I have great ideas");
await user.type(
screen.getByLabelText(FEATURES_LABEL),
"I want all the features"
"I want all the features",
);
await user.click(screen.getByRole("radio", { name: "Yes" }));

await user.click(
screen.getByRole("checkbox", {
name: CONTRIBUTE_WAYS_OPTIONS[8].description,
})
}),
);

await user.click(
screen.getByRole("checkbox", {
name: CONTRIBUTE_WAYS_OPTIONS[4].description,
})
}),
);
await user.type(
screen.getByLabelText(EXPERTISE_LABEL),
"I am a robot, I have all the expertise"
"I am a robot, I have all the expertise",
);
await user.type(
screen.getByLabelText(EXPERIENCE_LABEL),
"I have lots of experience"
"I have lots of experience",
);

await user.click(screen.getByRole("button", { name: SUBMIT }));
Expand All @@ -86,7 +86,7 @@ describe("contributor form", () => {

it("shows the form again if processing the form fails", async () => {
const processForm = jest.fn(() =>
Promise.reject(new Error("Network error?"))
Promise.reject(new Error("Network error?")),
);
mockConsoleError();
render(<ContributorForm processForm={processForm} />, { wrapper });
Expand All @@ -100,7 +100,7 @@ describe("contributor form", () => {
expect(screen.getByRole("alert")).toHaveTextContent("Network error?");
expect(screen.queryByText(SUCCESS_MSG)).not.toBeInTheDocument();
expect(screen.getByLabelText(IDEAS_LABEL) as HTMLInputElement).toHaveValue(
"I have great ideas"
"I have great ideas",
);
expect(processForm).toHaveBeenCalledWith({
ideas: "I have great ideas",
Expand Down
6 changes: 3 additions & 3 deletions app/web/components/ContributorForm/ContributorForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ export default function ContributorForm({
//this reduces it to an array of the "ways" which were keys with "true" as a value
(previous, [contributeWay, checked]) =>
checked ? [...previous, contributeWay] : previous,
[]
)
[],
),
)
.setExpertise(data.expertise);
await processForm(form.toObject());
}
},
);

const submit = handleSubmit((data: ContributorInputs) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function StandaloneContributorForm() {
error: queryError,
} = useQuery<GetContributorFormInfoRes.AsObject, Error>(
contributorFormInfoQueryKey,
service.account.getContributorFormInfo
service.account.getContributorFormInfo,
);

const handleSubmit = async (form: ContributorFormPb.AsObject) => {
Expand Down
2 changes: 1 addition & 1 deletion app/web/components/Datepicker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe("DatePicker", () => {
// @TODO(NA) These should be awaited according to the testing-library docs, but timesout now
// I think bc old mui-x-datepickers package. Try again once we upgrade MUI to latest version.
user.click(
screen.getByLabelText(t("global:components.datepicker.change_date"))
screen.getByLabelText(t("global:components.datepicker.change_date")),
);

user.click(screen.getByRole("button", { name: t("global:submit") }));
Expand Down
36 changes: 18 additions & 18 deletions app/web/components/EditLocationMap.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("Edit location map", () => {
new MaplibreMap({
container: document.createElement("div"),
style: "mapbox://styles/mapbox/streets-v11",
})
}),
);
});
return <div>Map</div>;
Expand Down Expand Up @@ -71,14 +71,14 @@ describe("Edit location map", () => {
}}
updateLocation={jest.fn()}
/>,
{ wrapper }
{ wrapper },
);
await waitFor(() =>
expect(
screen.getByText(
t("global:components.edit_location_map.display_location_label")
)
).toHaveAttribute("data-shrink", "false")
t("global:components.edit_location_map.display_location_label"),
),
).toHaveAttribute("data-shrink", "false"),
);
});

Expand All @@ -93,14 +93,14 @@ describe("Edit location map", () => {
}}
updateLocation={jest.fn()}
/>,
{ wrapper }
{ wrapper },
);
await waitFor(() =>
expect(
screen.getByText(
t("global:components.edit_location_map.display_location_label")
)
).toHaveAttribute("data-shrink", "true")
t("global:components.edit_location_map.display_location_label"),
),
).toHaveAttribute("data-shrink", "true"),
);
});

Expand All @@ -116,38 +116,38 @@ describe("Edit location map", () => {
}}
updateLocation={updateLocation}
/>,
{ wrapper }
{ wrapper },
);

const user = userEvent.setup();

await user.type(
screen.getByLabelText(
t("global:components.edit_location_map.search_location_label")
t("global:components.edit_location_map.search_location_label"),
),
"test{enter}"
"test{enter}",
);
await user.click(
await screen.findByRole("option", {
name: "test city, test county, test country",
})
}),
);

expect(
screen.getByText(
t("global:components.edit_location_map.display_location_label")
)
t("global:components.edit_location_map.display_location_label"),
),
).toHaveAttribute("data-shrink", "true");
expect(
screen.getByLabelText(
t("global:components.edit_location_map.display_location_label")
)
t("global:components.edit_location_map.display_location_label"),
),
).toHaveValue("test city, test country");
await waitFor(() => {
expect(
screen
.getByRole("combobox")
.classList.contains("MuiAutocomplete-loading")
.classList.contains("MuiAutocomplete-loading"),
).toBe(false);
expect(updateLocation).toHaveBeenCalledTimes(1);
});
Expand Down
Loading