chore: add an eslint rule to warn importing trpc package in app store package#23665
chore: add an eslint rule to warn importing trpc package in app store package#23665
Conversation
WalkthroughAdds an ESLint override in .eslintrc.js for files under packages/app-store/**/*.{ts,tsx,js,jsx}. The override enforces no-restricted-imports (warning level) for @calcom/trpc and @calcom/trpc/*. This mirrors existing overrides used elsewhere in the repo. No source code or runtime behavior is changed, and no exported/public APIs are modified. Possibly related PRs
✨ Finishing Touches
🧪 Generate unit tests
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. Comment |
|
@coderabbitai add a PR description |
|
@CodeRabbit Add a PR description |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainI'll help you add a comprehensive PR description. Let me first examine the changes made in this PR to understand what eslint rule was added. 🏁 Script executed: Length of output: 266994 Let me examine the actual changes made in this PR to understand what eslint rule was added. Now I can see the changes made in the PR. Let me look at the specific eslint configuration that was added: Perfect! Now I can see what this PR does. Let me create a comprehensive PR description based on the changes: @hbjORbj Here's a comprehensive PR description for this PR: What does this PR do?This PR adds an ESLint rule to prevent importing the Changes Made
Why This Restriction?
Technical DetailsThe ESLint rule configuration: "overrides": [
{
"files": ["packages/app-store/**/*"],
"rules": {
"no-restricted-imports": [
"warn",
{
paths: ["@calcom/trpc"],
patterns: ["@calcom/trpc/*"],
},
],
},
},
]This ensures developers are warned when attempting to import tRPC utilities directly in app store code, encouraging the use of proper abstraction layers instead. How should this be tested?
🏁 Script executed: Length of output: 232 🏁 Script executed: Length of output: 758 Perfect! Now I can see the complete picture. The PR adds an ESLint rule that prevents importing @hbjORbj Here's a comprehensive PR description for this PR: What does this PR do?This PR adds an ESLint rule to prevent importing the Changes Made
Why This Restriction?
Technical DetailsThe ESLint rule configuration added: {
files: ["packages/app-store/**/*.{ts,tsx,js,jsx}"],
rules: {
"no-restricted-imports": [
"warn",
{
paths: ["@calcom/trpc"],
patterns: ["@calcom/trpc/*"],
},
],
},
}This creates a bidirectional architectural boundary:
How should this be tested?
This change helps maintain cleaner package boundaries and prevents architectural drift in the Cal.com codebase. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.eslintrc.js (2)
25-31: Harden matching and add actionable messagesAdd a deep match and developer-facing messages so violations are clearer at first glance.
Apply:
- "no-restricted-imports": [ - "warn", - { - paths: ["@calcom/trpc"], - patterns: ["@calcom/trpc/*"], - }, - ], + "no-restricted-imports": [ + "warn", + { + paths: [ + { name: "@calcom/trpc", message: "app-store must not depend on @calcom/trpc (preserve layering)." } + ], + patterns: [ + { group: ["@calcom/trpc/*", "@calcom/trpc/**"], message: "Deep TRPC imports are also restricted in app-store." } + ], + // Set to true if type-only imports should be allowed: + // allowTypeImports: true, + }, + ],
26-26: Enforceno-restricted-importsstrictly
The rule is set to"warn"in .eslintrc.js for packages/lib, packages/prisma and packages/app-store (lines 25–31), but"error"in packages/embeds. Also, CI isn’t running ESLint with--max-warnings=0. If you want strict enforcement, change these severities to"error"or add--max-warnings=0to your ESLint CI step.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
.eslintrc.js(1 hunks)
🔇 Additional comments (1)
.eslintrc.js (1)
22-33: LGTM: solid package-boundary guard for app-storeRule mirrors existing style and targets the right scope. No runtime impact.
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainI'll help you add a comprehensive PR description. Let me first examine the changes in this PR to understand what was implemented. 🏁 Script executed: Length of output: 418 Let me examine the ESLint configuration and related files to understand the changes: 🏁 Script executed: Length of output: 3338 Let me search for the custom ESLint plugin and the specific rule that was added: 🏁 Script executed: Length of output: 414 Let me fix the commands and examine the app-store structure and ESLint plugin: 🏁 Script executed: Length of output: 286034 @hbjORbj I'll help you add a comprehensive PR description for this change. Based on my examination of the codebase, I can see that this PR adds an ESLint rule to prevent direct tRPC imports in app-store packages. Add ESLint rule to warn about tRPC imports in app-store packagesWhat does this PR do?This PR adds an ESLint configuration rule that warns when packages in the Why is this change needed?
Implementation DetailsThe rule is configured in {
files: ["packages/app-store/**/*.{ts,tsx,js,jsx}"],
rules: {
"no-restricted-imports": [
"warn",
{
paths: ["@calcom/trpc"],
}
]
}
}The rule uses TestingRun ESLint on the app-store packages to verify the rule is working: npm run lint packages/app-store/Notes
|
E2E results are ready! |
What does this PR do?
This PR adds an ESLint rule to prevent importing the
@calcom/trpcpackage within the app store package, helping maintain better architectural boundaries and preventing potential circular dependencies.Changes Made
no-restricted-importsin.eslintrc.jsto warn when importing:@calcom/trpc(direct import)@calcom/trpc/*(any sub-path imports)packages/app-store/**/*Why This Restriction?
Technical Details
The ESLint rule configuration:
This ensures developers are warned when attempting to import tRPC utilities directly in app store code, encouraging the use of proper abstraction layers instead.
How should this be tested?
@calcom/trpcin any file withinpackages/app-store/- you should see an ESLint warningnpm run lintto ensure the rule is properly applied🏁 Script executed:
Length of output: 232
🏁 Script executed:
Length of output: 758
Perfect! Now I can see the complete picture. The PR adds an ESLint rule that prevents importing
@calcom/trpcin the app-store package. Here's the updated and complete PR description:@hbjORbj Here's a comprehensive PR description for this PR:
What does this PR do?
This PR adds an ESLint rule to prevent importing the
@calcom/trpcpackage within the app store package (packages/app-store/**/*), helping maintain better architectural boundaries and preventing potential circular dependencies.Changes Made
no-restricted-importsin.eslintrc.jsto warn when importing:@calcom/trpc(direct import)@calcom/trpc/*(any sub-path imports)packages/app-store/**/*.{ts,tsx,js,jsx}Why This Restriction?
@calcom/liband@calcom/prismafrom importing@calcom/app-storeTechnical Details
The ESLint rule configuration added:
This creates a bidirectional architectural boundary:
How should this be tested?
@calcom/trpcin any file withinpackages/app-store/- you should see an ESLint warningnpm run lintto ensure the rule is properly appliedThis change helps maintain cleaner package boundaries and prevents architectural drift in the Cal.com codebase.