Skip to content

feat(linter): add rule noRedundantDefaultExport#8931

Merged
dyc3 merged 21 commits intobiomejs:mainfrom
koshin01:feat/add_rule_noRedundantDefaultExport
Feb 2, 2026
Merged

feat(linter): add rule noRedundantDefaultExport#8931
dyc3 merged 21 commits intobiomejs:mainfrom
koshin01:feat/add_rule_noRedundantDefaultExport

Conversation

@koshin01
Copy link
Copy Markdown
Contributor

@koshin01 koshin01 commented Feb 1, 2026

Notice: I consulted ChatGPT and Cursor to understand the codebase and review the code I wrote.

fixes #5885

Summary

This PR introduces a new lint rule: noRedundantDefaultExport.

Test Plan

  • Added spec tests under:
    • crates/biome_js_analyze/tests/specs/nursery/noRedundantDefaultExport/**
    • with corresponding .snap snapshot outputs.

This is my first PR to Biome, so it may not include all necessary changes. If that's the case, I'd appreciate it if you could let me know.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 1, 2026

🦋 Changeset detected

Latest commit: b962a1e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Diagnostic Area: diagnostocis labels Feb 1, 2026
@koshin01 koshin01 marked this pull request as ready for review February 1, 2026 14:57
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 1, 2026

Walkthrough

Adds a new JavaScript lint rule noRedundantDefaultExport (registered via declare_lint_rule!) that detects when a module exports the same binding as both a named export and the default export, excluding re-exports. Implements rule logic and helpers, emits diagnostics with source ranges, adds unit tests for valid and invalid cases, introduces NoRedundantDefaultExportOptions, exposes a new rule options module, and adds a changeset for @biomejs/biome.

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding a new lint rule named noRedundantDefaultExport.
Description check ✅ Passed The description is relevant and provides context about the change, references the linked issue, and mentions the test plan.
Linked Issues check ✅ Passed The PR implements the noRedundantDefaultExport rule [#5885] that detects when a module exports the same symbol as both default and named export, correctly excluding re-exports.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the noRedundantDefaultExport rule, including the rule implementation, test cases, and configuration files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

Nice first draft!

Comment thread crates/biome_js_analyze/src/lint/nursery/no_redundant_default_export.rs Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 1, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 95 skipped benchmarks1


Comparing koshin01:feat/add_rule_noRedundantDefaultExport (b962a1e) with main (7c96517)

Open in CodSpeed

Footnotes

  1. 95 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Copy Markdown
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

Nicely done! Just needs a tweak to the changeset.

Comment thread .changeset/light-crews-cough.md Outdated
Co-authored-by: Carson McManus <[email protected]>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.changeset/light-crews-cough.md:
- Line 5: Replace the "<brief explanation>" placeholder with a concise
description of the new nursery rule noRedundantDefaultExport: state that the
rule detects and flags modules that export the same binding as both a named
export and a default export (redundant default exports), and give a short
example or purpose phrase such as "flags when a module exports the same
identifier as both a named export and the default to avoid redundancy." Ensure
the replacement sits inline with the existing sentence so the changelog line
reads naturally.

Comment thread .changeset/light-crews-cough.md Outdated
@dyc3 dyc3 merged commit 4561751 into biomejs:main Feb 2, 2026
20 checks passed
@github-actions github-actions Bot mentioned this pull request Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Diagnostic Area: diagnostocis A-Linter Area: linter A-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📎 Implement noRedundantDefaultExport

3 participants