Some(inner) when the initializer is a recognized component wrapper — inner is the inline render function, or None for `styled.x`/`memo(Ref)`. Outer None = not a component wrapper.
(&self, value: Node<'t>)
| 293 | /// inner is the inline render function, or None for `styled.x`/`memo(Ref)`. |
| 294 | /// Outer None = not a component wrapper. |
| 295 | fn react_component_hoc(&self, value: Node<'t>) -> Option<Option<Node<'t>>> { |
| 296 | if self.is_typed_styled_template(value) { |
| 297 | return Some(None); |
| 298 | } |
| 299 | if value.kind() != "call_expression" { |
| 300 | return None; |
| 301 | } |
| 302 | let callee = value.child_by_field_name("function")?; |
| 303 | let callee_text = self.text(callee); |
| 304 | if util::styled_callee().is_match(callee_text) { |
| 305 | return Some(None); |
| 306 | } |
| 307 | if !is_react_hoc(callee_text) { |
| 308 | return None; |
| 309 | } |
| 310 | let mut inner: Option<Node> = None; |
| 311 | if let Some(args) = value.child_by_field_name("arguments") { |
| 312 | for i in 0..args.named_child_count() { |
| 313 | if let Some(a) = args.named_child(i) { |
| 314 | if matches!(a.kind(), "arrow_function" | "function_expression") { |
| 315 | inner = Some(a); |
| 316 | break; |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | Some(inner) |
| 322 | } |
| 323 | |
| 324 | /// A typed styled tag, `styled.div<Props>` before a template literal, which |
| 325 | /// parses as comparisons: `(styled.div < Props) > template`. The leftmost |
no test coverage detected