chore(frontend): enforce TypeScript-only source files#41385
Conversation
The frontend is mid-migration to full TypeScript and every file under the application source trees (src/, packages/*/src/, plugins/*/src/) is already .ts/.tsx — but nothing enforced it. The oxlint react/jsx-filename-extension rule only flags JSX in the wrong extension (missing plain .js files) and would false-positive on legitimate config files like .storybook/preview.jsx. Add a scoped check to check-custom-rules.js (already wired into pre-commit and lint:full) that fails when a .js/.jsx file is added under the source trees, including test files. Root-level configs and build artifacts are intentionally left alone. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Code Review Agent Run #c3f400Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41385 +/- ##
=======================================
Coverage 63.84% 63.84%
=======================================
Files 2654 2654
Lines 145386 145386
Branches 33557 33557
=======================================
Hits 92825 92825
Misses 50864 50864
Partials 1697 1697
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Claude Code <noreply@anthropic.com>
SUMMARY
The frontend is mid-migration to full TypeScript, and every file under the application source trees (
src/,packages/*/src/,plugins/*/src/) is already.ts/.tsx— but nothing actually enforced it. A new.js/.jsxfile (including tests) could slip through review, which is exactly what happened on #37131 (auseExploreAdditionalActionsMenu.test.jsxthat only got caught by an AI reviewer).I looked at the obvious lever first — oxlint's
react/jsx-filename-extension— but it isn't a good fit:.jsfile with no JSX slips through..tsx-only would false-positive on legitimate config files like.storybook/preview.jsxand the root*.config.jsfiles.Instead this adds a small, scoped check to
scripts/check-custom-rules.js— which is already wired into pre-commit (custom rules (frontend)) andnpm run lint:full. It fails when a.js/.jsxfile is added under the three application source trees, including test files. Root-level configs (webpack.config.js,.storybook/preview.jsx, etc.) and build artifacts (lib/,esm/,dist/) live outside those trees and are intentionally left alone.The check runs on the raw staged-file list (before the existing color/i18n ignore patterns strip out tests/stories), so
*.test.jsxis correctly rejected.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (lint tooling).
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
🤖 Generated with Claude Code