Skip to content

Comments

chore: add eslint rules to avoid importing from app-store#23518

Merged
anikdhabal merged 1 commit intomainfrom
chore/avoid_importing_from_app-store
Sep 2, 2025
Merged

chore: add eslint rules to avoid importing from app-store#23518
anikdhabal merged 1 commit intomainfrom
chore/avoid_importing_from_app-store

Conversation

@volnei
Copy link
Contributor

@volnei volnei commented Sep 2, 2025

What does this PR do?

Add some eslint rules to avoid importing from app-store inside lib and prisma modules. This was added as warn instead of error to avoid building errors.

image

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Walkthrough

Adds an overrides array to .eslintrc.js. The override targets files in packages/lib//*.{ts,tsx,js,jsx} and packages/prisma//.{ts,tsx,js,jsx}. Within this scope, it configures the no-restricted-imports rule to "warn" for direct imports of @calcom/app-store and any subpath via the pattern @calcom/app-store/. No other configurations are modified.

✨ 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_importing_from_app-store

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 review from a team September 2, 2025 14:58
@keithwillcode keithwillcode added core area: core, team members only foundation labels Sep 2, 2025
@anikdhabal anikdhabal enabled auto-merge (squash) September 2, 2025 15:01
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

🧹 Nitpick comments (2)
.eslintrc.js (2)

9-16: Catch deep subpaths and optionally enforce as an error with a guidance message

"@calcom/app-store/*" won’t match nested paths like "@calcom/app-store/foo/bar". Also, adding a message helps devs know what to do. Consider making it an error (or keep warn if you’re phasing in).

         "no-restricted-imports": [
-          "warn",
+          "error",
           {
-            paths: ["@calcom/app-store"],
-            patterns: ["@calcom/app-store/*"],
+            paths: [
+              {
+                "name": "@calcom/app-store",
+                "message": "Do not import from app-store within lib/prisma. Depend on lib contracts or introduce an explicit interface."
+              }
+            ],
+            patterns: ["@calcom/app-store/**"],
           },
         ],

7-7: Broaden file globs to cover ESM/TS variants

If these packages contain mjs/mts/cjs/cts files, they’ll bypass the rule. Expand the glob to future-proof.

-      files: ["packages/lib/**/*.{ts,tsx,js,jsx}", "packages/prisma/**/*.{ts,tsx,js,jsx}"],
+      files: [
+        "packages/lib/**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}",
+        "packages/prisma/**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}"
+      ],
📜 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 a1fab0e and 8f8ab2b.

📒 Files selected for processing (1)
  • .eslintrc.js (1 hunks)
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache

Comment on lines +9 to +16
"no-restricted-imports": [
"warn",
{
paths: ["@calcom/app-store"],
patterns: ["@calcom/app-store/*"],
},
],
},
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm policy on type-only imports

Do you want to allow import type { … } from "@calcom/app-store" in these layers? If yes, we can tweak the rule configuration to allow type-only imports for the pattern; if no, current approach will block them as well.


🏁 Script executed:

#!/bin/bash
# Find any direct or subpath imports from @calcom/app-store in lib/prisma
rg -nP -C1 --glob 'packages/lib/**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}' --glob 'packages/prisma/**/*.{ts,tsx,js,jsx,mts,mjs,cts,cjs}' \
  $'(^\\s*import\\s+type\\s+.*?from\\s+[\'"]@calcom/app-store(?:/[^\'"]*)?[\'"]|^\\s*import\\s+.*?from\\s+[\'"]@calcom/app-store(?:/[^\'"]*)?[\'"]|require\\(\\s*[\'"]@calcom/app-store(?:/[^\'"]*)?[\'"]\\s*\\)|import\\(\\s*[\'"]@calcom/app-store(?:/[^\'"]*)?[\'"]\\s*\\))'

Length of output: 21103


Permit or block type-only @calcom/app-store imports
The rule will currently forbid all imports—including import type—but we’re using type-only imports across lib/ and prisma/; add allowTypeImports: true to only restrict runtime imports.

.eslintrc.js (lines 9–16)

         "no-restricted-imports": [
           "warn",
           {
             paths: ["@calcom/app-store"],
             patterns: ["@calcom/app-store/*"],
+            allowTypeImports: true,
           },
         ],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"no-restricted-imports": [
"warn",
{
paths: ["@calcom/app-store"],
patterns: ["@calcom/app-store/*"],
},
],
},
"no-restricted-imports": [
"warn",
{
paths: ["@calcom/app-store"],
patterns: ["@calcom/app-store/*"],
allowTypeImports: true,
},
],
🤖 Prompt for AI Agents
.eslintrc.js around lines 9 to 16: the "no-restricted-imports" rule currently
blocks all imports from "@calcom/app-store" including type-only imports; update
the rule configuration to allow TypeScript type-only imports by adding
"allowTypeImports: true" to the rule options so only runtime imports are
restricted, leaving existing paths/patterns intact.

@anikdhabal anikdhabal merged commit 3b7d97b into main Sep 2, 2025
83 of 87 checks passed
@anikdhabal anikdhabal deleted the chore/avoid_importing_from_app-store branch September 2, 2025 15:24
@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 foundation ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants