Skip to content

Conversation

@juliesaia
Copy link

AI assistance: This PR was mostly written by Claude. I'm pretty new to Rust and wanted to try it out for fun. Would appreciate someone with more knowledge taking a closer look!

Summary

This PR adds options to useConsistentCurlyBraces, inspired by jsx-curly-brace-presence

  • options.props: Whether or not to use braces for props ("always" | "never" | "ignore"), default never
  • options.children: Whether or not to use braces for children ("always" | "never" | "ignore"), default never
  • options.propElementValues: Whether or not to use braces for props that are JSX ("always" | "never" | "ignore"), default always

This also allows useConsistentCurlyBraces to work with noJsxLiterals, by setting children to ignore. Right now if you try to set these two rules at the same time Biome will crash.

Test Plan

I included snapshot tests for all the new options.

Docs

Docstring updated in code

@changeset-bot
Copy link

changeset-bot bot commented Dec 25, 2025

🦋 Changeset detected

Latest commit: eacc618

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

coderabbitai bot commented Dec 25, 2025

Walkthrough

The PR extends the useConsistentCurlyBraces linting rule with configuration options. It introduces a new CurlyBracesBehavior enum with "Always", "Never", and "Ignore" variants, adding props and children fields to UseConsistentCurlyBracesOptions. The rule implementation now respects these options when deciding whether to add or remove curly braces around JSX properties and children. Supporting test files and options configurations demonstrate the rule's behaviour across four scenarios.

Possibly related PRs

Suggested labels

L-JSON, A-Diagnostic

Suggested reviewers

  • ematipico
  • dyc3
  • arendjr

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding options to the useConsistentCurlyBraces lint rule.
Description check ✅ Passed The description is well-related to the changeset, explaining the motivation, new options, test coverage, and documenting AI assistance as required.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 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
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: 3

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 73f4f53 and 3e8e7f3.

⛔ Files ignored due to path filters (6)
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.jsx.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (27)
  • .changeset/few-mails-admire.md
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
🧠 Learnings (40)
📓 Common learnings
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.782Z
Learning: For new lint rules in changesets, show an example of invalid case in inline code or code block
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `language` to `jsx`, `ts`, or `tsx` for rules that only apply to specific JavaScript dialects
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*valid* : Create test files prefixed with `valid` for code that should not trigger the rule

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.jsx
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `options` code block property for rule-specific configuration snippets in documentation

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • .changeset/few-mails-admire.md
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `language` to `jsx`, `ts`, or `tsx` for rules that only apply to specific JavaScript dialects

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.jsx
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.jsx
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*.jsonc : Use `.jsonc` files to contain arrays of code snippet strings for snapshot tests

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.jsx
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*invalid* : Create test files prefixed with `invalid` for code that should trigger the rule

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.jsx
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • .changeset/few-mails-admire.md
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `full_options` code block property for complete biome.json configuration snippets in documentation

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • .changeset/few-mails-admire.md
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.jsx
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
  • .changeset/few-mails-admire.md
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Run `just l` to lint analyzer rule code

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Set `recommended` field to `false` for new rules in the nursery group

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should perform static analysis of source code to detect invalid or error-prone patterns and emit diagnostics with proposed fixes

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : Add `issue_number` field to `declare_lint_rule!` macro for work-in-progress rules

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Safe` in `declare_lint_rule!` for safe code actions

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should check syntax according to language specification and emit error diagnostics

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).same()` when implementing a rule that matches the behavior of an ESLint rule

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Wrap rule options fields in `Option<>` to properly track set and unset options during merge

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
  • .changeset/few-mails-admire.md
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Add `sources` field with `RuleSource` to cite ESLint or other rules that inspired the implementation

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation must include `## Options` section if the rule has options

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `file=<path>` property for multi-file rule documentation examples

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `rename_all = "camelCase"` in serde derive macro for rule options

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `deny_unknown_fields` in serde derive macro for rule options

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options struct must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema`

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Implement `Merge` trait for rule options to support configuration inheritance

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `use_options` code block property for code examples that follow an options configuration in documentation

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-21T21:15:03.782Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.782Z
Learning: Changesets should be concise (1-3 sentences) and provide quick overview of changes without overwhelming details

Applied to files:

  • .changeset/few-mails-admire.md
📚 Learning: 2025-12-21T21:15:03.782Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.782Z
Learning: For new lint rules in changesets, show an example of invalid case in inline code or code block

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).inspired()` when implementing a rule inspired by but with different behavior than an ESLint rule

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Assist rules should detect refactoring opportunities and emit code action signals

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `p.eat(token)` for optional tokens, `p.expect(token)` for required tokens, `parse_rule(p).ok(p)` for optional nodes, and `parse_rule(p).or_add_diagnostic(p, error)` for required nodes

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
🧬 Code graph analysis (1)
crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs (1)
crates/biome_rowan/src/syntax/node.rs (1)
  • new_detached (33-47)
🔇 Additional comments (23)
crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.jsx (1)

1-1: Test fixture looks correct.

This appropriately tests the case where a string literal prop should trigger the rule when props: "always" is configured. The code should be flagged as invalid and suggest using prop={"Hello world"} instead.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_always.options.json (1)

1-14: LGTM!

Test configuration correctly sets up the props: "always" scenario for invalid test cases. Structure follows the expected biome.json format.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.options.json (1)

1-14: LGTM!

Configuration for the props: "never" valid test cases is well-formed.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.options.json (1)

1-14: LGTM!

Configuration for propElementValues: "always" is correct and matches the serde camelCase convention.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_always.jsx (1)

1-1: LGTM!

Good test case — demonstrates a JSX element prop value correctly wrapped in braces under the propElementValues: "always" configuration.

crates/biome_rule_options/src/use_consistent_curly_braces.rs (1)

4-36: LGTM!

Well-structured options implementation:

  • Fields correctly wrapped in Option<> for merge tracking (per coding guidelines).
  • Appropriate serde attributes (rename_all = "camelCase", deny_unknown_fields).
  • Sensible defaults: props/children default to Never, prop_element_values to Always.
  • CurlyBracesBehavior enum provides clear semantics with Ignore enabling coexistence with noJsxLiterals.
.changeset/few-mails-admire.md (1)

1-5: LGTM!

Changeset is appropriately concise and correctly marks this as a minor version bump for the new configuration options.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.options.json (1)

1-14: LGTM!

Test configuration for children: "always" is correct. This option is key for enabling coexistence with noJsxLiterals (via the "ignore" value).

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.options.json (1)

1-14: LGTM!

Configuration for the propElementValues: "always" invalid test scenario is well-formed.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_never.jsx (1)

1-1: LGTM!

Good test case for children="never" - unnecessary braces around a string literal child should be flagged.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx (1)

1-1: LGTM!

Valid case for children="never" - plain text without braces is exactly what we want here.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.options.json (1)

1-14: LGTM!

Configuration correctly sets props="always" for testing.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.options.json (1)

1-14: LGTM!

Configuration correctly sets children="never" for testing.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx (1)

1-1: LGTM!

Good test case for children="always" - plain text should be wrapped in braces.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_prop_element_values_never.options.json (1)

1-14: LGTM!

Configuration correctly sets propElementValues="never" for testing. (Interesting edge case, since JSX element prop values syntactically require braces!)

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_props_never.jsx (1)

1-1: LGTM!

Good test case for props="never" - unnecessary braces around a string literal prop should be flagged.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_never.jsx (1)

1-1: LGTM!

Interesting edge case for propElementValues="never" - JSX elements as prop values syntactically require braces, so this tests how the rule handles that scenario.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_prop_element_values_always.jsx (1)

1-2: LGTM!

Good test case for the propElementValues: "always" option. This correctly demonstrates the invalid pattern where a JSX element prop value lacks curly braces.

crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs (5)

10-15: LGTM!

Imports are correctly added for the new JsxText type and the options types from biome_rule_options.


51-76: LGTM!

The ## Options section is well-documented with clear descriptions and default values. The JSON configuration example follows the options code block property convention. As per coding guidelines, rules with options must include this section.


118-128: LGTM!

Clean integration of options retrieval and propagation to the handler functions.


225-242: LGTM!

The AddBraces case for JSX children correctly handles JsxText nodes by wrapping them in expressions. The child list reconstruction pattern mirrors the existing RemoveBraces approach.


435-473: LGTM!

The handle_jsx_child function correctly implements the three behaviours (Always, Never, Ignore) with appropriate early returns and edge case handling for whitespace-only content.

Comment on lines 407 to 414
AnyJsxAttributeValue::JsxExpressionAttributeValue(ref expr_value) => {
if contains_jsx_tag(expr_value) {
match options.prop_element_values.unwrap_or(CurlyBracesBehavior::Always) {
CurlyBracesBehavior::Never if has_curly_braces => {
Some(CurlyBraceResolution::RemoveBraces)
}
_ => None,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's find the file and understand its structure
cd crates/biome_js_analyze && wc -l src/lint/style/use_consistent_curly_braces.rs

Repository: biomejs/biome

Length of output: 106


🏁 Script executed:

# Look at the RemoveBraces case in the action function
sed -n '240,270p' src/lint/style/use_consistent_curly_braces.rs

Repository: biomejs/biome

Length of output: 145


🏁 Script executed:

# Now let's see the full context around the handle_attr_init_clause function
sed -n '390,435p' src/lint/style/use_consistent_curly_braces.rs

Repository: biomejs/biome

Length of output: 145


🏁 Script executed:

# Search for the action function definition and its structure
sed -n '180,250p' src/lint/style/use_consistent_curly_braces.rs

Repository: biomejs/biome

Length of output: 145


🏁 Script executed:

# Find the correct file path
find . -name "use_consistent_curly_braces.rs" -type f

Repository: biomejs/biome

Length of output: 191


🏁 Script executed:

# Once we have the path, examine the action function
cat -n crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs | head -100

Repository: biomejs/biome

Length of output: 4005


🏁 Script executed:

# Look at the action function, particularly the RemoveBraces case
cat -n crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs | sed -n '150,280p'

Repository: biomejs/biome

Length of output: 7147


🏁 Script executed:

# Also look at lines 390-435 to see the handle_attr_init_clause function
cat -n crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs | sed -n '390,435p'

Repository: biomejs/biome

Length of output: 2015


🏁 Script executed:

# Let's verify the contains_jsx_tag function to understand what it detects
cat -n crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs | sed -n '310,360p'

Repository: biomejs/biome

Length of output: 2566


🏁 Script executed:

# Search for any other references to RemoveBraces or jsx tag removal
grep -n "JsxTagExpression\|contains_jsx_tag" crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs

Repository: biomejs/biome

Length of output: 337


🏁 Script executed:

# Let's look at the contains_jsx_tag function definition
cat -n crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs | sed -n '500,510p'

Repository: biomejs/biome

Length of output: 478


🏁 Script executed:

# Check if there's any code to handle removing braces from JSX tags (the inverse of AddBraces at lines 191-201)
cat -n crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs | sed -n '240,270p'

Repository: biomejs/biome

Length of output: 1671


RemoveBraces action silently fails for JSX element prop values.

When propElementValues: "never" is configured and a JSX tag is detected in a prop value, the rule signals RemoveBraces (line 411). However, the action handler (lines 247–262) only processes JsStringLiteralExpression within JsxExpressionAttributeValue. For JSX tag expressions, the and_then chain returns None at line 262, causing the fix to fail silently. The AddBraces handler properly handles JSX tags (lines 191–201), but the inverse operation for RemoveBraces is missing.

🤖 Prompt for AI Agents
In crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs around
lines 407–414, the rule returns RemoveBraces for JSX prop values but the
RemoveBraces action handler (around lines 247–262) only handles
JsStringLiteralExpression and therefore returns None for JSX tag expressions,
causing the fix to silently fail; update the RemoveBraces handler to also match
JsxExpressionAttributeValue whose inner expression is a JSX element/fragment or
a JSX-producing call and convert/unwrap that inner JSX expression into the
corresponding unbraced JsxAttributeValue variant (the same kinds of Jsx
element/fragment/call conversions performed by the AddBraces handler at lines
~191–201), reusing the AddBraces conversion logic where possible so RemoveBraces
produces the correct unbraced attribute node instead of returning None.

Copy link
Author

Choose a reason for hiding this comment

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

removed propElementValues entirely

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e8e7f3 and a8ff54f.

⛔ Files ignored due to path filters (5)
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.jsx.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (7)
  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/invalid_children_always.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_always.jsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
🧠 Learnings (34)
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Wrap rule options fields in `Option<>` to properly track set and unset options during merge

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `language` to `jsx`, `ts`, or `tsx` for rules that only apply to specific JavaScript dialects

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).inspired()` when implementing a rule inspired by but with different behavior than an ESLint rule

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `options` code block property for rule-specific configuration snippets in documentation

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `RuleSource::Eslint(...).same()` when implementing a rule that matches the behavior of an ESLint rule

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `rename_all = "camelCase"` in serde derive macro for rule options

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Assist rules should detect refactoring opportunities and emit code action signals

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation must include `## Options` section if the rule has options

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-22T09:26:56.943Z
Learnt from: ematipico
Repo: biomejs/biome PR: 8537
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:167-210
Timestamp: 2025-12-22T09:26:56.943Z
Learning: When defining lint rules (declare_lint_rule!), only specify fix_kind if the rule implements an action(...) function. Rules that only emit diagnostics without a code fix should omit fix_kind. This applies to all Rust lint rule definitions under crates/.../src/lint (e.g., crates/biome_js_analyze/src/lint/...).

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Implement `action` function in Rule trait to provide code actions

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should perform static analysis of source code to detect invalid or error-prone patterns and emit diagnostics with proposed fixes

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Safe` in `declare_lint_rule!` for safe code actions

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Specify `fix_kind: FixKind::Unsafe` in `declare_lint_rule!` for unsafe code actions

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-21T21:15:03.782Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-12-21T21:15:03.782Z
Learning: For new lint rules in changesets, show an example of invalid case in inline code or code block

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `p.eat(token)` for optional tokens, `p.expect(token)` for required tokens, `parse_rule(p).ok(p)` for optional nodes, and `parse_rule(p).or_add_diagnostic(p, error)` for required nodes

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `use_options` code block property for code examples that follow an options configuration in documentation

Applied to files:

  • crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs
  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*valid* : Create test files prefixed with `valid` for code that should not trigger the rule

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*.jsonc : Use `.jsonc` files to contain arrays of code snippet strings for snapshot tests

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
📚 Learning: 2025-12-04T13:29:49.287Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8291
File: crates/biome_html_formatter/tests/specs/prettier/vue/html-vue/elastic-header.html:10-10
Timestamp: 2025-12-04T13:29:49.287Z
Learning: Files under `crates/biome_html_formatter/tests/specs/prettier` are test fixtures synced from Prettier and should not receive detailed code quality reviews (e.g., HTTP vs HTTPS, formatting suggestions, etc.). These files are test data meant to validate formatter behavior and should be preserved as-is.

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/tests/specs/**/*invalid* : Create test files prefixed with `invalid` for code that should trigger the rule

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx
  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Use `deny_unknown_fields` in serde derive macro for rule options

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Implement `Merge` trait for rule options to support configuration inheritance

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options struct must derive `Deserializable`, `Serialize`, `Deserialize`, and optionally `JsonSchema`

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks should be ordered as language, expect_diagnostic, options/full_options/use_options, ignore, file

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be placed inside the `biome_rule_options` crate

Applied to files:

  • crates/biome_rule_options/src/use_consistent_curly_braces.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Valid code examples in rule documentation should not trigger any diagnostics

Applied to files:

  • crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx
🧬 Code graph analysis (1)
crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs (1)
crates/biome_rowan/src/syntax/node.rs (1)
  • new_detached (33-47)
🔇 Additional comments (7)
crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs (4)

51-70: Documentation for the new options looks good.

Clear descriptions for props and children options with appropriate defaults documented. The JSON example demonstrates usage well.


408-437: Option-driven logic for attribute initializers is well structured.

The handling correctly:

  • Always wraps bare JSX tags (line 416)
  • Leaves braced JSX tags alone (lines 417-419)
  • Respects props option for string literals

440-478: Children handling respects the new options correctly.

Good early exit for Ignore behaviour (lines 446-448). The logic for Always and Never modes aligns with the expected semantics.


219-236: Child list reconstruction handles whitespace preservation nicely.

The approach of iterating the child list, inserting the new expression child, and continuing with remaining children is clean. Returning None for non-JsxText nodes is appropriate since AddBraces for children only applies to text nodes.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_children_never.jsx (1)

1-3: Test fixture correctly validates children: "never" behaviour.

Plain text children without braces should not trigger diagnostics when the option is "never". Based on learnings, test files prefixed with valid should not trigger the rule.

crates/biome_js_analyze/tests/specs/style/useConsistentCurlyBraces/valid_props_never.jsx (1)

1-3: Test fixture correctly validates props: "never" behaviour.

Unbraced string props should not trigger diagnostics when the option is "never". Based on learnings, valid test files should not trigger the rule.

crates/biome_rule_options/src/use_consistent_curly_braces.rs (1)

4-24: Options definition follows all conventions correctly.

Based on learnings:

  • Fields wrapped in Option<> for proper merge tracking ✓
  • rename_all = "camelCase" applied ✓
  • deny_unknown_fields present ✓
  • Merge trait derived for configuration inheritance ✓
  • skip_serializing_if used for optional fields ✓

The #[default] attribute on Never variant is a nice touch for clarity.

Comment on lines +345 to +380
fn wrap_text_in_expression(text: &JsxText) -> Option<Vec<AnyJsxChild>> {
let text_content = text.value_token().ok()?;
let full_text = text_content.text_trimmed();
let trimmed = full_text.trim();
if trimmed.is_empty() {
return None;
}

let mut result = vec![];

let leading_ws = &full_text[..full_text.len() - full_text.trim_start().len()];
if !leading_ws.is_empty() {
let ws_token =
JsSyntaxToken::new_detached(JsSyntaxKind::JSX_TEXT_LITERAL, leading_ws, [], []);
result.push(AnyJsxChild::JsxText(make::jsx_text(ws_token)));
}

let escaped = trimmed.replace('\\', "\\\\").replace('"', "\\\"");
let quoted = format!("\"{escaped}\"");
let string_token = JsSyntaxToken::new_detached(JsSyntaxKind::JS_STRING_LITERAL, &quoted, [], []);
let string_expr = make::js_string_literal_expression(string_token);
let expr_child = make::jsx_expression_child(make::token(T!['{']), make::token(T!['}']))
.with_expression(AnyJsExpression::AnyJsLiteralExpression(
AnyJsLiteralExpression::JsStringLiteralExpression(string_expr),
));
result.push(AnyJsxChild::JsxExpressionChild(expr_child.build()));

let trailing_ws = &full_text[full_text.trim_end().len()..];
if !trailing_ws.is_empty() {
let ws_token =
JsSyntaxToken::new_detached(JsSyntaxKind::JSX_TEXT_LITERAL, trailing_ws, [], []);
result.push(AnyJsxChild::JsxText(make::jsx_text(ws_token)));
}

Some(result)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Newline and special characters not escaped in string conversion.

The escaping on line 362 handles backslashes and double quotes, but if the JSX text contains internal newline characters (or carriage returns), the resulting string literal will be malformed JavaScript syntax.

For example, JSX text spanning multiple lines:

<App>Hello
World</App>

Would produce "Hello\nWorld" with a literal newline inside the string.

🔎 Proposed fix to escape newlines and carriage returns
-    let escaped = trimmed.replace('\\', "\\\\").replace('"', "\\\"");
+    let escaped = trimmed
+        .replace('\\', "\\\\")
+        .replace('"', "\\\"")
+        .replace('\n', "\\n")
+        .replace('\r', "\\r");
🤖 Prompt for AI Agents
In crates/biome_js_analyze/src/lint/style/use_consistent_curly_braces.rs around
lines 345 to 380, the string escaping only handles backslashes and double quotes
so embedded newlines/carriage-returns produce malformed JS string literals;
update the escaping step to also replace '\n' with "\\n" and '\r' with "\\r"
(keeping backslash replacement first) so newlines and CRs are properly escaped
before wrapping in quotes and building the string literal.

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.

1 participant