Skip to content

feat: integrate @eggjs/tsconfig into monorepo with vitest#5460

Merged
fengmk2 merged 5 commits intonextfrom
tsconfig
Sep 13, 2025
Merged

feat: integrate @eggjs/tsconfig into monorepo with vitest#5460
fengmk2 merged 5 commits intonextfrom
tsconfig

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Sep 13, 2025

  • Merge @eggjs/tsconfig repository into packages/tsconfig/
  • Refactor package to use vitest testing framework instead of Node.js test runner
  • Update all consuming packages to use workspace:* dependency references
  • Add vitest configuration with coverage reporting
  • Convert test assertions from Node.js assert to vitest expect API
  • Update package.json scripts for vitest and oxlint
  • Remove external @eggjs/tsconfig catalog dependency in favor of workspace package

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Introduced @eggjs/tsconfig (v3.1.0-beta) with modern TypeScript defaults and decorator support.
  • Documentation
    • Added README, detailed CHANGELOG and LICENSE for the new tsconfig package.
    • Updated TypeScript tutorial snippets to reference the new tsconfig version.
  • Tests
    • Added tests and fixtures to verify TypeScript projects compile with the new config.
  • Chores
    • Switched tsconfig devDependency resolution to workspace across packages.
    • Removed homepage metadata and aligned issue tracker URLs; updated workspace catalog.

- Merge @eggjs/tsconfig repository into packages/tsconfig/
- Refactor package to use vitest testing framework instead of Node.js test runner
- Update all consuming packages to use workspace:* dependency references
- Add vitest configuration with coverage reporting
- Convert test assertions from Node.js assert to vitest expect API
- Update package.json scripts for vitest and oxlint
- Remove external @eggjs/tsconfig catalog dependency in favor of workspace package

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 13, 2025

Warning

Rate limit exceeded

@fengmk2 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d8471be and 33ce65c.

📒 Files selected for processing (2)
  • packages/tsconfig/README.md (1 hunks)
  • packages/tsconfig/tsconfig.json (1 hunks)

Walkthrough

Adds a new @eggjs/tsconfig package (configs, tests, fixtures, docs, license, .gitignore) and switches multiple packages to reference it via workspace. Removes several package.json homepage fields, updates a bugs URL, and adjusts root/tsconfig build defaults to extend the new tsconfig.

Changes

Cohort / File(s) Summary
Workspace devDependency update
package.json, examples/helloworld-typescript/package.json, packages/cluster/package.json, packages/core/package.json, packages/extend2/package.json, packages/mock/package.json, packages/core/test/fixtures/helloworld-ts/package.json, site/docs/tutorials/typescript.md, site/docs/tutorials/typescript.zh-CN.md
Change devDependency @eggjs/tsconfig from catalog: (or older range) to workspace/local reference (workspace:* or exact 3).
Remove homepage metadata
package.json, packages/cluster/package.json, packages/core/package.json, packages/egg/package.json, packages/mock/package.json
Delete homepage fields.
Bugs URL update
packages/cluster/package.json
Update bugs.url to https://github.com/eggjs/egg/issues.
Add @eggjs/tsconfig package
packages/tsconfig/package.json, packages/tsconfig/tsconfig.json, packages/tsconfig/README.md, packages/tsconfig/CHANGELOG.md, packages/tsconfig/LICENSE, packages/tsconfig/.gitignore, packages/tsconfig/vitest.config.ts, packages/tsconfig/test/index.test.ts, packages/tsconfig/test/fixtures/apps/ts-proj/tsconfig.json, packages/tsconfig/test/fixtures/apps/ts-proj/Foo.ts, packages/tsconfig/test/fixtures/apps/ts-proj/FooDecorator.ts
Introduce new package @eggjs/tsconfig (v3.1.0-beta.0): package metadata, module tsconfig, test harness (vitest) that builds fixture via tsc, README, changelog, license, and .gitignore.
Root/type config changes
tsconfig.json
Remove explicit strict/module/moduleResolution/allowImportingTsExtensions and the files entry; rely on extending @eggjs/tsconfig for defaults (retain target ES2022 and references).
Workspace catalog / pnpm changes
pnpm-workspace.yaml
Remove catalog entry for @eggjs/tsconfig, bump cataloged express version, and remove one comment line.
Test typing imports
packages/supertest/test/supertest.test.ts
Convert runtime imports to type-only imports for AddressInfo and Express to avoid runtime import of types.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant V as Vitest (test run)
  participant C as coffee (child process runner)
  participant T as tsc (TypeScript CLI)
  participant FS as File System

  V->>C: fork tsc -p fixtures/apps/ts-proj/tsconfig.json (cwd=fixture)
  C->>T: execute tsc CLI
  T->>FS: read tsconfig.json and source files
  T->>FS: emit compiled output to dist/
  T-->>C: exit code 0
  C-->>V: propagate exit code
  V->>FS: stat dist/ and assert it's a directory
  V-->>V: test passes (exit 0)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

I nibble at configs, whiskers twitching bright,
A tsconfig burrow springs into light.
Homepages trimmed, workspace paths align,
tsc hums softly — the fixtures compile fine.
I leave a carrot flag where the tests pass tonight. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "feat: integrate @eggjs/tsconfig into monorepo with vitest" accurately and concisely captures the primary change: merging the @eggjs/tsconfig package into the monorepo and switching its tests to vitest; it is specific, focused on the main intent, and free of noise or irrelevant details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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.

@fengmk2 fengmk2 mentioned this pull request Sep 13, 2025
42 tasks
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @fengmk2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the @eggjs/tsconfig package by integrating it into the monorepo and modernizing its development setup. The core purpose is to streamline dependency management by converting @eggjs/tsconfig into a local workspace package, thereby improving consistency and development workflow for TypeScript configurations across the project. This change also updates the testing framework to Vitest, ensuring a more robust and modern testing environment for the TypeScript configurations.

Highlights

  • Monorepo Integration: The @eggjs/tsconfig package has been integrated directly into the monorepo, moving from an external catalog dependency to a local workspace package under packages/tsconfig/.
  • Testing Framework Migration: The @eggjs/tsconfig package's testing infrastructure has been migrated from the Node.js test runner to Vitest, including updated test scripts, configurations, and conversion of test assertions.
  • Dependency Updates: All consuming packages within the monorepo have been updated to reference @eggjs/tsconfig using workspace:* instead of catalog:, streamlining dependency management.
  • TypeScript Configuration Modernization: A new base tsconfig.json has been added for @eggjs/tsconfig, targeting ES2024, NodeNext module resolution, and including experimental decorator support, along with other strict compiler options.
  • Project Metadata Refinement: Various package.json files across the monorepo have had their homepage fields removed for consistency and to centralize repository information.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 13, 2025

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 33ce65c
Status:🚫  Build failed.

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 13, 2025

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 33ce65c
Status:🚫  Build failed.

View logs

@gemini-code-assist
Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@socket-security
Copy link

socket-security bot commented Sep 13, 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

@codecov
Copy link

codecov bot commented Sep 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.86%. Comparing base (831b56c) to head (33ce65c).
⚠️ Report is 2 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #5460      +/-   ##
==========================================
- Coverage   75.90%   75.86%   -0.04%     
==========================================
  Files          94       94              
  Lines        5553     5553              
  Branches     1177     1177              
==========================================
- Hits         4215     4213       -2     
- Misses       1168     1170       +2     
  Partials      170      170              

☔ 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.

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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/tsconfig/CHANGELOG.md (1)

113-115: Remove generator artifact from changelog

Stray “fatal: No names found…” leaks into user-facing docs.

-  * [[`05c0e95`](http://github.com/eggjs/tsconfig/commit/05c0e954eea00398ed63d6449febbc86051c7fb5)] - first impl (#1) (killa <<killa123@126.com>>),fatal: No names found, cannot describe anything.
+  * [[`05c0e95`](http://github.com/eggjs/tsconfig/commit/05c0e954eea00398ed63d6449febbc86051c7fb5)] - first impl (#1) (killa <<killa123@126.com>>)
🧹 Nitpick comments (9)
pnpm-workspace.yaml (1)

24-24: Optional: consider dropping @eggjs/tsconfig from catalog now that it’s internal.
Having both a workspace:* consumer and a catalog entry can confuse resolution if any package forgets to use workspace:*. If you keep it for external template/reference, add a comment explaining why.

Apply if you opt to remove:

-  '@eggjs/tsconfig': ^3.1.0
packages/tsconfig/README.md (1)

24-33: Use jsonc code fence to avoid invalid JSON comments.
The snippet contains comments; mark as jsonc to prevent confusion.

-```json
+```jsonc
 // tsconfig.json
 {
   "extends": "@eggjs/tsconfig",
   // custom config
   "compilerOptions": {
     // override @eggjs/tsconfig options here
   }
 }
packages/tsconfig/test/fixtures/apps/ts-proj/FooDecorator.ts (1)

1-5: Type the decorator precisely using ClassDecorator.

Avoid any and make the intent explicit.

-export default function FooDecorator() {
-  return function (target: any) {
+export default function FooDecorator(): ClassDecorator {
+  return function (target) {
     console.log('decorator to class: ', target);
   };
 }
packages/tsconfig/tsconfig.json (6)

29-31: Prefer external source maps for smaller artifacts.

Inline maps bloat outputs; external maps work well with modern tooling.

-    "inlineSourceMap": true,
-    "declaration": true,
+    "sourceMap": true,
+    "declaration": true,

27-28: Redundant lib checks.

skipLibCheck already covers default libs; you can drop skipDefaultLibCheck.

-    "skipLibCheck": true,
-    "skipDefaultLibCheck": true,
+    "skipLibCheck": true,

7-11: Interop comment vs verbatimModuleSyntax.

With "verbatimModuleSyntax": true, TS won’t synthesize CJS interop; default-importing CJS (e.g., import assert from 'assert') can break at runtime under NodeNext. If that usage is required, consider removing verbatimModuleSyntax or refactor imports to ESM-friendly forms (e.g., import * as assert from 'node:assert' or named ESM exports).

Also applies to: 39-41


8-9: Lock Node server typing explicitly.

To avoid accidental DOM globals and clarify environment, consider adding lib and Node types.

     "module": "NodeNext",
     "moduleResolution": "NodeNext",
+    "lib": ["ES2024"],
+    "types": ["node"],

2-2: Move editor-only compileOnSave to local config.

Keeps the published base config lean and avoids editor coupling.

-  "compileOnSave": true,
+  // moved to developer/editor settings if needed

1-43: Repo guideline vs published base config: clarify split.

Guidelines require packages/*/tsconfig.json to extend the root and set baseUrl: "./". This file is a published base config; extending the repo root here would break consumers. Suggest splitting:

  • keep this file as the exported preset,
  • add packages/tsconfig/tsconfig.build.json for local builds/tests:
{
  "extends": "../../tsconfig.json",
  "compilerOptions": { "baseUrl": "./" }
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 831b56c and ae524ae.

⛔ Files ignored due to path filters (2)
  • packages/tsconfig/test/fixtures/apps/ts-proj/node_modules/@eggjs/tsconfig is excluded by !**/node_modules/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • examples/helloworld-typescript/package.json (1 hunks)
  • package.json (1 hunks)
  • packages/cluster/package.json (2 hunks)
  • packages/core/package.json (1 hunks)
  • packages/egg/package.json (0 hunks)
  • packages/extend2/package.json (1 hunks)
  • packages/mock/package.json (1 hunks)
  • packages/tsconfig/.gitignore (1 hunks)
  • packages/tsconfig/CHANGELOG.md (1 hunks)
  • packages/tsconfig/LICENSE (1 hunks)
  • packages/tsconfig/README.md (1 hunks)
  • packages/tsconfig/package.json (1 hunks)
  • packages/tsconfig/test/fixtures/apps/ts-proj/Foo.ts (1 hunks)
  • packages/tsconfig/test/fixtures/apps/ts-proj/FooDecorator.ts (1 hunks)
  • packages/tsconfig/test/fixtures/apps/ts-proj/tsconfig.json (1 hunks)
  • packages/tsconfig/test/index.test.ts (1 hunks)
  • packages/tsconfig/tsconfig.json (1 hunks)
  • packages/tsconfig/vitest.config.ts (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/egg/package.json
🧰 Additional context used
📓 Path-based instructions (5)
packages/*/package.json

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/package.json: Use workspace:* for internal package dependencies in package.json
Reference external dependencies via pnpm catalog using "catalog:" in package.json

Files:

  • packages/core/package.json
  • packages/extend2/package.json
  • packages/tsconfig/package.json
  • packages/cluster/package.json
  • packages/mock/package.json
packages/*/vitest.config.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Each package must include a vitest.config.ts for test configuration

Files:

  • packages/tsconfig/vitest.config.ts
pnpm-workspace.yaml

📄 CodeRabbit inference engine (CLAUDE.md)

Add and manage external dependency versions in the catalog section of pnpm-workspace.yaml

Files:

  • pnpm-workspace.yaml
packages/*/test/**/*.test.ts

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/test/**/*.test.ts: All packages must use Vitest as the test runner; tests live under test//*.test.ts
Test files should import test functions from vitest (e.g., import { describe, it } from 'vitest')
Use Node.js built-in assert module for assertions in tests
Test files must follow the naming/location pattern test/
/*.test.ts

Files:

  • packages/tsconfig/test/index.test.ts
packages/*/tsconfig.json

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/tsconfig.json: All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json"
Each package tsconfig.json must include compilerOptions.baseUrl set to "./"

Files:

  • packages/tsconfig/tsconfig.json
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/package.json : Use workspace:* for internal package dependencies in package.json
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to pnpm-workspace.yaml : Add and manage external dependency versions in the catalog section of pnpm-workspace.yaml
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/package.json : Reference external dependencies via pnpm catalog using "catalog:" in package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/package.json : Use workspace:* for internal package dependencies in package.json

Applied to files:

  • packages/core/package.json
  • packages/extend2/package.json
  • packages/cluster/package.json
  • packages/mock/package.json
  • package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/vitest.config.ts : Each package must include a vitest.config.ts for test configuration

Applied to files:

  • packages/tsconfig/vitest.config.ts
  • packages/tsconfig/test/fixtures/apps/ts-proj/tsconfig.json
  • packages/tsconfig/test/index.test.ts
  • package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/test/**/*.test.ts : Test files should import test functions from vitest (e.g., import { describe, it } from 'vitest')

Applied to files:

  • packages/tsconfig/vitest.config.ts
  • packages/tsconfig/test/index.test.ts
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/test/**/*.test.ts : All packages must use Vitest as the test runner; tests live under test/**/*.test.ts

Applied to files:

  • packages/tsconfig/vitest.config.ts
  • packages/tsconfig/test/index.test.ts
  • package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/test/**/*.test.ts : Test files must follow the naming/location pattern test/**/*.test.ts

Applied to files:

  • packages/tsconfig/vitest.config.ts
  • packages/tsconfig/test/index.test.ts
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to pnpm-workspace.yaml : Add and manage external dependency versions in the catalog section of pnpm-workspace.yaml

Applied to files:

  • pnpm-workspace.yaml
  • package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/egg/src/config/plugin.ts : Configure built-in plugins in packages/egg/src/config/plugin.ts

Applied to files:

  • pnpm-workspace.yaml
  • packages/tsconfig/package.json
  • packages/mock/package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/tsconfig.json : All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json"

Applied to files:

  • packages/tsconfig/test/fixtures/apps/ts-proj/tsconfig.json
  • packages/tsconfig/README.md
  • packages/extend2/package.json
  • packages/tsconfig/tsconfig.json
  • packages/tsconfig/package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/tsconfig.json : Each package tsconfig.json must include compilerOptions.baseUrl set to "./"

Applied to files:

  • packages/tsconfig/test/fixtures/apps/ts-proj/tsconfig.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/tsdown.config.ts : Each package should include tsdown.config.ts for unbundled ESM builds

Applied to files:

  • packages/tsconfig/test/fixtures/apps/ts-proj/tsconfig.json
  • packages/extend2/package.json
  • packages/tsconfig/tsconfig.json
  • packages/tsconfig/package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/egg/src/config/config.default.ts : Define default framework configuration in packages/egg/src/config/config.default.ts

Applied to files:

  • packages/tsconfig/test/fixtures/apps/ts-proj/tsconfig.json
  • packages/tsconfig/README.md
  • packages/extend2/package.json
  • packages/tsconfig/package.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/test/**/*.test.ts : Use Node.js built-in assert module for assertions in tests

Applied to files:

  • packages/tsconfig/test/index.test.ts
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/package.json : Reference external dependencies via pnpm catalog using "catalog:" in package.json

Applied to files:

  • package.json
🧬 Code graph analysis (2)
packages/tsconfig/test/fixtures/apps/ts-proj/Foo.ts (1)
packages/tsconfig/test/fixtures/apps/ts-proj/FooDecorator.ts (1)
  • FooDecorator (1-5)
packages/tsconfig/test/fixtures/apps/ts-proj/FooDecorator.ts (1)
packages/tsconfig/test/fixtures/apps/ts-proj/Foo.ts (1)
  • FooDecorator (3-13)
🪛 Biome (2.1.2)
packages/tsconfig/test/fixtures/apps/ts-proj/Foo.ts

[error] 7-11: This code is unreachable

(lint/correctness/noUnreachable)

⏰ 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). (2)
  • GitHub Check: Test / Test (windows-latest, 24)
  • GitHub Check: Test / Test (windows-latest, 22)
🔇 Additional comments (13)
packages/mock/package.json (1)

120-120: Approve — switch to workspace: for @eggjs/tsconfig*
No remaining 'catalog:' references were found.

packages/core/package.json (1)

65-65: Good: devDependency now uses workspace: for @eggjs/tsconfig.*
Matches the coding guideline for internal deps.

package.json (1)

11-11: Root devDependency updated to workspace: — LGTM.*
Keeps tooling consistent across the workspace.

examples/helloworld-typescript/package.json (1)

15-15: Example now points to workspace: — looks good.*
Keeps example aligned with monorepo’s local tsconfig package.

packages/extend2/package.json (1)

34-34: DevDependency switch to workspace: is correct.*
Consistent with internal dependency policy.

packages/tsconfig/LICENSE (1)

1-22: MIT license included — all good.
Matches package metadata and standard text.

packages/tsconfig/package.json (1)

33-38: Good use of catalog protocol for externals

devDependencies correctly use "catalog:"; no internal deps here.

packages/cluster/package.json (2)

41-43: Bugs URL correction looks right

Points to the monorepo issues page.


58-61: Fix invalid workspace protocol usage

"workspace:" without a range won't resolve — use "workspace:*" for internal workspace dependencies.

File: packages/cluster/package.json (lines 58-61)

-    "@eggjs/supertest": "workspace:",
+    "@eggjs/supertest": "workspace:*",

Scan returned no matches; re-run to confirm no other occurrences:
rg -nP '"@eggjs/[^"]+"\s*:\s*"workspace:"' packages -g '!**/pnpm-lock.yaml'

packages/tsconfig/.gitignore (1)

108-109: Nice fixture exceptions

Keeping fixture node_modules while ignoring their dist is the right balance.

packages/tsconfig/test/fixtures/apps/ts-proj/tsconfig.json (1)

1-7: Verify import extension policy

Fixture imports a sibling with “.ts”. With NodeNext, prefer “.js” in source or enable allowImportingTsExtensions.

Option A (preferred): update import in Foo.ts (see separate comment).
Option B: enable in fixture:

   "compilerOptions": {
     "baseUrl": "./",
-    "outDir": "dist"
+    "outDir": "dist",
+    "allowImportingTsExtensions": true
   }
packages/tsconfig/tsconfig.json (2)

32-35: Decorator metadata enabled globally — no top-level 'reflect-metadata' import found

pnpm-lock.yaml contains reflect-metadata@0.1.14 only as a transitive dep; no import/require of 'reflect-metadata' found in the repo.

  • Either remove emitDecoratorMetadata from the shared base tsconfig and enable it only in packages that require runtime metadata.
  • Or add reflect-metadata as a direct dependency and import 'reflect-metadata' early in consumer entrypoints so metadata APIs are available.

Location: packages/tsconfig/tsconfig.json (emitDecoratorMetadata / experimentalDecorators).


38-41: Require TypeScript >= 5.8 for these tsconfig options.

packages/tsconfig/tsconfig.json (lines 38–41): erasableSyntaxOnly → TS ≥5.8; rewriteRelativeImportExtensions → TS ≥5.7; allowImportingTsExtensions → TS ≥5.0. Workspace’s pnpm-workspace.yaml maps "typescript: '5'" but does not guarantee a ≥5.8 minor—verify/update the resolved TypeScript in package.json/lockfile/CI/editor to >=5.8 or remove/guard the newer options.

fengmk2 and others added 2 commits September 14, 2025 00:03
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/supertest/test/supertest.test.ts (1)

143-162: Close HTTPS server to avoid resource leaks

The HTTPS server created via https.createServer isn’t explicitly closed. Add a server.close() (ideally in a finally) to avoid handle leaks under parallel test runs.

   const server = https.createServer(
     {
       key: fs.readFileSync(path.join(fixtures, 'test_key.pem')),
       cert: fs.readFileSync(path.join(fixtures, 'test_cert.pem')),
     },
     app
   );

   app.get('/', function (_req, res) {
     res.send('hey');
   });

-  const res = await request(server).get('/');
-
-  expect(res.status).toBe(200);
-  expect(res.text).toBe('hey');
+  try {
+    const res = await request(server).get('/');
+    expect(res.status).toBe(200);
+    expect(res.text).toBe('hey');
+  } finally {
+    server.close();
+  }
tsconfig.json (1)

1-31: Add ./packages/tsconfig to root tsconfig references

packages/tsconfig/tsconfig.json exists but is not listed in the root tsconfig "references" — add it or confirm intentional exclusion.

  "references": [
    {
      "path": "./packages/egg"
    },
+   {
+     "path": "./packages/tsconfig"
+   },
    {
      "path": "./packages/core"
    },
    {
      "path": "./packages/utils"
    },
🧹 Nitpick comments (5)
site/docs/tutorials/typescript.md (2)

499-499: Version spec nit: prefer caret range for docs snippet

Using a major-only string is fine, but ^3 is more conventional in docs and avoids accidental pinning to 3.0.0 if a user copies this literally.

-    "@eggjs/tsconfig": "3"
+    "@eggjs/tsconfig": "^3"

496-504: Monorepo note suggestion

Since the repo now provides @eggjs/tsconfig as a workspace package, consider adding a one-line note below this snippet: “Inside the egg monorepo use workspace:* instead of a semver range.” This prevents confusion between external usage vs. in-repo usage.

site/docs/tutorials/typescript.zh-CN.md (2)

496-496: 版本范围微调:文档示例建议使用插入号

示例里用主版本字符串可用,但更常见写法是 ^3,避免用户复制后意外固定到 3.0.0。

-    "@eggjs/tsconfig": "3"
+    "@eggjs/tsconfig": "^3"

493-501: 补充 monorepo 说明

建议在代码块下方补充一句说明:在本仓库内部请使用 workspace:*,对外项目再使用 ^3。可避免读者混淆。

tsconfig.json (1)

4-4: Confirm intentional override of target

Base @eggjs/tsconfig likely sets a modern target. Overriding to ES2022 may downlevel features across the monorepo. If not strictly required, consider inheriting the base target by removing this override.

-    "target": "ES2022"
+    // inherit "target" from @eggjs/tsconfig unless there is a concrete need
+    // "target": "ES2022"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae524ae and d8471be.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • packages/core/test/fixtures/helloworld-ts/package.json (1 hunks)
  • packages/supertest/test/supertest.test.ts (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
  • site/docs/tutorials/typescript.md (1 hunks)
  • site/docs/tutorials/typescript.zh-CN.md (1 hunks)
  • tsconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/core/test/fixtures/helloworld-ts/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm-workspace.yaml
🧰 Additional context used
📓 Path-based instructions (2)
tsconfig.json

📄 CodeRabbit inference engine (CLAUDE.md)

Root tsconfig.json must include all packages in the references array

Files:

  • tsconfig.json
packages/*/test/**/*.test.ts

📄 CodeRabbit inference engine (CLAUDE.md)

packages/*/test/**/*.test.ts: All packages must use Vitest as the test runner; tests live under test//*.test.ts
Test files should import test functions from vitest (e.g., import { describe, it } from 'vitest')
Use Node.js built-in assert module for assertions in tests
Test files must follow the naming/location pattern test/
/*.test.ts

Files:

  • packages/supertest/test/supertest.test.ts
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/egg/src/config/config.default.ts : Define default framework configuration in packages/egg/src/config/config.default.ts
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/egg/src/config/plugin.ts : Configure built-in plugins in packages/egg/src/config/plugin.ts
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/tsconfig.json : All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json"
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/tsdown.config.ts : Each package should include tsdown.config.ts for unbundled ESM builds
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/egg/src/config/config.default.ts : Define default framework configuration in packages/egg/src/config/config.default.ts

Applied to files:

  • tsconfig.json
  • site/docs/tutorials/typescript.md
  • site/docs/tutorials/typescript.zh-CN.md
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/tsconfig.json : All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json"

Applied to files:

  • tsconfig.json
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/egg/src/config/plugin.ts : Configure built-in plugins in packages/egg/src/config/plugin.ts

Applied to files:

  • tsconfig.json
  • site/docs/tutorials/typescript.md
  • site/docs/tutorials/typescript.zh-CN.md
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/tsdown.config.ts : Each package should include tsdown.config.ts for unbundled ESM builds

Applied to files:

  • site/docs/tutorials/typescript.md
  • site/docs/tutorials/typescript.zh-CN.md
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/test/**/*.test.ts : Test files should import test functions from vitest (e.g., import { describe, it } from 'vitest')

Applied to files:

  • packages/supertest/test/supertest.test.ts
📚 Learning: 2025-09-13T13:03:58.196Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-13T13:03:58.196Z
Learning: Applies to packages/*/test/**/*.test.ts : Use Node.js built-in assert module for assertions in tests

Applied to files:

  • packages/supertest/test/supertest.test.ts
⏰ 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). (2)
  • GitHub Check: Test / Test (windows-latest, 22)
  • GitHub Check: Test / Test (windows-latest, 24)
🔇 Additional comments (3)
packages/supertest/test/supertest.test.ts (3)

5-5: Type-only import is correct

Using a type-only import for AddressInfo avoids unnecessary runtime bindings. LGTM.


8-8: Express type-only import is appropriate

Keeping the runtime default import for express and type-only import for Express is the right split. LGTM.


12-13: Clarify assertion strategy: Vitest expect vs Node assert

Repo guidelines say to use vitest for test runner but Node’s assert for assertions, whereas this file mixes both and predominantly uses expect. Please confirm the intended standard:

  • If moving to expect is the new norm, update the guidelines accordingly.
  • If assert is required, we’ll need to refactor tests to drop expect.

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.

1 participant