Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scanner/astgrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,12 @@ func detectLangFromRuleID(ruleID string) string {
return "go"
case "ts":
return "typescript"
case "tsx":
return "typescript"
case "js":
return "javascript"
case "jsx":
return "javascript"
case "py":
return "python"
case "rust":
Expand Down
12 changes: 12 additions & 0 deletions scanner/sg-rules/jsx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
id: jsx-imports
language: jsx
rule:
kind: import_statement
---
id: jsx-functions
language: jsx
rule:
any:
- kind: function_declaration
- kind: method_definition
- kind: arrow_function
12 changes: 12 additions & 0 deletions scanner/sg-rules/tsx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
id: tsx-imports
language: tsx
rule:
kind: import_statement
---
id: tsx-functions
language: tsx
rule:
any:
- kind: function_declaration
- kind: method_definition
- kind: arrow_function
6 changes: 2 additions & 4 deletions scanner/sg-rules/typescript.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
id: ts-imports
language: typescript
rule:
any:
- pattern: import $$$_ from "$PATH"
- pattern: import "$PATH"
- pattern: require("$PATH")
kind: import_statement
---
id: ts-functions
language: typescript
rule:
any:
- kind: function_declaration
- kind: method_definition
- kind: arrow_function
Loading