Skip to content

chore(frontend): enforce TypeScript-only source files#41385

Merged
rusackas merged 1 commit into
masterfrom
chore/enforce-ts-frontend-source
Jun 24, 2026
Merged

chore(frontend): enforce TypeScript-only source files#41385
rusackas merged 1 commit into
masterfrom
chore/enforce-ts-frontend-source

Conversation

@rusackas

Copy link
Copy Markdown
Member

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

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

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>
@dosubot dosubot Bot added the frontend:refactor Related to refactoring the frontend label Jun 24, 2026
@bito-code-review

bito-code-review Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c3f400

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 8153cc8..8153cc8
    • superset-frontend/scripts/check-custom-rules.js
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.84%. Comparing base (a57b5f6) to head (8153cc8).

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           
Flag Coverage Δ
javascript 68.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rusackas rusackas merged commit 3261d10 into master Jun 24, 2026
70 checks passed
@rusackas rusackas deleted the chore/enforce-ts-frontend-source branch June 24, 2026 12:54
devin-ai-integration Bot pushed a commit to cognition-demo/superset that referenced this pull request Jun 29, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend:refactor Related to refactoring the frontend size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants