Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 63 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// This configuration only applies to the package manager root.
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["./packages/config/eslint-preset.js"],
Expand All @@ -7,29 +6,85 @@ module.exports = {
"import/no-cycle": ["warn", { maxDepth: Infinity }],
},
overrides: [
// WARN: features must not be imported by app-store, prisma, or lib
{
files: ["packages/lib/**/*.{ts,tsx,js,jsx}", "packages/prisma/**/*.{ts,tsx,js,jsx}"],
files: [
"packages/app-store/**/*.{ts,tsx,js,jsx}",
"packages/prisma/**/*.{ts,tsx,js,jsx}",
"packages/lib/**/*.{ts,tsx,js,jsx}",
],
rules: {
"no-restricted-imports": [
"warn",
{
paths: ["@calcom/app-store"],
Copy link
Contributor Author

@hbjORbj hbjORbj Sep 15, 2025

Choose a reason for hiding this comment

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

patterns alone is sufficient

patterns: ["@calcom/app-store/*"],
patterns: [
{
group: [
// Catch all relative paths into features
"**/features",
"**/features/*",
Comment on lines +19 to +21
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might throw for valid imports e.g., importing a folder named features within the same package.
But we have a good message + we have no choice other than relying on no-restricted-imports rule for now since the zones approach isn't supported in our TS version (@typescript-eslint only supports <5.4 but we're on 5.9)

// Catch all alias imports
"@calcom/features",
"@calcom/features/*",
],
message:
"Avoid importing @calcom/features from @calcom/app-store, @calcom/prisma, or @calcom/lib.",
},
],
},
],
},
},
// WARN: lib must not import app-store or features
{
files: ["packages/lib/**/*.{ts,tsx,js,jsx}"],
rules: {
"no-restricted-imports": [
"warn",
{
patterns: [
{
group: [
// Catch all relative paths into app-store
"**/app-store",
"**/app-store/*",
// Catch all relative paths into features
"**/features",
"**/features/*",
// Catch alias imports
"@calcom/app-store",
"@calcom/app-store/*",
"@calcom/features",
"@calcom/features/*",
],
message: "@calcom/lib should not import @calcom/app-store or @calcom/features.",
},
],
},
],
},
},
// ERROR: app-store must not import trpc
{
files: ["packages/app-store/**/*.{ts,tsx,js,jsx}"],
rules: {
"@typescript-eslint/no-restricted-imports": [
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@calcom/trpc/*", "@trpc/*"],
message: "tRPC imports are blocked in packages/app-store. Move UI to apps/web/components/apps or introduce an API boundary.",
allowTypeImports: false,
group: [
// Catch all relative paths into trpc
"**/trpc",
"**/trpc/*",
// Catch alias imports
"@calcom/trpc",
"@calcom/trpc/*",
"@trpc",
"@trpc/*",
],
message:
"@calcom/app-store must not import trpc. Move UI to apps/web/components/apps or introduce an API boundary.",
},
],
},
Expand Down
Loading