* feat(companion): add ESLint with Prettier integration
- Add ESLint with eslint-config-expo/flat for SDK 55
- Integrate Prettier via eslint-plugin-prettier
- Configure environment-specific settings for Node.js config files and browser extension
- Add lint script to package.json
- Fix Prettier formatting issues in AvailabilityTab.tsx and types/index.ts
* fix(companion): use bun lockfile instead of npm
- Remove package-lock.json that was accidentally committed
- Update bun.lock with ESLint dependencies
* fix(companion): fix all ESLint errors (16 total)
- Fix unescaped entities in JSX (react/no-unescaped-entities):
- app/(tabs)/(event-types)/index.tsx: escape quotes in delete confirmation
- components/LoginScreen.tsx: escape apostrophe in "Don't have an account"
- components/NetworkStatusBanner.tsx: escape apostrophes in offline message
- components/booking-modals/BookingModals.tsx: escape apostrophe in rejection message
- components/event-type-detail/tabs/AdvancedTab.tsx: escape quotes and apostrophes
- components/screens/AvailabilityListScreen.tsx: escape quotes in delete confirmation
- Fix react-hooks/rules-of-hooks in RescheduleScreen.tsx:
- Move useMemo calls before conditional early return to ensure hooks
are called in the same order on every render
* fix(companion): fix all ESLint warnings (68 total)
- Fix import/no-named-as-default warnings by using named imports
- Fix @typescript-eslint/no-unused-vars warnings by removing unused imports/variables
- Fix react-hooks/exhaustive-deps warnings with eslint-disable comments
- Convert unused error variables in catch blocks to bare catch
- Remove unused imports (useRouter, Alert, useSafeAreaInsets, etc.)
- All ESLint checks now pass with 0 errors and 0 warnings
* feat(companion): add pre-commit lint check with --max-warnings=0
- Add companion lint check to root lint-staged.config.mjs
- Runs 'bun run lint -- --fix --max-warnings=0' for companion files
- Follows same pattern as apps/packages lint check
- Supports SKIP_WARNINGS=1 env var to bypass warning check if needed
- Commit will fail if any ESLint errors or warnings are present
* fix(companion): restore state variables and imports removed during ESLint fixes
- Restore locationAddress, locationLink, locationPhone state variables in event-type-detail.tsx (still used in fetchEventTypeData)
- Restore Alert import in BookingListScreen.tsx (still used for report booking)
- Add eslint-disable comments for the restored state variables since they're only used by setters
* test
* test
* fix eslint pre commit check
* fix: In React Native, HTML entities like ' are rendered literally as text, not decoded like in web browsers
* refactor(companion): remove ESLint and Prettier config in preparation for Biome
* feat(companion): add Biome for linting and formatting
- Install @biomejs/biome with exact version pinning (2.3.10)
- Add biome.json with formatting settings matching previous Prettier config
- Add lint, format, check, and check:ci scripts to package.json
- Update lint-staged to use Biome instead of Prettier
- Remove Prettier and prettier-plugin-tailwindcss dependencies
- Delete .prettierrc.js configuration file
* style(companion): apply Biome formatting and fix lint-staged config
- Update lint-staged to use 'biome format' instead of 'biome check'
(pre-commit should only format, not lint)
- Apply Biome formatting to all companion files
* feat(companion): configure Biome for strict linting with pre-commit enforcement
- Apply Biome unsafe fixes (unused imports, optional chaining, etc.)
- Configure biome.json rules to disable overly strict rules for existing code:
- noExplicitAny, noArrayIndexKey, useIterableCallbackReturn (suspicious)
- useExhaustiveDependencies, noUnusedFunctionParameters (correctness)
- noStaticOnlyClass (complexity)
- noNonNullAssertion (style)
- noStaticElementInteractions (a11y)
- Update lint-staged to use 'biome check --write --error-on-warnings'
(pre-commit now runs both formatting AND linting, fails on warnings)
* fix(companion): enable noNonNullAssertion rule and fix all violations
- Enable noNonNullAssertion rule in biome.json (set to 'error')
- Fix 7 violations across the codebase:
- hooks/useBookings.ts: Add runtime check before API call
- hooks/useEventTypes.ts: Add runtime check before API call
- hooks/useSchedules.ts: Add runtime check before API call
- extension/entrypoints/content.ts: Add null checks for cache and getAttribute
* fix(companion): enable noStaticOnlyClass and noStaticElementInteractions rules
- Enable noStaticOnlyClass rule in biome.json
- Enable noStaticElementInteractions rule in biome.json
- Convert CalComAPIService from static class to object literal pattern
- Convert WebAuthService from static class to object literal pattern
- Add role="tooltip" to Tooltip.web.tsx for accessibility
* fix(companion): resolve TypeScript type errors in useEffect dependencies and remove unused state property
* fix(companion): enable noUnusedFunctionParameters rule and fix 9 violations
* fix(companion): enable noUnusedVariables rule and fix 4 violations
* fix(companion): enable useIterableCallbackReturn rule and fix 11 violations
* fix(companion): enable useExhaustiveDependencies rule and fix 7 violations
* fix(companion): enable noArrayIndexKey rule and fix 10 violations
* fix(companion): enable noExplicitAny rule and fix all violations
- Enable noExplicitAny rule in biome.json
- Replace any types with proper specific types across all files:
- calcom.ts: Add proper type definitions for API responses and inputs
- event-types.types.ts: Add BookingLimitsCount, BookingLimitsDuration, ConfirmationPolicy types
- buildPartialUpdatePayload.ts: Fix type mismatches for booking limits functions
- booking-actions.ts: Add proper types for booking action handlers
- BookingDetailScreen.tsx, MarkNoShowScreen.tsx: Add types for attendee data
- AvailabilityListItem.ios.tsx, BookingListItem.ios.tsx: Import SFSymbols7_0 type
- extension/content.ts: Fix slot types and __cleanup invocation issues
- Remove unused imports and interfaces
* address cubics comments
* add useHookAtTopLevel rule
193 lines
7.3 KiB
TypeScript
193 lines
7.3 KiB
TypeScript
import { defineConfig } from "wxt";
|
|
|
|
// BUILD_FOR_STORE=true is set by ext:build-prod, ext:zip-prod, etc.
|
|
// Forces production URL (https://companion.cal.com) and excludes localhost permissions
|
|
const isBuildForStore = process.env.BUILD_FOR_STORE === "true";
|
|
|
|
// BROWSER_TARGET is set during build to determine which OAuth credentials to use
|
|
// Values: "chrome" (default), "firefox", "safari", "edge"
|
|
const browserTarget = process.env.BROWSER_TARGET || "chrome";
|
|
|
|
/**
|
|
* Get browser-specific OAuth configuration.
|
|
* Falls back to default (Chrome) config if browser-specific config is not set.
|
|
*/
|
|
function getOAuthConfig() {
|
|
const defaultClientId = process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID || "";
|
|
const defaultRedirectUri = process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI || "";
|
|
|
|
switch (browserTarget) {
|
|
case "firefox":
|
|
return {
|
|
clientId: process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_FIREFOX || defaultClientId,
|
|
redirectUri:
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_FIREFOX || defaultRedirectUri,
|
|
};
|
|
case "safari":
|
|
return {
|
|
clientId: process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_SAFARI || defaultClientId,
|
|
redirectUri: process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_SAFARI || defaultRedirectUri,
|
|
};
|
|
case "edge":
|
|
return {
|
|
clientId: process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_EDGE || defaultClientId,
|
|
redirectUri: process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_EDGE || defaultRedirectUri,
|
|
};
|
|
default:
|
|
return {
|
|
clientId: defaultClientId,
|
|
redirectUri: defaultRedirectUri,
|
|
};
|
|
}
|
|
}
|
|
|
|
export default defineConfig({
|
|
hooks: {
|
|
"build:manifestGenerated": (_wxt, manifest) => {
|
|
manifest.browser_specific_settings ??= {};
|
|
manifest.browser_specific_settings.gecko ??= {};
|
|
manifest.browser_specific_settings.gecko.data_collection_permissions = {
|
|
required: ["none"],
|
|
};
|
|
},
|
|
},
|
|
srcDir: "extension",
|
|
entrypointsDir: "entrypoints",
|
|
publicDir: "extension/public",
|
|
outDir: ".output",
|
|
manifest: {
|
|
name: "Cal.com Companion",
|
|
version: "1.7.5",
|
|
description: "Your calendar companion for quick booking and scheduling",
|
|
permissions: ["activeTab", "storage", "identity"],
|
|
host_permissions: [
|
|
"https://companion.cal.com/*",
|
|
"https://api.cal.com/*",
|
|
"https://app.cal.com/*",
|
|
"https://mail.google.com/*",
|
|
"https://calendar.google.com/*",
|
|
// Include localhost permission for dev builds (needed for iframe to load)
|
|
// ...(!isBuildForStore ? ["http://localhost:*/*"] : []),
|
|
],
|
|
content_security_policy: {
|
|
extension_pages: !isBuildForStore
|
|
? "script-src 'self'; object-src 'self'; frame-src 'self' https://companion.cal.com http://localhost:*"
|
|
: "script-src 'self'; object-src 'self'; frame-src 'self' https://companion.cal.com",
|
|
},
|
|
action: {
|
|
default_title: "Cal.com Companion",
|
|
default_icon: {
|
|
"16": "icon-16.png",
|
|
"48": "icon-48.png",
|
|
"128": "icon-128.png",
|
|
},
|
|
},
|
|
icons: {
|
|
"16": "icon-16.png",
|
|
"48": "icon-48.png",
|
|
"128": "icon-128.png",
|
|
},
|
|
},
|
|
vite: () => {
|
|
// Determine companion URL based on build type
|
|
const devUrl = isBuildForStore ? "" : process.env.EXPO_PUBLIC_COMPANION_DEV_URL || "";
|
|
const isLocalDev = Boolean(devUrl?.includes("localhost"));
|
|
|
|
// Get OAuth config for the target browser
|
|
const oauthConfig = getOAuthConfig();
|
|
|
|
// Log build mode for clarity
|
|
if (isBuildForStore) {
|
|
console.log("\n🏪 STORE BUILD: Using https://companion.cal.com\n");
|
|
} else if (isLocalDev) {
|
|
console.log(`\n🔧 DEV BUILD: Using ${devUrl}\n`);
|
|
}
|
|
console.log(`🌐 Browser Target: ${browserTarget}\n`);
|
|
|
|
return {
|
|
resolve: {
|
|
alias: {
|
|
"react-native": "react-native-web",
|
|
},
|
|
},
|
|
define: {
|
|
global: "globalThis",
|
|
__DEV__: JSON.stringify(false),
|
|
|
|
// Browser target for runtime detection
|
|
"import.meta.env.BROWSER_TARGET": JSON.stringify(browserTarget),
|
|
|
|
// Default OAuth config (Chrome/Brave) - always available for fallback
|
|
"import.meta.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI
|
|
),
|
|
|
|
// Browser-specific OAuth config (resolved based on BROWSER_TARGET)
|
|
"import.meta.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_FIREFOX": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_FIREFOX
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_FIREFOX": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_FIREFOX
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_SAFARI": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_SAFARI
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_SAFARI": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_SAFARI
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_EDGE": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_EDGE
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_EDGE": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_EDGE
|
|
),
|
|
|
|
// Pre-resolved OAuth config for the build target (for convenience)
|
|
"process.env.EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID": JSON.stringify(oauthConfig.clientId),
|
|
"process.env.EXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI": JSON.stringify(
|
|
oauthConfig.redirectUri
|
|
),
|
|
|
|
// Use devUrl which respects BUILD_FOR_STORE flag
|
|
"import.meta.env.EXPO_PUBLIC_COMPANION_DEV_URL": JSON.stringify(devUrl),
|
|
"import.meta.env.EXPO_PUBLIC_CACHE_STALE_TIME_MINUTES": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CACHE_STALE_TIME_MINUTES
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_CACHE_GC_TIME_MINUTES": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CACHE_GC_TIME_MINUTES
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_BOOKINGS_CACHE_STALE_TIME_MINUTES": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_BOOKINGS_CACHE_STALE_TIME_MINUTES
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_EVENT_TYPES_CACHE_STALE_TIME_MINUTES": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_EVENT_TYPES_CACHE_STALE_TIME_MINUTES
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_SCHEDULES_CACHE_STALE_TIME_MINUTES": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_SCHEDULES_CACHE_STALE_TIME_MINUTES
|
|
),
|
|
"import.meta.env.EXPO_PUBLIC_USER_PROFILE_CACHE_STALE_TIME_MINUTES": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_USER_PROFILE_CACHE_STALE_TIME_MINUTES
|
|
),
|
|
...(process.env.NODE_ENV !== "production" && process.env.EXPO_PUBLIC_CAL_API_KEY
|
|
? {
|
|
"import.meta.env.EXPO_PUBLIC_CAL_API_KEY": JSON.stringify(
|
|
process.env.EXPO_PUBLIC_CAL_API_KEY
|
|
),
|
|
}
|
|
: {}),
|
|
},
|
|
optimizeDeps: {
|
|
include: ["react-native-web"],
|
|
esbuildOptions: {
|
|
loader: {
|
|
".js": "jsx",
|
|
},
|
|
},
|
|
},
|
|
};
|
|
},
|
|
});
|