feat(migrate): map ESLint spacing rules to delimiterSpacing#9724
feat(migrate): map ESLint spacing rules to delimiterSpacing#9724ematipico merged 4 commits intobiomejs:nextfrom
Conversation
Add the `delimiterSpacing` formatter option. This option inserts spaces inside delimiters when content fits on a single line. Empty delimiters are not affected, and no space is added before the opening delimiter. The specific delimiters affected depend on the language. Includes the shared DelimiterSpacing type, global configuration, overrides support, Prettier migration, CLI flag, generated schema/bindings, and changeset.
Update ESLint migration mappings to reference the new delimiterSpacing formatter option for: array-bracket-spacing, computed-property-spacing, space-in-brackets, space-in-parens, template-curly-spacing, jsx-curly-spacing (across eslint, @Stylistic, react, and vue plugins).
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis change updates the Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_service/src/settings.rs (1)
583-600:⚠️ Potential issue | 🟠 MajorWire
delimiter_spacinginto override application.
OverrideFormatSettingsstores the value andto_override_settingspreserves it, butOverrideSettingPattern::apply_overrides_to_js_format_options,OverrideSettingPattern::apply_overrides_to_json_format_options, andOverrideSettingPattern::apply_overrides_to_css_format_optionsnever read it. Right nowoverrides[].formatter.delimiterSpacingis dutifully stored, then politely ignored. Please thread it through the relevant helpers and add a regression test.Also applies to: 1920-1935
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_service/src/settings.rs` around lines 583 - 600, OverrideFormatSettings currently stores delimiter_spacing but the override application helpers ignore it; update OverrideSettingPattern::apply_overrides_to_js_format_options, ::apply_overrides_to_json_format_options, and ::apply_overrides_to_css_format_options to read the OverrideFormatSettings.delimiter_spacing and set the corresponding delimiter spacing field in the target format options (the same place other fields like bracket_spacing and bracket_same_line are applied), ensure to pull the value from the OverrideFormatSettings passed through to_override_settings flow, and add a regression test that sets overrides[].formatter.delimiterSpacing and asserts the resulting JS/JSON/CSS format options reflect that value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/delimiter-spacing-eslint.md:
- Around line 1-3: The changeset currently marks the release as "patch" for
"@biomejs/biome" but should be "minor" because it adds new migration behaviour;
update the changeset entry that reads `"@biomejs/biome": patch` to
`"@biomejs/biome": minor` (ensure the YAML header in the changeset file is
edited accordingly so the change type is minor).
---
Outside diff comments:
In `@crates/biome_service/src/settings.rs`:
- Around line 583-600: OverrideFormatSettings currently stores delimiter_spacing
but the override application helpers ignore it; update
OverrideSettingPattern::apply_overrides_to_js_format_options,
::apply_overrides_to_json_format_options, and
::apply_overrides_to_css_format_options to read the
OverrideFormatSettings.delimiter_spacing and set the corresponding delimiter
spacing field in the target format options (the same place other fields like
bracket_spacing and bracket_same_line are applied), ensure to pull the value
from the OverrideFormatSettings passed through to_override_settings flow, and
add a regression test that sets overrides[].formatter.delimiterSpacing and
asserts the resulting JS/JSON/CSS format options reflect that value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1d019adb-32ad-4b57-b8c7-9e85e422a06c
⛔ Files ignored due to path filters (7)
crates/biome_cli/tests/snapshots/main_cases_help/check_help.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_help/ci_help.snapis excluded by!**/*.snapand included by**crates/biome_cli/tests/snapshots/main_cases_help/format_help.snapis excluded by!**/*.snapand included by**crates/biome_configuration/tests/invalid/formatter_extraneous_field.json.snapis excluded by!**/*.snapand included by**crates/biome_configuration/tests/invalid/formatter_quote_style.json.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (8)
.changeset/delimiter-spacing-eslint.md.changeset/delimiter-spacing-option.mdcrates/biome_cli/src/execute/migrate/prettier.rscrates/biome_cli/src/execute/migrate/unsupported_rules.rscrates/biome_configuration/src/formatter.rscrates/biome_configuration/src/overrides.rscrates/biome_formatter/src/lib.rscrates/biome_service/src/settings.rs
Summary
Maps ESLint spacing rules to the new
delimiterSpacingformatter option in the migration tool, building on #9718 (core).Updates
FormatterOption("delimiterSpacing")for the following rules acrosseslint,@stylistic,react, andvueplugins:array-bracket-spacingcomputed-property-spacingspace-in-bracketsspace-in-parenstemplate-curly-spacingjsx-curly-spacingAI usage
AI assisted in identifying the relevant ESLint rules and updating the migration mappings.
Test Plan