AGENTS.md: jsx -> js

This commit is contained in:
Alex Gleason committed 2025-09-02 09:25:02 -05:00
1 parent a55b3418f4
commit de59de94c3
1 file changed
+6 -6
+6 -6
View File
@@ -814,19 +814,19 @@ The router includes automatic scroll-to-top functionality and a 404 NotFound pag
### Import Extensions
This project uses ES modules with Node.js-style module resolution (`"type": "module"` and `"moduleResolution": "nodenext"`). **All imports MUST include explicit file extensions**, and specifically **`.js`/`.jsx` extensions must be used** even when importing TypeScript files.
This project uses ES modules with Node.js-style module resolution (`"type": "module"` and `"moduleResolution": "nodenext"`). **All imports MUST include explicit file extensions**, and specifically **`.js` extensions must be used** even when importing TypeScript files.
This is because TypeScript compiles to JavaScript, and the runtime expects the actual file extensions that will exist after compilation.
#### Examples
**✅ Correct imports with .js/.jsx extensions:**
**✅ Correct imports with .js extensions:**
```typescript
// Import TypeScript files with .js extension
import { useAuthor } from '@/hooks/useAuthor.js';
import { Button } from '@/components/ui/button.jsx';
import { LoginArea } from "@/components/auth/LoginArea.jsx";
import AppRouter from "./AppRouter.jsx";
import { Button } from '@/components/ui/button.js';
import { LoginArea } from "@/components/auth/LoginArea.js";
import AppRouter from "./AppRouter.js";
import { cn } from '@/lib/utils.js';
```
@@ -835,7 +835,7 @@ import { cn } from '@/lib/utils.js';
// These will cause build/runtime errors
import { useAuthor } from '@/hooks/useAuthor';
import { Button } from '@/components/ui/button.tsx';
import { LoginArea } from "@/components/auth/LoginArea";
import { LoginArea } from "@/components/auth/LoginArea.jsx";
import AppRouter from "./AppRouter";
import { cn } from '@/lib/utils.ts';
```