From ee2660d908f812f4082fe239521c738a00026354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Fabianski?= Date: Fri, 1 Mar 2024 15:44:27 +0100 Subject: [PATCH] feat(js): improve unanchored pattern defaults --- internal/languages/javascript/pattern/pattern.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/languages/javascript/pattern/pattern.go b/internal/languages/javascript/pattern/pattern.go index f7fae3251..97bba6abb 100644 --- a/internal/languages/javascript/pattern/pattern.go +++ b/internal/languages/javascript/pattern/pattern.go @@ -104,7 +104,16 @@ func (*Pattern) IsAnchored(node *tree.Node) (bool, bool) { // arrow functions statement_block // function statement_block // method statement_block - unAnchored := []string{"statement_block", "class_body", "object_pattern", "named_imports", "method_definition"} + unAnchored := []string{ + "statement_block", + "class_body", + "object_pattern", + "named_imports", + "method_definition", + "arrow_function", + "function_expression", + "required_parameter", + } isAnchored := !slices.Contains(unAnchored, parent.Type()) return isAnchored, isAnchored