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>)
| 197 | /// inner is the inline render function, or None for `styled.x`/`memo(Ref)`. |
| 198 | /// Outer None = not a component wrapper. |
| 199 | fn react_component_hoc(&self, value: Node<'t>) -> Option<Option<Node<'t>>> { |
| 200 | if self.is_typed_styled_template(value) { |
| 201 | return Some(None); |
| 202 | } |
| 203 | if value.kind() != "call_expression" { |
| 204 | return None; |
| 205 | } |
| 206 | let callee = value.child_by_field_name("function")?; |
| 207 | let callee_text = self.text(callee); |
| 208 | if util::styled_callee().is_match(callee_text) { |
| 209 | return Some(None); |
| 210 | } |
| 211 | if !is_react_hoc(callee_text) { |
| 212 | return None; |
| 213 | } |
| 214 | let mut inner: Option<Node> = None; |
| 215 | if let Some(args) = value.child_by_field_name("arguments") { |
| 216 | for i in 0..args.named_child_count() { |
| 217 | if let Some(a) = args.named_child(i) { |
| 218 | if matches!(a.kind(), "arrow_function" | "function_expression") { |
| 219 | inner = Some(a); |
| 220 | break; |
| 221 | } |
| 222 | } |
| 223 | } |
| 224 | } |
| 225 | Some(inner) |
| 226 | } |
| 227 | |
| 228 | /// A typed styled tag, `styled.div<Props>` before a template literal, which |
| 229 | /// parses as comparisons: `(styled.div < Props) > template`. The leftmost |
no test coverage detected