-
-
Notifications
You must be signed in to change notification settings - Fork 722
Labels
Description
https://github.com/oxc-project/oxlint-ecosystem-ci/actions/runs/18092538318/job/51476523649
× eslint-plugin-react-hooks(rules-of-hooks): React Hook "useMostRelevantBreakdownType" is called in function "Anonymous" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".
╭─[frontend/src/scenes/insights/utils/cleanFilters.ts:130:30]
129 │
130 │ ╭─▶ const cleanBreakdownParams = (cleanedParams: Partial<FilterType>, filters: Partial<FilterType>): void => {
131 │ │ const isStepsFunnel = isFunnelsFilter(filters) && filters.funnel_viz_type === FunnelVizType.Steps
132 │ │ const isTrendsFunnel = isFunnelsFilter(filters) && filters.funnel_viz_type === FunnelVizType.Trends
133 │ │ const isTrends = isTrendsFilter(filters)
134 │ │ const canBreakdown = isStepsFunnel || isTrendsFunnel || isTrends
135 │ │
136 │ │ const canMultiPropertyBreakdown = isStepsFunnel
137 │ │
138 │ │ cleanedParams['breakdowns'] = undefined
139 │ │ cleanedParams['breakdown'] = undefined
140 │ │ cleanedParams['breakdown_type'] = undefined
141 │ │ cleanedParams['breakdown_group_type_index'] = undefined
142 │ │ cleanedParams['breakdown_normalize_url'] = undefined
143 │ │
144 │ │ if (isTrends && filters.display === ChartDisplayType.WorldMap) {
145 │ │ // For the map, make sure we are breaking down by country
146 │ │ // Support automatic switching to country code breakdown both from no breakdown and from country name breakdown
147 │ │ cleanedParams['breakdown'] = '$geoip_country_code'
148 │ │ // this isn't a react hook
149 │ │ // oxlint-disable-next-line react-hooks/rules-of-hooks
150 │ │ useMostRelevantBreakdownType(cleanedParams, filters)
151 │ │ return
152 │ │ }
153 │ │
154 │ │ if (canBreakdown) {
155 │ │ if (filters.breakdown_type && (filters.breakdown || filters.breakdowns)) {
156 │ │ cleanedParams['breakdown_type'] = filters.breakdown_type
157 │ │ }
158 │ │
159 │ │ if (canMultiPropertyBreakdown && filters.breakdowns && filters.breakdowns.length > 0) {
160 │ │ cleanedParams['breakdowns'] = filters.breakdowns
161 │ │ } else if (isTrends && filters.breakdowns && filters.breakdowns.length > 0) {
162 │ │ cleanedParams['breakdown_type'] = undefined
163 │ │ cleanedParams['breakdowns'] = filters.breakdowns.map((b) => ({
164 │ │ property: b.property,
165 │ │ type: b.type || filters.breakdown_type || 'event',
166 │ │ histogram_bin_count: b.histogram_bin_count,
167 │ │ group_type_index: b.group_type_index,
168 │ │ normalize_url:
169 │ │ typeof b.property === 'string'
170 │ │ ? cleanBreakdownNormalizeURL(
171 │ │ b.property,
172 │ │ typeof b.normalize_url === 'boolean' ? b.normalize_url : filters.breakdown_normalize_url
173 │ │ )
174 │ │ : undefined,
175 │ │ }))
176 │ │ } else if (filters.breakdown) {
177 │ │ cleanedParams['breakdown'] = filters.breakdown
178 │ │ cleanedParams['breakdown_normalize_url'] = cleanBreakdownNormalizeURL(
179 │ │ filters.breakdown as string,
180 │ │ filters.breakdown_normalize_url
181 │ │ )
182 │ │ }
183 │ │
184 │ │ if (filters.breakdown_type === 'group' && filters.breakdown_group_type_index != undefined) {
185 │ │ cleanedParams['breakdown_group_type_index'] = filters.breakdown_group_type_index
186 │ │ }
187 │ │ }
188 │ ╰─▶ }
189 │
╰────