Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Conaclos
Copy link
Member

@Conaclos Conaclos commented Nov 1, 2025

Summary

Fixes #7943

This PR changes the way we merge rules' options.
We now track if options was set or not for rules with fixes.

One downside is that RuleWithFixOptions increases its size by one byte.
This concerns even rules with a fix and without options.
This seems reasonable because most of the rules have no fixes.

If we wished to reduce this cost to rules without options, we will need some metadata to differentiate rules with and without options - what we don't have currently.

Alternative fix

An alternative fix could be to implement Merge for every Rule options such as merging a default config into an explicit one, don't override the explicitly set options.
This will require to change many options to make them properly mergeable.

See #7941

Test Plan

I added a test for testing that the options are correctly inherited.

Docs

I added a change set.

@changeset-bot
Copy link

changeset-bot bot commented Nov 1, 2025

🦋 Changeset detected

Latest commit: 80974fb

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

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

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-CLI Area: CLI A-Project Area: project labels Nov 1, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

Walkthrough

The Biome configuration schema now makes the options field optional for rules with fix kinds: RuleWithFixOptions<T>'s options changed from T to Option<T>. ESLint-to-Biome migration code was updated to wrap migrated rule options in Some(...). Merge logic now only replaces existing options when the incoming value is Some, and option retrieval uses unwrap_or_default() to handle missing values. Tests and fixtures were added to cover optional rule options.

Suggested labels

A-Linter, A-Tooling, L-JSON

Suggested reviewers

  • dyc3
  • ematipico

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed The pull request description clearly aligns with the changeset provided. The author explains that the PR makes Rule options optional for rules with a fix by changing the RuleWithFixOptions struct's options field from T to Option<T>, which directly corresponds to the public API changes documented in the raw summary. The description provides meaningful context about the motivation (fixing issue #7943), trade-offs (one-byte size increase), and testing approach—all of which relate directly to the code modifications. The description is neither vague nor off-topic.
Title Check ✅ Passed The PR title "feat(config): make options optional for rule with a fix" directly and accurately captures the core change in this changeset. The title clearly describes the primary modification: converting the options field of RuleWithFixOptions from a required type T to an optional Option<T>, which allows developers to omit options when configuring rules that provide a fix. The title is concise, uses standard commit conventions, and provides enough context that a teammate reviewing history would immediately understand the purpose of these changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch conaclos/making-options-optional

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

coderabbitai[bot]

This comment was marked as outdated.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 1, 2025

CodSpeed Performance Report

Merging #7938 will not alter performance

Comparing conaclos/making-options-optional (80974fb) with next (27a5838)

Summary

✅ 1 untouched
⏩ 139 skipped1

Footnotes

  1. 139 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.

dyc3

This comment was marked as resolved.

@Conaclos Conaclos force-pushed the conaclos/making-options-optional branch from ec9e947 to 1e40d42 Compare November 1, 2025 17:09
coderabbitai[bot]

This comment was marked as outdated.

@Conaclos Conaclos force-pushed the conaclos/making-options-optional branch from 1e40d42 to 126a60b Compare November 1, 2025 17:14
@Conaclos Conaclos changed the base branch from main to next November 1, 2025 17:15
@github-actions github-actions bot added A-Linter Area: linter A-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools A-LSP Area: language server protocol L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS A-Diagnostic Area: diagnostocis L-HTML Language: HTML and super languages L-Grit Language: GritQL labels Nov 1, 2025
@Conaclos Conaclos force-pushed the conaclos/making-options-optional branch from 126a60b to ea1d7ce Compare November 1, 2025 17:22
@github-actions github-actions bot removed A-Linter Area: linter A-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools A-LSP Area: language server protocol L-CSS Language: CSS A-Diagnostic Area: diagnostocis L-HTML Language: HTML and super languages labels Nov 1, 2025
@github-actions github-actions bot removed the L-Grit Language: GritQL label Nov 1, 2025
@Conaclos Conaclos force-pushed the conaclos/making-options-optional branch from ea1d7ce to 80974fb Compare November 1, 2025 17:23
@@ -0,0 +1,24 @@
---
"@biomejs/biome": minor
Copy link
Member

Choose a reason for hiding this comment

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

Why is it a minor? I thought it was a bug fix. That's not a new feature imho

@dyc3 dyc3 changed the title feat(config): make opptions optional for rule with a fix feat(config): make options optional for rule with a fix Nov 2, 2025
@Conaclos
Copy link
Member Author

Conaclos commented Nov 2, 2025

Closing in favor of #7941

@Conaclos Conaclos closed this Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants