{
  "$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
  "root": true,
  "assist": {
    "actions": {
      "source": {
        "organizeImports": {
          "level": "on",
          "options": {
            "groups": [
              ["**/__mocks__/**", "**/bookingScenario*"],
              [":PACKAGE_WITH_PROTOCOL:", ":PACKAGE:"],
              ["@calcom/**", "@ee/**"],
              ["@lib/**", "@components/**", "@server/**", "@trpc/**"],
              "~/**",
              ":PATH:"
            ]
          }
        }
      }
    },
    "enabled": true
  },
  "css": {
    "parser": {
      "tailwindDirectives": true
    }
  },
  "formatter": {
    "includes": [
      "**/*",
      "!packages/ui/components/icon/dynamicIconImports.tsx"
    ],
    "lineWidth": 110,
    "indentStyle": "space",
    "indentWidth": 2,
    "lineEnding": "lf"
  },
  "files": {
    "includes": [
      "**/*",
      "!!**/node_modules",
      "!!**/.next",
      "!!**/.turbo",
      "!!**/dist",
      "!!**/build",
      "!!**/public",
      "!!**/*.d.ts",
      "!!public",
      "!!apps/web/public/embed",
      "!!packages/prisma/zod",
      "!!packages/prisma/enums",
      "!!*.lock",
      "!!*.log",
      "!!.gitignore",
      "!!.npmignore",
      "!!.prettierignore",
      "!!.eslintignore",
      "!!.DS_Store",
      "!!coverage",
      "!!lint-results",
      "!!test-results",
      "!!packages/lib/raqb/resolveQueryValue.test.ts",
      "!!packages/ui/components/editor/plugins/ToolbarPlugin.tsx",
      "!!packages/embeds/embed-core/src/lib/domUtils.ts"
    ],
    "maxSize": 2097152
  },
  "javascript": {
    "parser": {
      "unsafeParameterDecoratorsEnabled": true
    },
    "formatter": {
      "arrowParentheses": "always",
      "bracketSpacing": true,
      "bracketSameLine": true,
      "quoteStyle": "double",
      "jsxQuoteStyle": "double",
      "semicolons": "always",
      "trailingCommas": "es5"
    }
  },
  "linter": {
    "enabled": true,
    "domains": {
      "next": "recommended",
      "react": "recommended"
    },
    "rules": {
      "recommended": true,
      "a11y": "off"
    }
  },
  "overrides": [
    {
      "includes": ["**/*.tsx"],
      "javascript": {
        "jsxRuntime": "transparent"
      }
    },
    {
      "includes": ["apps/web/app/**/page.tsx", "apps/web/app/**/layout.tsx", "apps/web/app/pages/**/*.tsx"],
      "linter": {
        "rules": {
          "style": {
            "noDefaultExport": "off"
          }
        }
      }
    },
    {
      "includes": ["**/*"],
      "linter": {
        "rules": {
          "nursery": {
            "useQwikValidLexicalScope": "off",
            "useExplicitType": "info",
            "noReactForwardRef": "warn",
            "noTernary": "info",
            "noUnresolvedImports": "warn",
            "useSortedClasses": {
              "level": "warn",
              "options": {
                "attributes": ["className", "classList"],
                "functions": ["clsx", "cva", "cn", "tw"]
              }
            }
          },
          "correctness": {
            "useImportExtensions": "warn",
            "noProcessGlobal": "warn",
            "useExhaustiveDependencies": "warn",
            "noUnknownProperty": "warn",
            "noUnreachable": "warn",
            "noEmptyPattern": "warn",
            "noSwitchDeclarations": "warn",
            "useHookAtTopLevel": "warn",
            "useJsxKeyInIterable": "warn",
            "noUnsafeOptionalChaining": "warn"
          },
          "style": {
            "useExportsLast": "warn",
            "noProcessEnv": "warn",
            "useNodejsImportProtocol": "error",
            "noNestedTernary": "warn"
          },
          "complexity": {
            "noExcessiveLinesPerFunction": {
              "level": "warn",
              "options": {
                "maxLines": 100,
                "skipBlankLines": true
              }
            }
          },
          "performance": {
            "noImgElement": "warn"
          },
          "suspicious": {
            "noDoubleEquals": "warn",
            "noAssignInExpressions": "warn",
            "noExplicitAny": "warn",
            "useIterableCallbackReturn": "warn",
            "noImplicitAnyLet": "warn",
            "noRedeclare": "warn",
            "noControlCharactersInRegex": "warn",
            "noArrayIndexKey": "warn",
            "noShadowRestrictedNames": "warn",
            "noAsyncPromiseExecutor": "warn"
          },
          "security": {
            "noBlankTarget": "warn",
            "noDangerouslySetInnerHtml": "warn"
          }
        }
      }
    },
    {
      "includes": ["packages/embeds/embed-core/**/*.{ts,tsx,js,jsx}"],
      "linter": {
        "rules": {
          "style": {
            "useNodejsImportProtocol": "off",
            "noProcessEnv": "off"
          },
          "correctness": {
            "noProcessGlobal": "off"
          }
        }
      }
    },
    {
      "includes": ["apps/api/v2/**/*.ts", "apps/api/v2/**/*.controller.ts"],
      "linter": {
        "rules": {
          "style": {
            "useImportType": "off"
          },
          "correctness": {
            "noProcessGlobal": "off"
          }
        }
      }
    },
    {
      "includes": [
        "apps/api/v2/src/config/app.ts",
        "apps/api/v2/src/main.ts",
        "apps/api/v2/src/bootstrap.ts",
        "apps/api/v2/src/config/env.ts",
        "apps/api/v2/src/env.ts",
        "apps/api/v2/test/setEnvVars.ts"
      ],
      "linter": {
        "rules": {
          "style": {
            "noProcessEnv": "off"
          }
        }
      }
    },
    {
      "includes": ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.e2e-spec.ts", "**/*.integration-test.ts"],
      "linter": {
        "rules": {
          "complexity": {
            "useArrowFunction": "off",
            "noExcessiveLinesPerFunction": "off"
          }
        }
      }
    },
    {
      "includes": ["packages/lib/**/*.{ts,tsx,js,jsx,mts,mjs,cjs,cts}"],
      "linter": {
        "rules": {
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": ["../app-store/**"],
                    "message": "lib package should not import from app-store to avoid circular dependencies."
                  },
                  {
                    "group": ["../features/**"],
                    "message": "lib package should not import from features to avoid circular dependencies."
                  },
                  {
                    "group": ["../trpc/**"],
                    "message": "lib package should not import from trpc to avoid circular dependencies."
                  },
                  {
                    "group": ["@trpc/server"],
                    "message": "lib package should not import from @trpc/server to avoid circular dependencies."
                  }
                ]
              }
            }
          }
        }
      }
    },
    {
      "includes": [
        "packages/lib/**/*repository*.{ts,tsx,js,jsx}",
        "packages/lib/**/*Repository*.{ts,tsx,js,jsx}",
        "packages/lib/**/repository/**/*.{ts,tsx,js,jsx}",
        "packages/lib/**/repositories/**/*.{ts,tsx,js,jsx}"
      ],
      "linter": {
        "rules": {
          "style": {
            "useFilenamingConvention": {
              "level": "error",
              "options": {
                "match": "REPOSITORY-FILES-NOT-ALLOWED-IN-PACKAGES-LIB[.](.+)",
                "filenameCases": ["camelCase"]
              }
            }
          }
        }
      }
    },
    {
      "includes": ["packages/app-store/**/*.{ts,tsx,js,jsx,mts,mjs,cjs,cts}"],
      "linter": {
        "rules": {
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": ["../features/**"],
                    "message": "app-store package should not import from features to avoid circular dependencies."
                  },
                  {
                    "group": ["../trpc/**"],
                    "message": "app-store package should not import from trpc to avoid circular dependencies."
                  }
                ]
              }
            }
          }
        }
      }
    },
    {
      "includes": ["packages/features/**/*.{ts,tsx,js,jsx,mts,mjs,cjs,cts}"],
      "linter": {
        "rules": {
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": ["../trpc/**"],
                    "message": "features package should not import from trpc to avoid circular dependencies."
                  },
                  {
                    "group": ["@calcom/web", "@calcom/web/**"],
                    "message": "features package should not import from @calcom/web to avoid circular dependencies."
                  },
                  {
                    "group": ["../../apps/web/**"],
                    "message": "features package should not import from apps/web to avoid circular dependencies."
                  }
                ]
              }
            }
          }
        }
      }
    },
    {
      "includes": ["packages/trpc/**/*.{ts,tsx,js,jsx,mts,mjs,cjs,cts}"],
      "linter": {
        "rules": {
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": ["../apps/web/**"],
                    "message": "trpc package should not import from apps/web to avoid circular dependencies."
                  }
                ]
              }
            }
          }
        }
      }
    },
    {
      "includes": ["packages/testing/**/*.{ts,tsx,js,jsx,mts,mjs,cjs,cts}"],
      "linter": {
        "rules": {
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": ["@calcom/web", "@calcom/web/**"],
                    "message": "testing package should not import from @calcom/web to avoid circular dependencies."
                  },
                  {
                    "group": ["@calcom/features", "@calcom/features/**"],
                    "message": "testing package should not import from @calcom/features to avoid circular dependencies."
                  },
                  {
                    "group": ["../../apps/web/**"],
                    "message": "testing package should not import from apps/web to avoid circular dependencies."
                  },
                  {
                    "group": ["../features/**"],
                    "message": "testing package should not import from features to avoid circular dependencies."
                  }
                ]
              }
            }
          }
        }
      }
    },
    {
      "includes": ["packages/platform/atoms/**/*.{ts,tsx,js,jsx,mts,mjs,cjs,cts}"],
      "linter": {
        "rules": {
          "correctness": {
            "noProcessGlobal": "off"
          },
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": ["@calcom/trpc", "@calcom/trpc/**"],
                    "message": "atoms package should not import from @calcom/trpc."
                  },
                  {
                    "group": ["../../trpc", "../../trpc/**"],
                    "message": "atoms package should not import from trpc."
                  }
                ]
              }
            }
          }
        }
      }
    },
    {
      "includes": ["apps/api/v2/**/*.{ts,tsx,js,jsx,mts,mjs,cjs,cts}"],
      "linter": {
        "rules": {
          "style": {
            "noRestrictedImports": {
              "level": "error",
              "options": {
                "patterns": [
                  {
                    "group": [
                      "@calcom/*",
                      "@calcom/**",
                      "!@calcom/platform-constants",
                      "!@calcom/platform-constants/**",
                      "!@calcom/platform-enums",
                      "!@calcom/platform-enums/**",
                      "!@calcom/platform-libraries",
                      "!@calcom/platform-libraries/**",
                      "!@calcom/platform-types",
                      "!@calcom/platform-types/**",
                      "!@calcom/platform-utils",
                      "!@calcom/platform-utils/**",
                      "!@calcom/prisma",
                      "!@calcom/prisma/**"
                    ],
                    "message": "API v2 should only import from @calcom/platform-constants, @calcom/platform-enums, @calcom/platform-libraries, @calcom/platform-types, @calcom/platform-utils, and @calcom/prisma. Other @calcom packages are not allowed."
                  }
                ]
              }
            }
          }
        }
      }
    }
  ]
}
