Skip to content

fix(lint): enforce import/no-named-as-default as an error - #46317

Merged
rusackas merged 4 commits into
masterfrom
ultraset-enforce-no-named-as-default-lint-rule
Nov 25, 2026
Merged

rusackas merged 4 commits into
masterfrom
ultraset-enforce-no-named-as-default-lint-rule

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

SUMMARY

Supersedes #45446.

import/no-named-as-default was downgraded to "warn" in superset-frontend/oxlint.json by #43587, after the oxlint 1.79.0 bump began enforcing the rule and surfaced 94 pre-existing hits (39 of them redux-mock-store, plus jquery and other upstream default imports). Since then the upstream cases are gone: on master with oxlint 1.92.0 (the locked version) the rule reports 58 hits in 51 files, all on internal modules that export a symbol by name and end with export default <SameName>; — for example src/types/Chart.ts (export interface Chart / export default Chart), @superset-ui/core/components/Table (export function Table / export default Table) and @superset-ui/core/components/CodeSyntaxHighlighter. Each importer bound the default under the named export's name.

This PR switches those 58 imports to the named form (import Chart from 'src/types/Chart' → import { Chart } from 'src/types/Chart') and raises the rule to "error" so the pattern cannot accumulate again. Because the default and named bindings are the same object in every case, there is no runtime change. The default exports are left in place, so external plugins and consumers that default-import these components keep working.

TESTING INSTRUCTIONS

From superset-frontend/:

  1. npm run lint — exits 0 with the rule at "error".
  2. To see the original problem, revert only the import changes (keep oxlint.json) and run npm run lint again: it fails with 58 import(no-named-as-default) errors.
  3. npm run type and npm run test — no type or test regressions in the touched files.

ADDITIONAL INFORMATION

  • Has associated issue: Fixes Enforce linting rule: import/no-named-as-default #45258
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

Fifty-eight imports bound a module's default export under the same name
as one of its named exports (`import Chart from 'src/types/Chart'` while
the module also exports `Chart`). Each of those modules ends with
`export default <SameName>`, so the default and named bindings are
identical; switch the imports to the named form and raise the rule from
"warn" to "error" so the pattern cannot accumulate again. The default
exports are left in place, so external consumers are unaffected.

Fixes #45258

Co-authored-by: Haseeb702 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: dab5a8242ff3

sadpandajoe and others added 2 commits November 18, 2026 17:45
Rename redux-mock-store and jquery default imports flagged by
import/no-named-as-default, and point the SemanticRequestView spies at the
CodeSyntaxHighlighter named export that the component now imports.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@netlify

netlify Bot commented Nov 18, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit c2d549f
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6afe0ea5e0e598f63fc721e1
😎 Deploy Preview https://deploy-preview-46317--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.46%. Comparing base (5e6525e) to head (dab5a82).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
...LayerConfigsControl/LayerConfigsPopoverContent.tsx 0.00% 1 Missing ⚠️
superset-frontend/src/setup/setupApp.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #46317      +/-   ##
==========================================
+ Coverage   85.44%   85.46%   +0.01%     
==========================================
  Files        3101     3101              
  Lines      213763   213829      +66     
  Branches    50459    50493      +34     
==========================================
+ Hits       182658   182744      +86     
+ Misses      27678    27658      -20     
  Partials     3427     3427              
Flag Coverage Δ
javascript 81.96% <0.00%> (+0.03%) ⬆️

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.

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each switched import binds the same object as the old default, and the rule lints clean at error.

Nit: The description says only 58 internal hits remain, but base has 100: 42 upstream (redux-mock-store, jquery, geostyler) fixed by renaming.

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sadpandajoe, LGTM!

@rusackas
rusackas merged commit 2911058 into master Nov 25, 2026
83 checks passed
@rusackas
rusackas deleted the ultraset-enforce-no-named-as-default-lint-rule branch November 25, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce linting rule: import/no-named-as-default

4 participants