-
Notifications
You must be signed in to change notification settings - Fork 11.5k
feat(companion): add Biome for linting and formatting #26214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Remove package-lock.json that was accidentally committed - Update bun.lock with ESLint dependencies
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
- 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 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
- 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
…Lint 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 33 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="companion/components/booking-modals/BookingModals.tsx">
<violation number="1" location="companion/components/booking-modals/BookingModals.tsx:237">
P1: Using `&apos;` in React Native `<Text>` will render as literal "&apos;" instead of an apostrophe. React Native doesn't decode HTML entities like web browsers. Use a JavaScript string instead.</violation>
</file>
Reply to cubic to teach it or ask questions. Tag @cubic-dev-ai to re-run a review.
…y as text, not decoded like in web browsers
volnei
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhairyashiil we're going to use biome instead eslint/prettier... 🙂
- 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
- 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
…nforcement - 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)
- 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
…ons 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
…ies and remove unused state property
- 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 106 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="companion/components/Tooltip.web.tsx">
<violation number="1" location="companion/components/Tooltip.web.tsx:22">
P2: The `role="tooltip"` is applied to the wrong element. According to WAI-ARIA, this role should be on the popup content (the inner span that displays `{text}`), not the container/trigger element. Screen readers may incorrectly interpret the entire wrapper as a tooltip.
Consider moving the role to the inner span and using `role="presentation"` or no role on the outer span, or restructuring to use a semantically appropriate element for the trigger.</violation>
</file>
<file name="companion/components/screens/AvailabilityDetailScreen.tsx">
<violation number="1" location="companion/components/screens/AvailabilityDetailScreen.tsx:602">
P2: The key `${slot.startTime}-${slot.endTime}` may produce duplicate keys if multiple time slots have identical times. Include `slotIndex` in the key to guarantee uniqueness.</violation>
</file>
<file name="companion/components/event-type-detail/utils/buildPartialUpdatePayload.ts">
<violation number="1" location="companion/components/event-type-detail/utils/buildPartialUpdatePayload.ts:263">
P1: Key mismatch bug: `originalLimits` uses uppercase keys (`PER_DAY`, `PER_WEEK`, etc.) but `currentLimits` uses lowercase keys from `parseFrequencyUnit()` (`day`, `week`, etc.). This will cause the function to always return `true` (changed) even when values haven't changed.</violation>
</file>
Reply to cubic to teach it or ask questions. Tag @cubic-dev-ai to re-run a review.
What does this PR do?
Replaces ESLint and Prettier with Biome for linting and formatting in the companion app. Biome is a fast, all-in-one toolchain that handles both linting and formatting with a single configuration file.
Changes:
biome.jsonconfiguration with formatting settings matching previous Prettier config (2 spaces, double quotes, semicolons, trailing commas ES5, line width 100)lint,format,format:check,check,check:cilint-stagedto usebiome check --write --error-on-warningsfor pre-commit (runs both formatting AND linting, fails on warnings)eslint,eslint-config-expo,eslint-config-prettier,eslint-plugin-prettier,prettier,prettier-plugin-tailwindcss).prettierrc.jsconfiguration fileNote: Tailwind CSS class sorting is no longer automatically applied since Biome doesn't have a Tailwind plugin. This was a conscious tradeoff for simpler tooling.
Updates since last revision
Enabled
noUnusedVariablesrule (4 violations fixed):AuthTokenProvider.tsx: PrefixedisWebSessionwith underscore (destructured from useAuth but not used)calcom.ts: PrefixedisOrganizer,isHost,isAttendeewith underscore (onlyisParticipatingis used for filtering)Previously enabled lint rules:
noUnusedFunctionParameters(9 violations): Prefixed unused params with underscore to indicate intentionally unusednoUnusedVariables(4 violations): Prefixed unused variables with underscorenoStaticOnlyClass(2 violations): ConvertedCalComAPIServiceandWebAuthServicefrom static classes to module-level functionsnoStaticElementInteractions(1 violation): Addedrole="tooltip"to interactive span inTooltip.web.tsxnoNonNullAssertion(7 violations): Added runtime checks in hooks and extension codeFixed 13 TypeScript errors (all
bun typecheck:allerrors resolved):AuthContext.tsx: ConvertedcheckAuthState,logout,saveOAuthTokens,clearAuth,resetAuthState,handleOAuthAuth,handleWebSessionAuthtouseCallbackand moved before useEffectAvailabilityDetailScreen.tsx: ConvertedfetchScheduletouseCallbackwith proper dependenciesBookingDetailScreen.tsx: ConvertedfetchBookingtouseCallbackwith proper dependenciesHeader.tsx: ConvertedfetchUserProfiletouseCallbackwith proper dependenciesbuildPartialUpdatePayload.ts: Added?? []fallback for possibly undefinedoriginalMappedarrayoauthService.ts: Removed unusedstateproperty assignments (dead code)Remaining disabled rules for existing codebase:
noExplicitAny,noArrayIndexKey,useIterableCallbackReturn(suspicious)useExhaustiveDependencies(correctness)Mandatory Tasks (DO NOT REMOVE)
bun run checkandbun run typecheck:all.How should this be tested?
companionfolderbun install(if needed)bun run check- should pass with no errors or warningsbun run format:check- should pass (all files formatted)bun run typecheck:all- should pass (both app and extension)Human Review Checklist
calcom.ts-isOrganizer,isHost,isAttendeeare destructured but onlyisParticipatingis used for filtering bookings. Verify this is intentional vs. incomplete filtering logicisWebSessioninAuthTokenProvider.tsx- Verify this unused variable isn't needed for conditional token handling logicBookingModals.tsx- 5 reschedule-related props are unused. Verify this is intentional (reschedule modal moved elsewhere) vs incomplete implementation that should be cleaned upBookingListItem.ios.tsxandEventTypeListItem.ios.tsxhave unused props that are part of shared interfaces but not needed for iOS context menu implementationuseCallbackdependency arrays - Verify the dependency arrays inAuthContext.tsx,AvailabilityDetailScreen.tsx,BookingDetailScreen.tsx, andHeader.tsxinclude all necessary dependencies and won't cause stale closuresCalComAPIServiceconversion - Verify the conversion from static class to module functions maintains all functionality. The file is 1500+ lines with 40+ methodsWebAuthServiceconversion - Same pattern as above, verify all internal references were updated correctlystateproperty in oauthService.ts - Thestatewas being assigned but never read for CSRF verification. Confirm this dead code removal is safebiome.jsonconfiguration matches team coding standardsChecklist
Link to Devin run: https://app.devin.ai/sessions/464fb766dbb547958648f4c98afa3622
Requested by: Dhairyashil Shinde (@dhairyashiil)