Skip to content

Conversation

@loleek
Copy link

@loleek loleek commented Feb 12, 2026

Summary

  • Add JSX and TSX language mapping in detectLangFromRuleID function (scanner/astgrep.go:198-201)
  • Improve TypeScript rules to use kind: import_statement for better accuracy
  • Add arrow_function support to function detection
  • Create dedicated rule files for JSX and TSX languages

Problem

Codemap was unable to properly scan React/TypeScript projects that use .jsx and .tsx file extensions, as these file types were not recognized in the ast-grep language detection
logic.

Solution

This PR adds support for JSX and TSX files by:

  1. Mapping tsxtypescript and jsxjavascript in the language detector
  2. Creating dedicated ast-grep rule files for both JSX and TSX
  3. Refining TypeScript import rules to use AST kind matching instead of patterns

Test plan

  • Test scanning a React project with .jsx files
  • Test scanning a TypeScript React project with .tsx files
  • Verify import detection works correctly with the new kind: import_statement rule
  • Confirm arrow functions are detected properl

- Add tsx and jsx language mapping in detectLangFromRuleID function
- Improve TypeScript rules to use kind: import_statement for better accuracy
- Add arrow_function support to function detection
- Create dedicated rule files for JSX and TSX languages

This fix enables codemap to properly scan React/TypeScript projects
that use .jsx and .tsx file extensions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants