codeflash-internal/django/aiservice
mohammed ahmed 8d987de65c
Fix TypeScript validator to support JSX/TSX syntax (#2503)
## Summary

The TypeScript validator was rejecting valid JSX/TSX syntax, causing
optimization runs to fail on React components with JSX.

## Problem

The validator was using `tree_sitter_typescript.language_typescript()`
which doesn't parse JSX syntax. This caused validation failures for
`.tsx` files containing JSX elements like:
- `<div className={...} />`
- `{...rest}` (spread props)
- Any JSX tags

## Solution

Changed to use `tree_sitter_typescript.language_tsx()` instead. Since
TSX is a superset of TypeScript, this supports both:
- Plain TypeScript code
- TypeScript with JSX (TSX)

## Testing

Added three new test cases:
- `test_tsx_simple_jsx` - Tests basic JSX elements
- `test_tsx_nested_jsx` - Tests nested JSX
- `test_tsx_with_props_spread` - Tests spread props in JSX

All existing tests continue to pass.

## Impact

This fixes validation errors for all React/JSX components. Affected
trace IDs from logs:
- 5bedfbb7-ccc0-4fdd-b208-60b8b860750c
- 39892d42-774f-4921-80fc-2ee42ff8ae1c
- 80b818b6-e784-4ff8-abda-c3ce6b25422f
- 9b76943e-1a93-45fa-84b9-aae7d6305f79
- d1bac014-d622-4772-90ea-0f9ff88e32dd

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codeflash Bot <codeflash-bot@codeflash.ai>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-01 04:20:41 -05:00
..
aiservice Fix TypeScript validator to support JSX/TSX syntax (#2503) 2026-04-01 04:20:41 -05:00
authapp refactor: aiservice deep dive — LLM client, dedup, async, cleanup (#2482) 2026-03-22 01:53:32 -05:00
core Fix PostgreSQL connection pool exhaustion in log_features 2026-03-31 23:49:51 +00:00
tests Fix TypeScript validator to support JSX/TSX syntax (#2503) 2026-04-01 04:20:41 -05:00
.env.example add claude 2025-12-22 03:34:07 -05:00
.pre-commit-config.yaml feat: add ty type checker to pre-k hooks (#2213) 2026-01-09 22:36:53 -05:00
CLAUDE.md docs: restructure CLAUDE.md files into modular rules 2026-02-14 19:36:21 -05:00
deploy Make aiservice deployment use Python 3.12 2024-03-06 18:22:51 -08:00
gunicorn.conf.py Refactor out aiservice manage.py and associated settings to the correct top-level dir so tests can run. Fix ellipsis in AST; allow ellipsis if they are in type annotations. 2024-05-31 16:51:43 -07:00
manage.py ruff check fixes 2025-08-07 14:35:21 -07:00
mypy_allowlist.txt Reorganize top-level feature modules under core/ (#2416) 2026-02-14 17:07:40 -05:00
pyproject.toml feat: migrate from psycopg2 to psycopg3 with connection pooling (#2489) 2026-03-27 05:33:33 -05:00
pytest.ini Further fix django folder structure so pytest also works 2024-05-31 20:01:51 -07:00
README.md Move codeflash python code base to cli/ 2023-12-29 18:37:49 -08:00
runtests.py Sort imports for generated tests too, also try adding some tests to test this, but spent an hour trying to get the django test runner to work and couldn't get it to find the tests, so punting for now 2024-03-05 16:33:50 -08:00
start_gunicorn.sh let's download at import time instead 2024-09-09 19:59:29 -05:00
uv.lock feat: migrate from psycopg2 to psycopg3 with connection pooling (#2489) 2026-03-27 05:33:33 -05:00
uvicorn_worker.py ruff check fixes 2025-08-07 14:36:23 -07:00

This is django-ninja project for the ai service. https://django-ninja.dev