Skip to content

Comments

chore: avoid circular deps#23520

Merged
keithwillcode merged 2 commits intomainfrom
chore/avoid_circular_deps
Sep 2, 2025
Merged

chore: avoid circular deps#23520
keithwillcode merged 2 commits intomainfrom
chore/avoid_circular_deps

Conversation

@volnei
Copy link
Contributor

@volnei volnei commented Sep 2, 2025

What does this PR do?

Introduce eslint rule to avoid circular dependencies, it was added as warn instead of error to avoid building errors.

image image

@volnei volnei requested a review from a team as a code owner September 2, 2025 15:28
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Walkthrough

  • .eslintrc.js: Added plugins: ["import"] and rules: { "import/no-cycle": ["warn", { maxDepth: Infinity }] } to enable cycle detection.
  • package.json: Added devDependency "eslint-plugin-import" at version ^2.32.0. Removed "packages/app-store/ee/*" from the workspaces array. No other exported/public declarations were changed.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/avoid_circular_deps

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@graphite-app graphite-app bot requested a review from a team September 2, 2025 15:28
@keithwillcode keithwillcode added core area: core, team members only foundation labels Sep 2, 2025
@vercel
Copy link

vercel bot commented Sep 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Sep 2, 2025 3:29pm
cal-eu Ignored Ignored Sep 2, 2025 3:29pm

@dosubot dosubot bot added ⬆️ dependencies Pull requests that update a dependency file 💻 refactor labels Sep 2, 2025
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 (4)
package.json (1)

98-98: Add ESLint import resolvers for TypeScript path aliases
package.json currently lacks the necessary resolver packages—without them, eslint-plugin-import won’t pick up TS path mappings, causing false cycle errors. In your devDependencies, add:

   "devDependencies": {
     "@testing-library/react": "^16.0.1",
     "@vitest/ui": "^2.1.1",
     "c8": "^7.13.0",
     "checkly": "latest",
     "dotenv-checker": "^1.1.5",
-    "eslint-plugin-import": "^2.32.0",
+    "eslint-plugin-import": "^2.32.0",
+    "eslint-import-resolver-typescript": "^3.6.1",
+    "eslint-import-resolver-node": "^0.3.9",
     "husky": "^8.0.0",

Then update your ESLint settings (e.g. in packages/config/eslint-preset.js) to include:

settings: {
  'import/resolver': {
    typescript: {}, 
    node: {},
  },
  // …other settings
},

This ensures accurate cycle detection across TS path aliases even in a node-modules linker setup.

.eslintrc.js (3)

5-8: Bound maxDepth; Infinity can severely slow lint on a large monorepo.

Cap depth and ignore externals to reduce noise and runtime while still catching most problematic cycles.

-  plugins: ["import"],
-  rules: {
-    "import/no-cycle": ["warn", { maxDepth: Infinity }],
-  },
+  plugins: ["import"],
+  rules: {
+    "import/no-cycle": ["warn", { maxDepth: 20, ignoreExternal: true }],
+  },

5-8: Optional: make no-cycle an error in CI only to prevent regressions without blocking local dev.

-  rules: {
-    "import/no-cycle": ["warn", { maxDepth: 20, ignoreExternal: true }],
-  },
+  rules: {
+    "import/no-cycle": [process.env.CI ? "error" : "warn", { maxDepth: 20, ignoreExternal: true }],
+  },

5-8: Configure TypeScript resolver for import plugin
Add a settings.import/resolver block so import/no-cycle resolves TS path aliases and workspaces correctly:

 .eslintrc.js
   extends: ["./packages/config/eslint-preset.js"],
   plugins: ["import"],
+  settings: {
+    "import/resolver": {
+      typescript: {
+        project: [
+          "packages/*/tsconfig.json",
+          "apps/*/tsconfig.json"
+        ]
+      }
+    }
+  },
   rules: {
     "import/no-cycle": ["warn", { maxDepth: Infinity }],
   },
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3b7d97b and 2414ef0.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • .eslintrc.js (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-01T10:25:51.893Z
Learnt from: nangelina
PR: calcom/cal.com#23486
File: packages/app-store/kyzonspacevideo/package.json:7-12
Timestamp: 2025-09-01T10:25:51.893Z
Learning: In Cal.com's monorepo, app-store packages don't need to declare `zod` as a direct dependency in their package.json files. The monorepo uses yarn workspaces with dependency hoisting, where `zod` is available through workspace-level dependency management. Most app-store packages successfully import zod without declaring it as a dependency, following the established monorepo pattern.

Applied to files:

  • package.json

@keithwillcode keithwillcode enabled auto-merge (squash) September 2, 2025 15:39
@keithwillcode keithwillcode merged commit 2023926 into main Sep 2, 2025
81 of 86 checks passed
@keithwillcode keithwillcode deleted the chore/avoid_circular_deps branch September 2, 2025 16:02
@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2025

E2E results are ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only ⬆️ dependencies Pull requests that update a dependency file foundation ready-for-e2e 💻 refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants