rusackas opened a new pull request, #41385:
URL: https://github.com/apache/superset/pull/41385

   ### 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`/`.jsx` 
file (including tests) could slip through review, which is exactly what 
happened on #37131 (a `useExploreAdditionalActionsMenu.test.jsx` that 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:
   - It only flags JSX in the wrong extension, so a plain `.js` file with no 
JSX slips through.
   - It scans the whole frontend, so tightening it to `.tsx`-only would 
false-positive on legitimate config files like `.storybook/preview.jsx` and the 
root `*.config.js` files.
   
   Instead this adds a small, **scoped** check to 
`scripts/check-custom-rules.js` — which is already wired into pre-commit 
(`custom rules (frontend)`) and `npm run lint:full`. It fails when a 
`.js`/`.jsx` file 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.jsx` is correctly rejected.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A (lint tooling).
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   
   # Passes on the current tree (0 .js/.jsx in source trees):
   node scripts/check-custom-rules.js
   
   # Rejected (exit 1), including test files:
   node scripts/check-custom-rules.js src/components/Foo/Foo.test.jsx
   node scripts/check-custom-rules.js packages/superset-ui-core/src/Bar.jsx
   
   # Allowed (exit 0):
   node scripts/check-custom-rules.js src/components/Foo/Foo.test.tsx
   node scripts/check-custom-rules.js webpack.config.js .storybook/preview.jsx
   ```
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to