Skip to content

Commit

Permalink
feat(js): check anonymous types (#1522)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfabianski committed Feb 29, 2024
1 parent b070bf3 commit 2af3b49
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/languages/javascript/pattern/pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var (
matchNodeRegex = regexp.MustCompile(`\$<!>`)
ellipsisRegex = regexp.MustCompile(`\$<\.\.\.>`)

patternMatchNodeContainerTypes = []string{"import_clause", "import_specifier", "required_parameter"}
patternMatchNodeContainerTypes = []string{"import_clause", "import_specifier", "required_parameter", "option_parameter"}

allowedPatternQueryTypes = []string{"identifier", "property_identifier", "_", "member_expression", "string", "template_string"}
)
Expand Down Expand Up @@ -126,6 +126,12 @@ func (*Pattern) NodeTypes(node *tree.Node) []string {
return []string{node.Type()}
}

func (*Pattern) AnonymousParentTypes() []string {
return []string{
"binary_expression",
}
}

func (*Pattern) FixupVariableDummyValue(input []byte, node *tree.Node, dummyValue string) string {
parent := node.Parent()
if parent == nil {
Expand Down

0 comments on commit 2af3b49

Please sign in to comment.