Skip to content

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Oct 16, 2025

close #5604

Summary by CodeRabbit

  • New Features

    • Added a CI format-check step to verify code style during builds.
  • Chores

    • Introduced a new code formatter and config; added formatter tooling and a fmtcheck script.
    • Updated lint tooling and workspace package listings.
    • Removed unused dev dependencies and adjusted templates.
  • Style

    • Normalized formatting and minor style cleanups across tests and config.

@fengmk2 fengmk2 requested a review from Copilot October 16, 2025 13:35
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds Oxfmt formatting support and config, updates CI to run a format check, swaps formatting tooling in package/lint configs, adjusts workspace dependencies, and applies minor formatting edits and dependency tweaks across templates and plugin manifests.

Changes

Cohort / File(s) Summary
Formatter & CI
.oxfmtrc.json, .github/workflows/ci.yml, package.json, pnpm-workspace.yaml
Adds .oxfmtrc.json with formatting rules; adds fmtcheck script and oxfmt devDependency; updates lint-staged to use oxfmt/oxlint; adds CI step "Run format check" executing pnpm run fmtcheck; updates workspace deps (add oxfmt, bump oxlint).
Formatting-only edits
packages/cluster/src/utils/mode/base/agent.ts, packages/cluster/src/utils/mode/base/app.ts, packages/koa/test/application/index.test.ts, site/.vitepress/config.mts, tools/egg-bin/test/commands/cov.test.ts
Reflow/compact parameter destructuring, single-line call formatting, minor whitespace/blank-line edits — no behavioral/API changes.
Dependency / template updates
plugins/mock/package.json, tools/create-egg/src/templates/egg3-tegg/package.json, tools/create-egg/src/templates/tegg/package.json
Removes several @eggjs/tegg* devDependencies from plugins/mock; removes duplicate egg-scripts entry in egg3-tegg template; changes @eggjs/scripts version in tegg template to beta.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer / PR
  participant CI as GitHub Actions (ci.yml)
  participant TypecheckJob as typecheck job
  participant Lint as Lint/Dedupe/Typecheck steps
  participant FmtCheck as "Run format check" (pnpm run fmtcheck)
  participant Build as Build step

  Dev->>CI: push PR
  CI->>TypecheckJob: start
  TypecheckJob->>Lint: run lint/dedupe/typecheck
  Lint-->>TypecheckJob: success
  TypecheckJob->>FmtCheck: run pnpm run fmtcheck
  alt fmtcheck succeeds
    FmtCheck-->>TypecheckJob: success
  else fmtcheck fails
    FmtCheck-->>TypecheckJob: fallback echo "fmtcheck failed, ignore before it stable"
  end
  TypecheckJob->>Build: proceed to build
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • Dependency Dashboard #5439 — changes touch dependency and CI configuration for formatter/linter (package.json, pnpm-workspace.yaml, CI), likely related to migrating formatting tooling.

Possibly related PRs

Poem

🐰
I hopped through diffs with nimble feet,
Replaced the clamps of Prettier neat,
Oxfmt laid out rules so fine,
CI now checks each formatted line,
A little rabbit cheers—code looks divine!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The PR contains multiple out-of-scope changes unrelated to replacing Prettier with oxfmt. These include: removing @eggjs/tegg, @eggjs/tegg-config, @eggjs/tegg-controller-plugin, and @eggjs/tegg-plugin from plugins/mock/package.json and pnpm-workspace.yaml; modifying tools/create-egg templates (egg3-tegg and tegg package.json versions); and updating oxlint from ^1.22.0 to ^1.23.0. These changes appear disconnected from the primary objective of the formatter migration and should either be removed or addressed in separate PRs. Review and separate the out-of-scope changes into their own pull requests. The PR should focus solely on the oxfmt/prettier migration. Remove the dependency removals from plugins/mock/package.json and pnpm-workspace.yaml, revert template package.json modifications, and clarify whether the oxlint version bump is intentional and related to this migration. If these changes are necessary, they should be justified or handled separately.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "chore: use oxfmt instead of prettier" is concise, specific, and clearly summarizes the main objective of the pull request. It directly describes the primary change: replacing Prettier with oxfmt as the code formatter. The title follows conventional commit format and provides sufficient context for someone reviewing the repository history to understand the changeset's purpose without being vague or generic.
Linked Issues Check ✅ Passed The PR successfully addresses the linked issue #5604 objective to replace Prettier with oxfmt. Key implementation details are present: adding oxfmt as a dev dependency, creating the .oxfmtrc.json configuration file, adding the fmtcheck script, updating lint-staged to use oxfmt for code files instead of prettier, updating the CI workflow to run format checks, and adding oxfmt to the pnpm workspace catalog. The various formatting changes throughout the codebase are consistent with this transition.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch oxfmt

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34a8308 and 3353a7e.

📒 Files selected for processing (1)
  • pnpm-workspace.yaml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
pnpm-workspace.yaml

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Define dependency versions via the catalog section in pnpm-workspace.yaml and reference them with "catalog:"

Use pnpm catalog mode: dependencies declared in pnpm-workspace.yaml catalog and referenced as "catalog:" in package manifests

Files:

  • pnpm-workspace.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: Test (ubuntu-latest, 24, 4/5)
  • GitHub Check: Test (macos-latest, 24, 5/5)
  • GitHub Check: Test (macos-latest, 22, 1/5)
  • GitHub Check: Test (macos-latest, 24, 4/5)
  • GitHub Check: Test (macos-latest, 24, 1/5)
  • GitHub Check: Test (ubuntu-latest, 22, 4/5)
  • GitHub Check: Test (ubuntu-latest, 22, 3/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 0/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 2/5)
  • GitHub Check: Test bin (windows-latest, 22, 2/5)
  • GitHub Check: Test bin (windows-latest, 22, 3/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 1/5)
  • GitHub Check: Test bin (windows-latest, 22, 1/5)
  • GitHub Check: Test bin (windows-latest, 22, 0/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 5/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 4/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 3/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 1/5)
  • GitHub Check: typecheck
🔇 Additional comments (1)
pnpm-workspace.yaml (1)

150-150: ✅ Oxfmt catalog entry aligns with PR objective.

Adding oxfmt: ^0.5.0 to the catalog correctly supports the migration from Prettier to oxfmt formatting. This version matches the latest stable release.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces Prettier with oxfmt as the code formatter for the Eggjs monorepo. The change introduces oxfmt configuration and adds a format check step to the CI pipeline while maintaining Prettier as a dependency (likely for backward compatibility or gradual migration).

Key changes:

  • Adds oxfmt as a new dependency with configuration file
  • Introduces a new fmtcheck script to validate code formatting in CI
  • Applies formatting changes (blank line addition) to existing test files

Reviewed Changes

Copilot reviewed 5 out of 37 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Adds oxfmt v0.5.0 to the catalog of shared dependencies
package.json Adds oxfmt as a dev dependency and introduces fmtcheck script
.oxfmtrc.json Configures oxfmt with project-specific formatting rules (2-space indent, 120 line width, single quotes, etc.)
.github/workflows/ci.yml Adds format check step to CI pipeline before the build step
tools/egg-bin/test/commands/cov.test.ts Adds blank line (formatting change applied by oxfmt)
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@codecov
Copy link

codecov bot commented Oct 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.93%. Comparing base (291e2da) to head (3353a7e).
⚠️ Report is 1 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #5617   +/-   ##
=======================================
  Coverage   80.93%   80.93%           
=======================================
  Files         266      266           
  Lines        6526     6526           
  Branches      948      948           
=======================================
  Hits         5282     5282           
  Misses       1165     1165           
  Partials       79       79           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@socket-security
Copy link

socket-security bot commented Oct 16, 2025

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

logger,
messenger,
}: {
{ log, logger, messenger }: {
Copy link
Member Author

Choose a reason for hiding this comment

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

prettier format should be better

@fengmk2 fengmk2 requested a review from Copilot October 17, 2025 10:32
@fengmk2 fengmk2 marked this pull request as ready for review October 17, 2025 10:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 9 out of 41 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/cluster/src/utils/mode/base/app.ts (1)

96-104: Constructor param typing reflowed; behavior intact.

No issues. Optional: extract a named BaseAppUtilsInit type for the second param to aid reuse and public API stability across base/agent utils.

.github/workflows/ci.yml (1)

51-53: Suggested refactor is valid and aligns with GitHub Actions best practices; no blocking issues found.

The verification confirms:

  • scripts.fmtcheck exists and is properly wired: oxfmt --check .
  • oxfmt and oxlint are configured via pnpm catalog + lint-staged
  • No downstream steps depend on fmtcheck outcome; all subsequent steps (build, site:build) are unconditional

Both the current || echo approach and the proposed continue-on-error approach allow the job to proceed even if fmtcheck fails. However, the refactored version is clearer and more maintainable:

  • Makes failure explicit in workflow UI rather than masking it
  • Enables structured, conditional handling of outcomes
  • Follows GitHub Actions documented patterns

The review comment's suggestion is sound and recommended.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 291e2da and aeaeb1a.

⛔ Files ignored due to path filters (32)
  • packages/core/test/fixtures/agent/node_modules/a/app/extend/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/agent/node_modules/b/app/extend/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/application/node_modules/a/app/extend/application.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/application/node_modules/b/app/extend/application.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/extend/node_modules/b/app/extend/request.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/extend/node_modules/b/app/extend/response.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/helper/node_modules/a/app/extend/helper.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/helper/node_modules/b/app/extend/helper.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/a/app/middleware/a.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/a/app/middleware/custom.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/b/app/middleware/b.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/b/app/middleware/custom.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/b/app/middleware/status.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin-pkg-exports/node_modules/a/foo_dist/esm/config/config.default.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/a/app.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/b/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/b/app.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/b/app/service/bar2.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/c/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/c/app.js is excluded by !**/node_modules/**
  • packages/egg/test/fixtures/apps/loader-plugin/node_modules/a/app.js is excluded by !**/node_modules/**
  • packages/egg/test/fixtures/apps/loader-plugin/node_modules/b/app.js is excluded by !**/node_modules/**
  • packages/egg/test/fixtures/apps/loader-plugin/node_modules/b/app/service/bar2.js is excluded by !**/node_modules/**
  • packages/egg/test/fixtures/apps/loader-plugin/node_modules/c/app.js is excluded by !**/node_modules/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • tools/egg-bin/test/fixtures/demo-app-esm/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/demo-app/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/egg-require/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/egg-revert/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/example-declarations/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/example-ts-cluster/node_modules/egg/index.js is excluded by !**/node_modules/**
  • tools/scripts/test/fixtures/pkg-config-esm/node_modules/custom-framework/index.js is excluded by !**/node_modules/**
📒 Files selected for processing (9)
  • .github/workflows/ci.yml (1 hunks)
  • .oxfmtrc.json (1 hunks)
  • package.json (3 hunks)
  • packages/cluster/src/utils/mode/base/agent.ts (1 hunks)
  • packages/cluster/src/utils/mode/base/app.ts (1 hunks)
  • packages/koa/test/application/index.test.ts (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
  • site/.vitepress/config.mts (1 hunks)
  • tools/egg-bin/test/commands/cov.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use TypeScript for all source files in packages (no JavaScript source files)

Files:

  • packages/cluster/src/utils/mode/base/app.ts
  • packages/cluster/src/utils/mode/base/agent.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable

Files:

  • packages/cluster/src/utils/mode/base/app.ts
  • packages/koa/test/application/index.test.ts
  • tools/egg-bin/test/commands/cov.test.ts
  • packages/cluster/src/utils/mode/base/agent.ts
{packages,plugins,tools}/**/src/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

{packages,plugins,tools}/**/src/**/*.ts: All exported functions, methods, and getters must have explicit return type annotations (isolatedDeclarations)
Avoid computed property names with symbols in class declarations; prefer explicit methods (isolatedDeclarations)
Provide explicit type annotations for class properties when needed (do not rely on implicit inference for exported members)
Exported symbol constants must be annotated with unique symbol type

Files:

  • packages/cluster/src/utils/mode/base/app.ts
  • packages/cluster/src/utils/mode/base/agent.ts
packages/**/test/**/*.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

packages/**/test/**/*.test.ts: Name test files as test/**/*.test.ts and run them with Vitest
Use import { describe, it } from 'vitest' in tests
Use Node.js built-in assert module for test assertions

Files:

  • packages/koa/test/application/index.test.ts
**/test/**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/test/**/*.test.ts: Place test suites following Vitest discovery: /test//*.test.ts
Mirror the repository test pattern when adding new suites

Test files should follow the pattern test/**/*.test.ts

Files:

  • packages/koa/test/application/index.test.ts
  • tools/egg-bin/test/commands/cov.test.ts
{packages,plugins}/**/test/**/*.test.ts

📄 CodeRabbit inference engine (CLAUDE.md)

For Vitest packages, import tests from 'vitest' and use Node's built-in assert for assertions

Files:

  • packages/koa/test/application/index.test.ts
tools/egg-bin/test/**/*.test.ts

📄 CodeRabbit inference engine (CLAUDE.md)

egg-bin tests use Mocha; test files should be under test/**/*.test.ts

Files:

  • tools/egg-bin/test/commands/cov.test.ts
{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}

📄 CodeRabbit inference engine (CLAUDE.md)

{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}: All packages must require Node.js >= 22.18.0 via the engines.node field
Each package must include scripts: typecheck as "tsc --noEmit" and lint as "oxlint --type-aware"
External dependencies should reference catalog entries using "catalog:" and internal workspace dependencies should use "workspace:*"

Files:

  • package.json
pnpm-workspace.yaml

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Define dependency versions via the catalog section in pnpm-workspace.yaml and reference them with "catalog:"

Use pnpm catalog mode: dependencies declared in pnpm-workspace.yaml catalog and referenced as "catalog:" in package manifests

Files:

  • pnpm-workspace.yaml
🧠 Learnings (2)
📚 Learning: 2025-10-15T12:53:09.198Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-15T12:53:09.198Z
Learning: Applies to {package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json} : Each package must include scripts: typecheck as "tsc --noEmit" and lint as "oxlint --type-aware"

Applied to files:

  • package.json
📚 Learning: 2025-09-18T07:56:17.417Z
Learnt from: CR
PR: eggjs/egg#0
File: AGENTS.md:0-0
Timestamp: 2025-09-18T07:56:17.417Z
Learning: Applies to **/*.ts : Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)

Applied to files:

  • .oxfmtrc.json
🪛 Biome (2.1.2)
.oxfmtrc.json

[error] 6-6: Expected a property but instead found '// "jsxQuoteStyle": "double",'.

Expected a property here.

(parse)


[error] 7-7: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 7-7: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 7-7: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 7-7: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 8-8: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 8-8: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 8-8: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 8-9: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 11-23: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: Test (macos-latest, 24, 4/5)
  • GitHub Check: Test (macos-latest, 22, 5/5)
  • GitHub Check: Test (macos-latest, 24, 1/5)
  • GitHub Check: Test (macos-latest, 22, 4/5)
  • GitHub Check: Test (windows-latest, 24, 1/5)
  • GitHub Check: Test (windows-latest, 22, 3/5)
  • GitHub Check: Test (windows-latest, 22, 5/5)
  • GitHub Check: Test (macos-latest, 24, 3/5)
  • GitHub Check: Test (windows-latest, 22, 2/5)
  • GitHub Check: Test bin (windows-latest, 22, 0/5)
  • GitHub Check: Test bin (windows-latest, 22, 1/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 0/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 1/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 2/5)
  • GitHub Check: Test bin (windows-latest, 22, 2/5)
  • GitHub Check: Test bin (windows-latest, 22, 3/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 3/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 4/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 1/5)
  • GitHub Check: typecheck
🔇 Additional comments (8)
tools/egg-bin/test/commands/cov.test.ts (1)

164-176: Formatting-only; no behavior change. LGTM.

packages/koa/test/application/index.test.ts (1)

143-147: Formatting-only; behavior unchanged. LGTM.

site/.vitepress/config.mts (1)

18-21: Inline head meta entries — OK.

Cosmetic reformat aligning with oxfmt; no behavior change.

pnpm-workspace.yaml (1)

154-155: Catalog entries correctly added for oxfmt migration.

The oxfmt and updated oxlint versions are properly added to the catalog and follow the established pattern for workspace-managed dependencies.

packages/cluster/src/utils/mode/base/agent.ts (1)

66-72: Formatting change consistent with oxfmt standards.

The constructor parameter destructuring has been reformatted to align with oxfmt's style guidelines. No logic or type information has changed, and this aligns with the tooling migration objectives.

package.json (2)

22-22: oxfmt integration correctly added to dependencies and scripts.

The oxfmt catalog dependency and fmtcheck script properly support the migration to oxfmt as the primary formatter.

Also applies to: 38-38


65-72: Lint-staged configuration properly refactored for oxfmt/oxlint toolchain.

The lint-staged rules have been split into two patterns: non-code files continue using Prettier, while TypeScript/JavaScript files are now routed through oxfmt and oxlint. This separation aligns with the PR objectives and maintains consistency with the workspace's linting strategy.

Please verify that the negated glob pattern !(*.{ts,mts,cts,js,mjs,cjs,jsx,tsx}) works reliably across your CI/CD environments (GitHub Actions, local development, etc.), as complex glob negation can behave inconsistently across different shells and platforms.

.oxfmtrc.json (1)

1-23: Review comment verified as correct.

The review accurately identifies the problem: the .oxfmtrc.json file contains JSON comments (lines 6, 9, 11–22), which violates the JSON specification and will cause parse failure. The two solutions provided are both valid:

  1. Remove all comments (as shown in the diff)
  2. Rename the file to .oxfmtrc.jsonc to enable JSONC format—oxfmt v0.5.0+ supports .oxfmtrc.jsonc configuration files with comments

The developer now has clear, actionable guidance to resolve the invalid configuration file.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/cluster/src/utils/mode/base/agent.ts (1)

66-73: Formatting change conflicts with previous review feedback.

A past review comment on Line 68 stated "prettier format should be better," yet this PR reformats the constructor parameter destructuring to a single-line style via oxfmt. While this aligns with the PR's objective to migrate to oxfmt, please confirm that the previous preference for multi-line formatting is no longer applicable, or consider adjusting the oxfmt configuration if multi-line parameter destructuring should be preserved for readability.

Based on past review comments.

🧹 Nitpick comments (1)
package.json (1)

66-72: Simplify the negated glob pattern in lint-staged.

The negated glob pattern !(*.{ts,mts,cts,js,mjs,cjs,jsx,tsx}) on Line 66 may not work consistently across different environments and shells. This was previously flagged as complex.

Consider explicitly listing the file extensions that should use Prettier instead of using negation:

-    "!(*.{ts,mts,cts,js,mjs,cjs,jsx,tsx})": [
+    "*.{json,md,yml,yaml,html,xml,css,scss}": [
       "prettier --ignore-unknown --write"
     ],

This approach is more explicit and portable. Adjust the extensions list based on the non-code file types in your repository.

Based on past review comments.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 291e2da and 34a8308.

⛔ Files ignored due to path filters (32)
  • packages/core/test/fixtures/agent/node_modules/a/app/extend/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/agent/node_modules/b/app/extend/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/application/node_modules/a/app/extend/application.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/application/node_modules/b/app/extend/application.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/extend/node_modules/b/app/extend/request.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/extend/node_modules/b/app/extend/response.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/helper/node_modules/a/app/extend/helper.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/helper/node_modules/b/app/extend/helper.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/a/app/middleware/a.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/a/app/middleware/custom.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/b/app/middleware/b.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/b/app/middleware/custom.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/middleware-override/node_modules/b/app/middleware/status.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin-pkg-exports/node_modules/a/foo_dist/esm/config/config.default.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/a/app.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/b/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/b/app.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/b/app/service/bar2.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/c/agent.js is excluded by !**/node_modules/**
  • packages/core/test/fixtures/plugin/node_modules/c/app.js is excluded by !**/node_modules/**
  • packages/egg/test/fixtures/apps/loader-plugin/node_modules/a/app.js is excluded by !**/node_modules/**
  • packages/egg/test/fixtures/apps/loader-plugin/node_modules/b/app.js is excluded by !**/node_modules/**
  • packages/egg/test/fixtures/apps/loader-plugin/node_modules/b/app/service/bar2.js is excluded by !**/node_modules/**
  • packages/egg/test/fixtures/apps/loader-plugin/node_modules/c/app.js is excluded by !**/node_modules/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • tools/egg-bin/test/fixtures/demo-app-esm/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/demo-app/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/egg-require/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/egg-revert/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/example-declarations/node_modules/aliyun-egg/index.js is excluded by !**/node_modules/**
  • tools/egg-bin/test/fixtures/example-ts-cluster/node_modules/egg/index.js is excluded by !**/node_modules/**
  • tools/scripts/test/fixtures/pkg-config-esm/node_modules/custom-framework/index.js is excluded by !**/node_modules/**
📒 Files selected for processing (12)
  • .github/workflows/ci.yml (1 hunks)
  • .oxfmtrc.json (1 hunks)
  • package.json (3 hunks)
  • packages/cluster/src/utils/mode/base/agent.ts (1 hunks)
  • packages/cluster/src/utils/mode/base/app.ts (1 hunks)
  • packages/koa/test/application/index.test.ts (1 hunks)
  • plugins/mock/package.json (0 hunks)
  • pnpm-workspace.yaml (1 hunks)
  • site/.vitepress/config.mts (1 hunks)
  • tools/create-egg/src/templates/egg3-tegg/package.json (0 hunks)
  • tools/create-egg/src/templates/tegg/package.json (1 hunks)
  • tools/egg-bin/test/commands/cov.test.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • plugins/mock/package.json
  • tools/create-egg/src/templates/egg3-tegg/package.json
🧰 Additional context used
📓 Path-based instructions (9)
{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}

📄 CodeRabbit inference engine (CLAUDE.md)

{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}: All packages must require Node.js >= 22.18.0 via the engines.node field
Each package must include scripts: typecheck as "tsc --noEmit" and lint as "oxlint --type-aware"
External dependencies should reference catalog entries using "catalog:" and internal workspace dependencies should use "workspace:*"

Files:

  • tools/create-egg/src/templates/tegg/package.json
  • package.json
packages/**/test/**/*.test.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

packages/**/test/**/*.test.ts: Name test files as test/**/*.test.ts and run them with Vitest
Use import { describe, it } from 'vitest' in tests
Use Node.js built-in assert module for test assertions

Files:

  • packages/koa/test/application/index.test.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable

Files:

  • packages/koa/test/application/index.test.ts
  • packages/cluster/src/utils/mode/base/agent.ts
  • packages/cluster/src/utils/mode/base/app.ts
  • tools/egg-bin/test/commands/cov.test.ts
**/test/**/*.test.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/test/**/*.test.ts: Place test suites following Vitest discovery: /test//*.test.ts
Mirror the repository test pattern when adding new suites

Test files should follow the pattern test/**/*.test.ts

Files:

  • packages/koa/test/application/index.test.ts
  • tools/egg-bin/test/commands/cov.test.ts
{packages,plugins}/**/test/**/*.test.ts

📄 CodeRabbit inference engine (CLAUDE.md)

For Vitest packages, import tests from 'vitest' and use Node's built-in assert for assertions

Files:

  • packages/koa/test/application/index.test.ts
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use TypeScript for all source files in packages (no JavaScript source files)

Files:

  • packages/cluster/src/utils/mode/base/agent.ts
  • packages/cluster/src/utils/mode/base/app.ts
{packages,plugins,tools}/**/src/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

{packages,plugins,tools}/**/src/**/*.ts: All exported functions, methods, and getters must have explicit return type annotations (isolatedDeclarations)
Avoid computed property names with symbols in class declarations; prefer explicit methods (isolatedDeclarations)
Provide explicit type annotations for class properties when needed (do not rely on implicit inference for exported members)
Exported symbol constants must be annotated with unique symbol type

Files:

  • packages/cluster/src/utils/mode/base/agent.ts
  • packages/cluster/src/utils/mode/base/app.ts
pnpm-workspace.yaml

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Define dependency versions via the catalog section in pnpm-workspace.yaml and reference them with "catalog:"

Use pnpm catalog mode: dependencies declared in pnpm-workspace.yaml catalog and referenced as "catalog:" in package manifests

Files:

  • pnpm-workspace.yaml
tools/egg-bin/test/**/*.test.ts

📄 CodeRabbit inference engine (CLAUDE.md)

egg-bin tests use Mocha; test files should be under test/**/*.test.ts

Files:

  • tools/egg-bin/test/commands/cov.test.ts
🧠 Learnings (1)
📚 Learning: 2025-10-15T12:53:09.198Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-15T12:53:09.198Z
Learning: Applies to {package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json} : Each package must include scripts: typecheck as "tsc --noEmit" and lint as "oxlint --type-aware"

Applied to files:

  • package.json
🪛 Biome (2.1.2)
.oxfmtrc.json

[error] 6-6: Expected a property but instead found '// "jsxQuoteStyle": "double",'.

Expected a property here.

(parse)


[error] 7-7: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 7-7: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 7-7: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 7-7: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 8-8: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 8-8: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 8-8: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 8-9: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 10-10: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)


[error] 11-23: End of file expected

Use an array for a sequence of values: [1, 2]

(parse)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: Test (windows-latest, 24, 3/5)
  • GitHub Check: Test (macos-latest, 22, 5/5)
  • GitHub Check: Test (ubuntu-latest, 22, 3/5)
  • GitHub Check: Test (ubuntu-latest, 24, 1/5)
  • GitHub Check: Test (ubuntu-latest, 22, 2/5)
  • GitHub Check: Test (ubuntu-latest, 24, 4/5)
  • GitHub Check: Test (windows-latest, 24, 4/5)
  • GitHub Check: Test (ubuntu-latest, 22, 5/5)
  • GitHub Check: Test (macos-latest, 24, 5/5)
  • GitHub Check: Test (macos-latest, 22, 1/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 2/5)
  • GitHub Check: Test bin (windows-latest, 22, 3/5)
  • GitHub Check: Test bin (windows-latest, 22, 1/5)
  • GitHub Check: Test bin (windows-latest, 22, 0/5)
  • GitHub Check: Test bin (ubuntu-latest, 22, 1/5)
  • GitHub Check: Test bin (windows-latest, 22, 2/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 1/5)
  • GitHub Check: Test scripts (ubuntu-latest, 22, 3/5)
  • GitHub Check: typecheck
🔇 Additional comments (9)
site/.vitepress/config.mts (1)

18-18: Formatting changes look good.

The reformatting of meta tag entries from multi-line to single-line format is consistent with oxfmt conventions and maintains the same configuration semantics.

Also applies to: 20-20

tools/create-egg/src/templates/tegg/package.json (1)

26-26: LGTM! Dependency version alignment with beta.

The version change for @eggjs/scripts from ^4.0.0 to "beta" aligns with other @eggjs dependencies in this template, ensuring consistency across the generated project.

tools/egg-bin/test/commands/cov.test.ts (1)

164-164: LGTM! Minor formatting adjustment.

The added blank line improves readability and aligns with the new formatter configuration.

packages/cluster/src/utils/mode/base/app.ts (1)

96-104: LGTM! Formatting change consistent with oxfmt migration.

The constructor parameter destructuring has been reformatted to a single-line style, consistent with similar changes in packages/cluster/src/utils/mode/base/agent.ts. No functional changes.

packages/koa/test/application/index.test.ts (1)

143-147: LGTM! Test formatting refactored for consistency.

The createContext call has been reformatted to a single line while maintaining semantic equivalence. This aligns with the new formatter configuration.

.github/workflows/ci.yml (1)

51-52: LGTM! Graceful format check introduction with fallback.

The new format check step runs fmtcheck but includes a fallback that allows CI to pass even if formatting fails. This is a sensible approach for the migration period, allowing the team to gradually adopt oxfmt without blocking development.

Consider removing the fallback (|| echo "fmtcheck failed, ignore before it stable") once the codebase is fully formatted and the team is confident in the formatter configuration.

package.json (2)

22-22: LGTM! Oxfmt dependency added.

The oxfmt development dependency has been added from the catalog, aligning with the PR objective to migrate from Prettier to oxfmt.


38-38: LGTM! Format check script added.

The fmtcheck script runs oxfmt --check . to verify code formatting, which is used by the new CI workflow step.

.oxfmtrc.json (1)

6-22: The review comment is incorrect; Oxfmt supports comments in configuration files.

Oxfmt supports JSONC config files (you can use comments) and as of v0.5.0 it accepts both .oxfmtrc.json and .oxfmtrc.jsonc. The configuration file shown with comments will parse correctly—no changes are needed. The file is properly formatted for Oxfmt's configuration requirements.

Likely an incorrect or invalid review comment.

@fengmk2 fengmk2 merged commit 135e404 into next Oct 17, 2025
55 of 57 checks passed
@fengmk2 fengmk2 deleted the oxfmt branch October 17, 2025 14:05
@coderabbitai coderabbitai bot mentioned this pull request Oct 22, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use oxfmt instead of prettier

1 participant