chore: upgrade prettier to v3 (#644)

## Description

This PR addresses the following improvements:

**Unify Prettier Version**: Currently, the Prettier version used in
`/package.json` and `/codex-cli/package.json` are different. In this PR,
we're updating both to use Prettier v3.

- Prettier v3 introduces improved support for JavaScript and TypeScript.
(e.g. the formatting scenario shown in the image below. This is more
aligned with the TypeScript indentation standard).

<img width="1126" alt="image"
src="https://github.com/user-attachments/assets/6e237eb8-4553-4574-b336-ed9561c55370"
/>

**Add Prettier Auto-Formatting in lint-staged**: We've added a step to
automatically run prettier --write on JavaScript and TypeScript files as
part of the lint-staged process, before the ESLint checks.

- This will help ensure that all committed code is properly formatted
according to the project's Prettier configuration.
This commit is contained in:
Luci
2025-04-25 22:21:50 +08:00
committed by GitHub
parent bfe6fac463
commit a9ecb2efce
24 changed files with 65 additions and 70 deletions

View File

@@ -26,7 +26,7 @@ vi.mock("openai", () => {
vi.mock("../src/approvals.js", () => ({
__esModule: true,
alwaysApprovedCommands: new Set<string>(),
canAutoApprove: () => ({ type: "auto-approve", runInSandbox: false } as any),
canAutoApprove: () => ({ type: "auto-approve", runInSandbox: false }) as any,
isSafeCommand: () => null,
}));
@@ -62,7 +62,7 @@ describe("AgentLoop generic network/server errors", () => {
approvalPolicy: { mode: "auto" } as any,
onItem: (i) => received.push(i),
onLoading: () => {},
getCommandConfirmation: async () => ({ review: "yes" } as any),
getCommandConfirmation: async () => ({ review: "yes" }) as any,
onLastResponseId: () => {},
});
@@ -106,7 +106,7 @@ describe("AgentLoop generic network/server errors", () => {
approvalPolicy: { mode: "auto" } as any,
onItem: (i) => received.push(i),
onLoading: () => {},
getCommandConfirmation: async () => ({ review: "yes" } as any),
getCommandConfirmation: async () => ({ review: "yes" }) as any,
onLastResponseId: () => {},
});