Skip to content

fix(lint): do not convert empty object types to interfaces#8921

Merged
siketyan merged 2 commits intomainfrom
fix/GH-8759
Jan 31, 2026
Merged

fix(lint): do not convert empty object types to interfaces#8921
siketyan merged 2 commits intomainfrom
fix/GH-8759

Conversation

@siketyan
Copy link
Member

@siketyan siketyan commented Jan 31, 2026

Summary

Fixes #8759

Added an exception to the useConsistentTypeDefinitions rule to avoid converting empty object types (type Foo = {}) to interfaces (interface Foo {}) as it will conflict with the noEmptyInterface rule and will end up with an infinite loop while applying unsafe fixes if the both rules are enabled.

Docs

N/A

@siketyan siketyan requested review from a team January 31, 2026 06:29
@siketyan siketyan self-assigned this Jan 31, 2026
@changeset-bot
Copy link

changeset-bot bot commented Jan 31, 2026

🦋 Changeset detected

Latest commit: e993d27

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-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Jan 31, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 31, 2026

Walkthrough

This PR prevents the useConsistentTypeDefinitions lint rule from converting empty object type aliases (e.g. type T = {}) into interfaces by requiring an object type to have at least one member before conversion. The change avoids conflicts with the noEmptyInterface rule and stops an infinite loop/hang when both rules run (including unsafe --write fixes). A test case adding type AnyObject = {} was added.

Suggested labels

A-CLI

Suggested reviewers

  • ematipico
  • arendjr
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: preventing empty object type conversion to interfaces in the useConsistentTypeDefinitions rule.
Description check ✅ Passed The description clearly explains the fix, references the issue, and describes the conflict with noEmptyInterface rule.
Linked Issues check ✅ Passed The PR addresses all coding requirements from #8759: prevents infinite loops by adding exception for empty object types in useConsistentTypeDefinitions rule.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the hang issue: changelog entry, rule logic update, and test case addition for empty object types.

✏️ 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
  • Commit unit tests in branch fix/GH-8759

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

Copy link
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/angry-parts-change.md:
- Line 5: Replace the incorrect phrase "the both rules" with "both rules" in the
changeset text (the sentence describing the interaction between
useConsistentTypeDefinitions and noEmptyInterface) so it reads: "...when both
rules are enabled." Ensure you update only that phrase in the existing sentence.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 31, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 95 skipped benchmarks1


Comparing fix/GH-8759 (e993d27) 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 biome check --write --unsafe hangs with useConsistentTypeDefinitions rule

2 participants