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

Update npm dependencies to latest versions #1378

Merged
merged 5 commits into from
Mar 5, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ root.render(
<AppBase />
</AironeSnackbarProvider>
</ThemeProvider>
</StrictMode>
</StrictMode>,
);
4 changes: 2 additions & 2 deletions frontend/src/ErrorHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ const ErrorBridge: FC<{ children: React.ReactNode }> = ({ children }) => {
}
dispatchError(event.reason);
},
[]
[],
);

useEffect(() => {
window.addEventListener("unhandledrejection", handleUnhandledRejection);
return () => {
window.removeEventListener(
"unhandledrejection",
handleUnhandledRejection
handleUnhandledRejection,
);
};
}, [handleUnhandledRejection]);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/acl/ACLForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ test("should render a component with essential props", function () {
expect(() =>
render(<Wrapper />, {
wrapper: TestWrapper,
})
}),
).not.toThrow();
});
8 changes: 4 additions & 4 deletions frontend/src/components/acl/ACLHistoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ export const ACLHistoryList: FC<Props> = ({ histories }) => {
</StyledTableCell>
<StyledTableCell>
{change.before != null
? ACLTypeLabels[
? (ACLTypeLabels[
change.before as ACLType
] ?? "不明"
] ?? "不明")
: "-"}
</StyledTableCell>
<StyledTableCell>
{change.after != null
? ACLTypeLabels[
? (ACLTypeLabels[
change.after as ACLType
] ?? "不明"
] ?? "不明")
: "-"}
</StyledTableCell>
</>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/acl/aclForm/ACLFormSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ export const schema = schemaForType<ACLForm>()(
name: z.string(),
description: z.string(),
currentPermission: z.number(),
})
}),
),
})
.superRefine(({ isPublic, defaultPermission, roles }, ctx) => {
const isDefaultPermissionFull =
defaultPermission != null && defaultPermission === ACLType.Full;
const isSomeRolesFull = roles.some(
(r) => r.currentPermission === ACLType.Full
(r) => r.currentPermission === ACLType.Full,
);

if (!isPublic && !isDefaultPermissionFull && !isSomeRolesFull) {
Expand All @@ -52,7 +52,7 @@ export const schema = schemaForType<ACLForm>()(
} にしてください`,
});
}
})
}),
);

export type Schema = z.infer<typeof schema>;
2 changes: 1 addition & 1 deletion frontend/src/components/category/CategoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const CategoryList: FC<Props> = ({ isEdit = false }) => {
onKeyPress={(e) => {
e.key === "Enter" &&
handleChangeQuery(
normalizeToMatch((e.target as HTMLInputElement).value ?? "")
normalizeToMatch((e.target as HTMLInputElement).value ?? ""),
);
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ export const schema = schemaForType<CategoryList>()(
z.object({
id: z.number(),
name: z.string(),
})
}),
)
.default([]),
//priority: z.number().default(0).refine((v) => Number(v)),
priority: z.coerce.number(),
})
}),
);

export type Schema = z.infer<typeof schema>;
2 changes: 1 addition & 1 deletion frontend/src/components/common/AironeLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { styled } from "@mui/material/styles";
import { Link, LinkProps } from "react-router";

export const AironeLink: React.ComponentType<LinkProps> = styled(
Link
Link,
)<LinkProps>(({ theme }) => ({
color: theme.palette.primary.main,
textDecoration: "none",
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/common/AutocompleteWithAllSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type SelectorOption = "select-all" | "remove-all";
interface Props<
T,
DisableClearable extends boolean | undefined = undefined,
FreeSolo extends boolean | undefined = undefined
FreeSolo extends boolean | undefined = undefined,
> extends AutocompleteProps<
T | SelectorOption,
true,
Expand All @@ -41,14 +41,14 @@ interface Props<
export const AutocompleteWithAllSelector = <
T,
DisableClearable extends boolean | undefined = undefined,
FreeSolo extends boolean | undefined = undefined
FreeSolo extends boolean | undefined = undefined,
>({
selectAllLabel,
...autocompleteProps
}: Props<T | SelectorOption, DisableClearable, FreeSolo>) => {
if (!autocompleteProps.multiple) {
throw new Error(
"AutocompleteWithAllSelector supports only multiple options"
"AutocompleteWithAllSelector supports only multiple options",
);
}

Expand Down Expand Up @@ -91,14 +91,14 @@ export const AutocompleteWithAllSelector = <
value: Array<
T | AutocompleteFreeSoloValueMapping<FreeSolo> | SelectorOption
>,
reason: AutocompleteChangeReason
reason: AutocompleteChangeReason,
): void => {
if (onChange == null) return;

if (value.find((v) => v === "select-all") != null) {
const newValueBase = value.filter((v) => v !== "select-all");
const newElements = filterOptionResult.current.results.filter(
(v) => !newValueBase.includes(v)
(v) => !newValueBase.includes(v),
);
return onChange(event, newValueBase.concat(newElements), reason);
} else if (value.find((v) => v === "remove-all") != null) {
Expand All @@ -110,7 +110,7 @@ export const AutocompleteWithAllSelector = <

const optionRenderer = (
props: HTMLAttributes<HTMLLIElement>,
option: T | SelectorOption
option: T | SelectorOption,
) => {
switch (option) {
case "select-all":
Expand All @@ -128,7 +128,7 @@ export const AutocompleteWithAllSelector = <

const filterOptions = (
options: Array<T | SelectorOption>,
params: FilterOptionsState<T | SelectorOption>
params: FilterOptionsState<T | SelectorOption>,
): (T | SelectorOption)[] => {
const filtered = filter(options, params);

Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/common/FlexBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ type StyledBoxProps = BoxProps & {
};

export const FlexBox: React.ComponentType<StyledBoxProps> = styled(
Box
Box,
)<StyledBoxProps>({
display: "flex",
}) as React.ComponentType<StyledBoxProps>;

export const BetweenAlignedBox: React.ComponentType<StyledBoxProps> = styled(
FlexBox
FlexBox,
)<StyledBoxProps>({
justifyContent: "space-between",
}) as React.ComponentType<StyledBoxProps>;

export const RightAlignedBox: React.ComponentType<StyledBoxProps> = styled(
FlexBox
FlexBox,
)<StyledBoxProps>({
justifyContent: "end",
}) as React.ComponentType<StyledBoxProps>;

export const CenterAlignedBox: React.ComponentType<StyledBoxProps> = styled(
FlexBox
FlexBox,
)<StyledBoxProps>({
justifyContent: "center",
}) as React.ComponentType<StyledBoxProps>;
5 changes: 3 additions & 2 deletions frontend/src/components/common/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const Header: FC = () => {
const [userAnchorEl, setUserAnchorEl] = useState<HTMLButtonElement | null>();
const [jobAnchorEl, setJobAnchorEl] = useState<HTMLButtonElement | null>();
const [latestCheckDate, setLatestCheckDate] = useState<Date | null>(
getLatestCheckDate()
getLatestCheckDate(),
);
const [recentJobs, setRecentJobs] = useState<Array<JobSerializers>>([]);

Expand All @@ -138,7 +138,8 @@ export const Header: FC = () => {

const uncheckedJobsCount = useMemo(() => {
return latestCheckDate != null
? recentJobs.filter((job) => job.createdAt > latestCheckDate).length ?? 0
? (recentJobs.filter((job) => job.createdAt > latestCheckDate).length ??
0)
: recentJobs.length;
}, [latestCheckDate, recentJobs]);

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/common/ImportForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("ImportForm", () => {
});

expect(
screen.queryByText("ファイルのアップロードに失敗しました")
screen.queryByText("ファイルのアップロードに失敗しました"),
).not.toBeInTheDocument();
});
});
4 changes: 2 additions & 2 deletions frontend/src/components/common/ImportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export const ImportForm: FC<Props> = ({ handleImport, handleCancel }) => {
if (e instanceof Error && isResponseError(e)) {
const reportableError = await toReportableNonFieldErrors(e);
setErrorMessage(
`ファイルのアップロードに失敗しました: ${reportableError ?? ""}`
`ファイルのアップロードに失敗しました: ${reportableError ?? ""}`,
);
enqueueSnackbar(
`ファイルのアップロードに失敗しました: ${reportableError ?? ""}`,
{
variant: "error",
}
},
);
} else {
setErrorMessage("ファイルのアップロードに失敗しました。");
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/components/common/PaginationFooter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ describe("PaginationFooter", () => {
page={c.page}
changePage={changePage}
/>,
{ wrapper: TestWrapper }
{ wrapper: TestWrapper },
);

expect(screen.getByText(c.expected)).toBeInTheDocument();
})
}),
);

test("check change page handler", () => {
Expand All @@ -68,19 +68,19 @@ describe("PaginationFooter", () => {
page={1}
changePage={changePage}
/>,
{ wrapper: TestWrapper }
{ wrapper: TestWrapper },
);

expect(screen.getByRole("button", { name: "page 1" })).toBeInTheDocument();
expect(
screen.getByRole("button", { name: "Go to page 2" })
screen.getByRole("button", { name: "Go to page 2" }),
).toBeInTheDocument();
expect(
screen.getByRole("button", { name: "Go to page 3" })
screen.getByRole("button", { name: "Go to page 3" }),
).toBeInTheDocument();
expect(screen.getByText("…")).toBeInTheDocument();
expect(
screen.getByRole("button", { name: "Go to page 34" })
screen.getByRole("button", { name: "Go to page 34" }),
).toBeInTheDocument();

// change page
Expand All @@ -98,19 +98,19 @@ describe("PaginationFooter", () => {
page={2}
changePage={changePage}
/>,
{ wrapper: TestWrapper }
{ wrapper: TestWrapper },
);

expect(
screen.getByRole("button", { name: "Go to page 1" })
screen.getByRole("button", { name: "Go to page 1" }),
).toBeInTheDocument();
expect(screen.getByRole("button", { name: "page 2" })).toBeInTheDocument();
expect(
screen.getByRole("button", { name: "Go to page 3" })
screen.getByRole("button", { name: "Go to page 3" }),
).toBeInTheDocument();
expect(screen.getByText("…")).toBeInTheDocument();
expect(
screen.getByRole("button", { name: "Go to page 34" })
screen.getByRole("button", { name: "Go to page 34" }),
).toBeInTheDocument();
});
});
2 changes: 1 addition & 1 deletion frontend/src/components/common/PaginationFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const PaginationFooter: FC<Props> = ({
<Typography>
{`${Math.min(maxRowCount * (page - 1) + 1, count)} - ${Math.min(
maxRowCount * page,
count
count,
)} / ${count} 件`}
</Typography>
<Stack spacing={2}>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/common/RateLimitedClickable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("RateLimitedClickable", () => {
</RateLimitedClickable>,
{
wrapper: TestWrapper,
}
},
);

// multiple handler calls
Expand All @@ -45,7 +45,7 @@ describe("RateLimitedClickable", () => {
</RateLimitedClickable>,
{
wrapper: TestWrapper,
}
},
);

// multiple handler calls
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/common/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type StyledTableCellProps = TableCellProps & {
};

export const HeaderTableRow: React.ComponentType<StyledTableRowProps> = styled(
TableRow
TableRow,
)<StyledTableRowProps>({
backgroundColor: "#455A64",
}) as React.ComponentType<StyledTableRowProps>;
Expand All @@ -29,7 +29,7 @@ export const HeaderTableCell: React.ComponentType<StyledTableCellProps> =
}) as React.ComponentType<StyledTableCellProps>;

export const StyledTableRow: React.ComponentType<StyledTableRowProps> = styled(
TableRow
TableRow,
)<StyledTableRowProps>({
"& td": {
padding: "8px",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/entity/EntityControlMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test("should render with essential props", () => {
}}
setOpenImportModal={() => false}
/>,
{ wrapper: TestWrapper }
)
{ wrapper: TestWrapper },
),
).not.toThrow();
});
Loading
Loading