mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-23 19:49:08 -05:00
chore: drop unused exports flagged by only-export-components
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>
This commit is contained in:
+3
-6
@@ -38,20 +38,17 @@ const formatArrayToRecord = (responseValue: TResponseDataValue, keys: string[]):
|
||||
return result;
|
||||
};
|
||||
|
||||
// Export for testing
|
||||
export const formatAddressData = (responseValue: TResponseDataValue): Record<string, string> => {
|
||||
const formatAddressData = (responseValue: TResponseDataValue): Record<string, string> => {
|
||||
const addressKeys = ["addressLine1", "addressLine2", "city", "state", "zip", "country"];
|
||||
return formatArrayToRecord(responseValue, addressKeys);
|
||||
};
|
||||
|
||||
// Export for testing
|
||||
export const formatContactInfoData = (responseValue: TResponseDataValue): Record<string, string> => {
|
||||
const formatContactInfoData = (responseValue: TResponseDataValue): Record<string, string> => {
|
||||
const contactInfoKeys = ["firstName", "lastName", "email", "phone", "company"];
|
||||
return formatArrayToRecord(responseValue, contactInfoKeys);
|
||||
};
|
||||
|
||||
// Export for testing
|
||||
export const extractResponseData = (response: TResponseWithQuotas, survey: TSurvey): Record<string, any> => {
|
||||
const extractResponseData = (response: TResponseWithQuotas, survey: TSurvey): Record<string, any> => {
|
||||
const responseData: Record<string, any> = {};
|
||||
|
||||
const elements = getElementsFromBlocks(survey.blocks);
|
||||
|
||||
@@ -17,7 +17,7 @@ interface TemplateTagsProps {
|
||||
|
||||
type NonNullabeChannel = NonNullable<TWorkspaceConfigChannel>;
|
||||
|
||||
export const getRoleBasedStyling = (role: TTemplateRole | undefined): string => {
|
||||
const getRoleBasedStyling = (role: TTemplateRole | undefined): string => {
|
||||
switch (role) {
|
||||
case "productManager":
|
||||
return "border-blue-300 bg-blue-50 text-blue-500";
|
||||
|
||||
@@ -26,4 +26,4 @@ function Badge({ className, variant, ...props }: BadgeProps) {
|
||||
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
|
||||
}
|
||||
|
||||
export { Badge, badgeVariants };
|
||||
export { Badge };
|
||||
|
||||
Reference in New Issue
Block a user