Skip to content

Commit

Permalink
feat(js): improve unanchored pattern defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
cfabianski committed Mar 1, 2024
1 parent 2af3b49 commit ee2660d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/languages/javascript/pattern/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ee2660d

Please sign in to comment.