+
Skip to content

Conversation

JeetuSuthar
Copy link
Contributor

This PR fixes a false positive in the lint/correctness/noUnknownProperty rule for CSS.

->Adds "navigation" to the list of known CSS properties, following the CSS View Transitions spec.
->Adds a test to ensure navigation: auto is not flagged as unknown.
Why:
The navigation property is valid for view transitions, but was previously not recognized by the linter, causing a false positive.

Test:
A test case is added to valid.css to confirm that navigation: auto is accepted.

Fixes #7340

JeetuSuthar and others added 30 commits August 15, 2025 16:55
Fixes biomejs#7233

The error message was incorrectly suggesting to prefer findIndex() over indexOf(),
when it should suggest the opposite. Updated the diagnostic message to correctly
recommend using indexOf()/lastIndexOf() over findIndex()/findLastIndex().
Updated test snapshots to reflect the corrected error message that now
properly suggests using indexOf()/lastIndexOf() over findIndex()/findLastIndex().
Remove extra backticks at the end of error messages in the test snapshots
to match the exact format expected by the test runner.
Fixes biomejs#7225

Added test case to verify that noExtraBooleanCast rule correctly preserves
parentheses when removing Boolean calls inside negations. The expression
!Boolean(b0 && b1) should become !(b0 && b1) not !b0 && b1 to maintain
correct operator precedence.

Test Plan
Added reproduction test case for the reported issue. The test will verify
whether the existing parentheses preservation logic correctly handles
binary expressions inside negated Boolean calls.
Fixes biomejs#7225

Added test case to verify that noExtraBooleanCast rule correctly preserves
parentheses when removing Boolean calls inside negations. The expression
!Boolean(b0 && b1) should become !(b0 && b1) not !b0 && b1 to maintain
correct operator precedence.

Test Plan
Added reproduction test case for the reported issue. The test will verify
whether the existing parentheses preservation logic correctly handles
binary expressions inside negated Boolean calls.
…olean calls

- Add parentheses preservation logic for Boolean calls inside negations
- Add needs_parentheses_when_negated helper function
- Ensure !Boolean(b0 && b1) becomes !(b0 && b1) not !b0 && b1
- Preserve operator precedence for binary/conditional/assignment expressions

Fixes biomejs#7225
…preservation

- Add JsLogicalExpression and JsSequenceExpression to imports
- Update needs_parentheses_when_negated to handle && || ?? operators
- Update needs_parentheses_when_negated to handle comma operator
- Improve comments to clarify binary vs logical expressions

Addresses CodeRabbit review feedback
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Copy link

changeset-bot bot commented Aug 28, 2025

🦋 Changeset detected

Latest commit: 1895b94

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

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

Copy link
Contributor

coderabbitai bot commented Aug 28, 2025

Walkthrough

Adds "navigation" to the KNOWN_PROPERTIES set in crates/biome_css_analyze/src/keywords.rs, annotated with a link to the CSS View Transitions 2 descriptor. Extends the analyser’s recognised CSS properties without changing public APIs or control flow. Updates tests by appending a valid @view-transition rule using navigation: auto in crates/biome_css_analyze/tests/specs/correctness/noUnknownProperty/valid.css.

Assessment against linked issues

Objective Addressed Explanation
Prevent false positive from lint/correctness/noUnknownProperty for navigation: auto in @view-transition ([#7340])
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

🧹 Nitpick comments (1)
.changeset/fix-grammar-duplicate-object-keys.md (1)

6-6: Minor punctuation: end the subject line with a period.

The guidelines ask for sentences to end with a period; the subject line should, too (or replace it entirely per the main suggestion above).

-fix(noDuplicateObjectKeys): correct grammatical error in JSON diagnostic message
+fix(noDuplicateObjectKeys): correct grammatical error in JSON diagnostic message.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 45c1dfe and 0928764.

📒 Files selected for processing (1)
  • .changeset/fix-grammar-duplicate-object-keys.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: Create changesets with just new-changeset; store them in .changeset/ with correct frontmatter (package keys and change type).
In changeset descriptions, follow content conventions: user-facing changes only; past tense for what you did; present tense for current behavior; link issues for fixes; link rules/assists; include representative code blocks; end every sentence with a period.
When adding headers in a changeset, only use #### or ##### levels.

Files:

  • .changeset/fix-grammar-duplicate-object-keys.md

Comment on lines 1 to 8
---
"@biomejs/biome": patch
"@biomejs/backend-jsonrpc": patch
---

fix(noDuplicateObjectKeys): correct grammatical error in JSON diagnostic message

Fixed missing "is" in the diagnostic message for the noDuplicateObjectKeys rule when applied to JSON files. The message now correctly reads "This is where a duplicated key was declared again." instead of "This where a duplicated key was declared again."
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Changeset content doesn’t match PR intent (CSS ‘navigation’ fix).

This changeset talks about a JSON diagnostic grammar tweak, but the PR title/objective is to accept the CSS navigation property in lint/correctness/noUnknownProperty. Please align the changeset to the actual fix, link #7340, and include a representative CSS snippet.

Apply this update (adjust package list if other packages are affected by the CSS rule change):

---
-"@biomejs/biome": patch
-"@biomejs/backend-jsonrpc": patch
+"@biomejs/biome": patch
---
-
-fix(noDuplicateObjectKeys): correct grammatical error in JSON diagnostic message
-
-Fixed missing "is" in the diagnostic message for the noDuplicateObjectKeys rule when applied to JSON files. The message now correctly reads "This is where a duplicated key was declared again." instead of "This where a duplicated key was declared again."
+fix(css/noUnknownProperty): recognise the CSS `navigation` property for View Transitions.
+
+Fixed a false positive where the linter reported `navigation` as an unknown property. The rule `lint/correctness/noUnknownProperty` now recognises `navigation` per the CSS View Transitions specification. Fixes #7340.
+
+```css
+/* Previously reported as unknown; now accepted. */
+.box {
+  navigation: auto;
+}
+```

Run to confirm scope and impacted packages:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "Changed files:"
git --no-pager diff --name-only origin/main...HEAD

echo -e "\nTouches CSS property maps/rules?"
rg -nP -C2 'noUnknownProperty|navigation\s*:\s*auto|View\s*Transitions'

echo -e "\nDid backend-jsonrpc change?"
git --no-pager diff --name-only origin/main...HEAD | rg -n 'backend-jsonrpc' || echo "No backend-jsonrpc changes detected."

Length of output: 10545


Update changeset to document CSS navigation support in noUnknownProperty

The current changeset describes a JSON grammar tweak, but this PR actually adds recognition for the CSS navigation property in the lint/correctness/noUnknownProperty rule (fixes #7340). Update .changeset/fix-grammar-duplicate-object-keys.md accordingly:

--- a/.changeset/fix-grammar-duplicate-object-keys.md
+++ b/.changeset/fix-no-unknown-property-navigation.md
@@
- "@biomejs/biome": patch
- "@biomejs/backend-jsonrpc": patch
+ "@biomejs/biome": patch
---
-fix(noDuplicateObjectKeys): correct grammatical error in JSON diagnostic message
-
-Fixed missing "is" in the diagnostic message for the noDuplicateObjectKeys rule when applied to JSON files. The message now correctly reads "This is where a duplicated key was declared again." instead of "This where a duplicated key was declared again."
+fix(css/noUnknownProperty): recognise the CSS `navigation` property for View Transitions. Fixes #7340.
+
+```css
+/* Previously reported as unknown; now accepted. */
+.box {
+  navigation: auto;
+}
+```
🤖 Prompt for AI Agents
In .changeset/fix-grammar-duplicate-object-keys.md around lines 1 to 8, the
changeset message currently describes a JSON grammar tweak but the PR actually
adds support for the CSS `navigation` property in the
lint/correctness/noUnknownProperty rule; update the changeset text and title to
reflect that change (mention noUnknownProperty now accepts CSS `navigation`,
reference fixes #7340), include a short CSS example showing .box { navigation:
auto; } and a one-line note like "Previously reported as unknown; now
accepted.", and keep the packages and version bumps as-is.

@JeetuSuthar JeetuSuthar force-pushed the fix-css-navigation-property-clean branch from 0928764 to 9607d7c Compare August 28, 2025 19:30
@github-actions github-actions bot added A-Linter Area: linter L-CSS Language: CSS L-JSON Language: JSON and super languages labels Aug 28, 2025
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: 0

🧹 Nitpick comments (1)
crates/biome_css_analyze/src/keywords.rs (1)

1333-1334: Optional: scope navigation to @view-transition if/when descriptors are distinguished

Adding it to KNOWN_PROPERTIES allows navigation anywhere. If the rule later differentiates descriptors, consider a scoped allowlist so we don’t silently permit navigation in regular style rules. A small spec-context test (invalid outside @view-transition) would future-proof this.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0928764 and 9607d7c.

📒 Files selected for processing (2)
  • crates/biome_css_analyze/src/keywords.rs (1 hunks)
  • crates/biome_css_analyze/tests/specs/correctness/noUnknownProperty/valid.css (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • crates/biome_css_analyze/tests/specs/correctness/noUnknownProperty/valid.css
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files before committing (use just f/just format).

Files:

  • crates/biome_css_analyze/src/keywords.rs
crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**

📄 CodeRabbit inference engine (CLAUDE.md)

Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}

Files:

  • crates/biome_css_analyze/src/keywords.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_css_analyze/src/keywords.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: autofix
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
🔇 Additional comments (1)
crates/biome_css_analyze/src/keywords.rs (1)

1333-1334: LGTM: adding navigation here resolves the false positive

Sorted correctly between nav-up and object-fit; should keep test_known_properties_order happy.

Copy link

codspeed-hq bot commented Aug 28, 2025

CodSpeed Performance Report

Merging #7353 will improve performances by 9.07%

Comparing JeetuSuthar:fix-css-navigation-property-clean (1895b94) with main (ac27fc5)1

Summary

⚡ 2 improvements
✅ 131 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
css_formatter[bootstrap_18416142857265205439.css] 123.5 ms 116.5 ms +6.01%
css_formatter[bulma_5641719244145477318.css] 386.6 ms 354.4 ms +9.07%

Footnotes

  1. No successful run was found on main (bb4d407) during the generation of this report, so ac27fc5 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@dyc3
Copy link
Contributor

dyc3 commented Aug 28, 2025

I don't think you meant to, but it looks like you opened the same PR 3 times (this one, #7352, #7351). Can you clarify which one is the one you want reviewed and close the rest?

FYI, you can update PRs by simply pushing to your fork's branch and it'll update.

@JeetuSuthar JeetuSuthar force-pushed the fix-css-navigation-property-clean branch 3 times, most recently from bd1928c to 3de8292 Compare August 29, 2025 07:19
@JeetuSuthar JeetuSuthar force-pushed the fix-css-navigation-property-clean branch from 37a855e to 38dcfa7 Compare August 29, 2025 07:30
@JeetuSuthar
Copy link
Contributor Author

@dyc3 Yes got it ! Now u can review

@ematipico
Copy link
Member

@JeetuSuthar

  • The CI fails because you didn't update the snapshots
  • A changeset is missing. Please commit one

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.changeset/allow-navigation-property.md (1)

9-9: Stray character at EOF.

There’s an orphaned "9" at the end of the file. Please remove it.

Apply:

-9
🧹 Nitpick comments (1)
.changeset/allow-navigation-property.md (1)

5-8: Tighten the changeset copy and add a representative snippet.

Reference the rule and include an example so the release notes are crystal-clear.

Apply:

- Fixed [#7340](https://github.com/biomejs/biome/issues/7340): The linter now allows the `navigation` property for view-transition in CSS.
+ Fixed [#7340](https://github.com/biomejs/biome/issues/7340): The linter now allows the `navigation` property for view transitions in CSS. See rule `lint/correctness/noUnknownProperty`.

- Previously, the linter incorrectly flagged `navigation: auto` as an unknown property. This fix adds `navigation` to the list of known CSS properties, following the [CSS View Transitions spec](https://www.w3.org/TR/css-view-transitions-2/#view-transition-navigation-descriptor).
+ Previously, the linter incorrectly flagged `navigation: auto` as an unknown property. This fix adds `navigation` to the list of known CSS properties, following the [CSS View Transitions spec](https://www.w3.org/TR/css-view-transitions-2/#view-transition-navigation-descriptor).
+
+ #### Example
+ ```css
+ @view-transition {
+   navigation: auto;
+ }
+ ```
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 68acf08 and 1895b94.

⛔ Files ignored due to path filters (1)
  • crates/biome_css_analyze/tests/specs/correctness/noUnknownProperty/valid.css.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (1)
  • .changeset/allow-navigation-property.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: Create changesets with just new-changeset; store them in .changeset/ with correct frontmatter (package keys and change type).
In changeset descriptions, follow content conventions: user-facing changes only; past tense for what you did; present tense for current behavior; link issues for fixes; link rules/assists; include representative code blocks; end every sentence with a period.
When adding headers in a changeset, only use #### or ##### levels.

Files:

  • .changeset/allow-navigation-property.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: autofix
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test Node.js API
🔇 Additional comments (1)
.changeset/allow-navigation-property.md (1)

1-3: Frontmatter looks good.

Package key and patch bump are correct for this scope.

@ematipico ematipico merged commit 4d2b719 into biomejs:main Aug 29, 2025
30 checks passed
@github-actions github-actions bot mentioned this pull request Sep 4, 2025
dyc3 pushed a commit that referenced this pull request Oct 3, 2025
…#7353)

Co-authored-by: Naoki Ikeguchi <me@s6n.jp>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-CSS Language: CSS L-JSON Language: JSON and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 False positive: lint/correctness/noUnknownProperty with navigation: auto

4 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载