chore: drop unused exports flagged by only-export-components#8130
Conversation
Three component files exported helpers/variants that no callers actually use. The unused `export` keyword causes Fast Refresh to treat the file as a "mixed exports" boundary and skip HMR for the component on every save: - template-tags.tsx: `getRoleBasedStyling` used only locally - ResponseDataView.tsx: `formatAddressData` / `formatContactInfoData` / `extractResponseData` annotated "Export for testing" but no test imports them (dead public surface) - multi-select/badge.tsx: `badgeVariants` referenced only within the same file Removing the `export` keyword is the smallest correct fix per react-doctor/only-export-components (Architecture, error). Note: the other 13 hits in this cluster (10 mixed-export source files + 3 Storybook stories files) need actual file-creation refactors (extract helpers to sibling utils/types files), or are arguably out-of-scope for the rule on Storybook stories which have their own HMR. They are intentionally left for a follow-up. Verified via `pnpm --filter @formbricks/web test`: 5166/5166 pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WalkthroughThis PR reduces the public API surface across three web modules by making internal helper functions private. In 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
apps/web/app/(app)/workspaces/[workspaceId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.tsxESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. apps/web/modules/survey/components/template-list/components/template-tags.tsxESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. apps/web/modules/ui/components/multi-select/badge.tsxESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@apps/web/app/`(app)/workspaces/[workspaceId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.tsx:
- Around line 51-52: The variable typing in extractResponseData currently uses
Record<string, any>, which weakens type safety; change the type to avoid any by
using Record<string, unknown> or, preferably, the shared response value type
from `@formbricks/types` (e.g., ResponseValue or equivalent) for responseData and
the function return type, and if possible let TypeScript infer the return type
instead of an explicit annotation; update the signature of
extractResponseData(response: TResponseWithQuotas, survey: TSurvey) and the
local responseData binding to use the chosen safer type.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: ac311111-3b50-4af7-84e1-b580162e9c3b
📒 Files selected for processing (3)
apps/web/app/(app)/workspaces/[workspaceId]/surveys/[surveyId]/(analysis)/responses/components/ResponseDataView.tsxapps/web/modules/survey/components/template-list/components/template-tags.tsxapps/web/modules/ui/components/multi-select/badge.tsx
|



Summary
Three component files exported helpers/variants that no callers actually use. The unused
exportkeyword forces Fast Refresh to treat the file as a "mixed exports" boundary and skip HMR for the component on every save during dev.template-tags.tsxgetRoleBasedStylingResponseDataView.tsxformatAddressData,formatContactInfoData,extractResponseData(each marked "// Export for testing")multi-select/badge.tsxbadgeVariantsBadge)Removing the
exportkeyword is the smallest correct fix perreact-doctor/only-export-components(Architecture, error).Why this PR only covers 3 of the 16 findings
The remaining 13 hits in this cluster split into two groups, both intentionally out of scope here:
Source files where the second export is genuinely public —
preview-email-template.tsx(getPreviewEmailTemplateHtmlis imported fromemailTemplate.tsx),MappingRow.tsx(TMapping/createEmptyMappingused byAddIntegrationModal.tsx),add-filter-modal.tsx(handleAddFilter),ElementsComboBox.tsx(OptionsTypeenum + types),ResponseTableColumns.tsx. Each requires creating a sibling*.utils.tsor*.types.tsfile plus updating all importers — a real refactor that should be its own PR.Storybook stories files (6 of them:
confirmation-modal/stories.tsx,delete-dialog/stories.tsx,dialog/stories.tsx,slider/stories.tsx,tag/stories.tsx,tab-nav/stories.tsx). Storybook ships its own HMR; Fast Refresh's "single-export-per-file" assumption doesn't apply the same way. Worth a project-level config exclusion inreact-doctor.config.jsonrather than touching every file.Test plan
Verified locally:
pnpm --filter @formbricks/web test— 5166 / 5166 pass🤖 Generated with Claude Code