+
Skip to content

Conversation

ematipico
Copy link
Member

Summary

Closes #7152

This PR refactor the data structure that we use to collect font names. The previous implementation couldn't retrieve multiple identifiers like those presented in the issue.

This PR introduced a new type CssFontValue which stores multiple nodes in case there are multiple identifiers to define a single font name. This type also implements Hash and PartialEq by using the trimmed values of the font name, and it doesn't use the CST ranges. This is documented.

This PR also enhances the diagnostic of the rule by adding a code frame for the first occurrence of the font name.

Test Plan

Added new tests

Docs

N/A

Copy link

changeset-bot bot commented Aug 8, 2025

🦋 Changeset detected

Latest commit: cb62685

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

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

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

coderabbitai bot commented Aug 8, 2025

Walkthrough

This change refactors the handling of font-family values and duplicate font name detection in the CSS linter. A new dedicated fonts module is introduced to parse and represent font-family values, replacing previous utilities in the general utils module. The noDuplicateFontNames lint rule now uses this module to accurately identify duplicates, including font names with spaces, and reports diagnostics pointing to the first occurrence of duplicates. Imports and function signatures in related lint rules are updated accordingly. Tests are revised to cover scenarios with spaced font names and ensure no false positives occur. Minor API additions in the syntax crate support inner string extraction for font names.

Assessment against linked issues

Objective Addressed Explanation
Correctly detect duplicate font names, especially those containing spaces (e.g., "Mono" vs "SF Mono", "Liberation Mono") [#7152]
Ensure the diagnostic message points to the first occurrence of a duplicate font name [#7152]
Do not trigger false positives for multiple distinct font names that include a common substring [#7152]
Update tests to cover cases with spaced font names and avoid false positives [#7152]

Suggested reviewers

  • dyc3

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ed7d05 and cb62685.

📒 Files selected for processing (1)
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs (4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
🧠 Learnings (21)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a lint rule is ported from another ecosystem (e.g., ESLint), add a `sources` metadata field in `declare_lint_rule!` referencing the original rule.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/{use*,no*}_*{vue,react,angular,svelte}*.rs : If a rule overwhelmingly applies to a specific framework, it should be named using the `use<Framework>...` or `no<Framework>...` pattern (e.g., `noVueReservedProps`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unknown*_*.rs : Rules that report unknown entities (e.g., CSS units) should use the `noUnknown<Concept>` naming convention (e.g., `noUnknownUnit`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_redundant*_*.rs : Rules that report redundant code should use the `noRedundant<Concept>` naming convention (e.g., `noRedundantUseStrict`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_duplicate*_*.rs : Rules that report duplicate entities should use the `noDuplicate<Concept>` naming convention (e.g., `noDuplicateObjectKeys`).
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_duplicate*_*.rs : Rules that report duplicate entities should use the `noDuplicate<Concept>` naming convention (e.g., `noDuplicateObjectKeys`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unknown*_*.rs : Rules that report unknown entities (e.g., CSS units) should use the `noUnknown<Concept>` naming convention (e.g., `noUnknownUnit`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_redundant*_*.rs : Rules that report redundant code should use the `noRedundant<Concept>` naming convention (e.g., `noRedundantUseStrict`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()`.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Use boxed slices (`Box<[Box<str>]>`) instead of `Vec<String>` for string arrays in rule options to save memory.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When deprecating a rule, specify the reason using the `deprecated:` field in the `declare_lint_rule!` macro.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unused*_*.rs : Rules that report unused entities should use the `noUnused<Concept>` naming convention (e.g., `noUnusedVariables`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_useless*_*.rs : Rules that report unnecessary code should use the `noUseless<Concept>` naming convention (e.g., `noUselessConstructor`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/{use*,no*}_*{vue,react,angular,svelte}*.rs : If a rule overwhelmingly applies to a specific framework, it should be named using the `use<Framework>...` or `no<Framework>...` pattern (e.g., `noVueReservedProps`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When banning certain functions or variables, always check if the variable is global using the semantic model to avoid false positives.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unsafe*_*.rs : Rules that report unsafe code should use the `noUnsafe<Concept>` naming convention (e.g., `noUnsafeOptionalChaining`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/use*_*.rs : Rules that mandate a single concept should be named using the `use<Concept>` prefix (e.g., `useValidLang` for mandating valid HTML `lang` attribute values).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, if a token is mandatory and the AST has that information, use the token from the AST node (e.g., `node.l_paren_token().format()`) instead of hardcoding the token (e.g., `token("(")`).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `declare_lint_rule!` macro must be used to declare an analyzer rule type and implement the RuleMeta trait.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `rule_category!` macro should be used in diagnostics to statically inject the category at compile time.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no*_*.rs : Rules that forbid a single concept should be named using the `no<Concept>` prefix (e.g., `noDebugger` for disallowing `debugger` statements).

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When a rule needs to query multiple node types, use the `declare_node_union!` macro to define a union type.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Each code block in rule documentation must specify a language and use `expect_diagnostic` for invalid examples.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.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). (24)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Documentation
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: autofix
  • GitHub Check: Test Node.js API
🔇 Additional comments (1)
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs (1)

55-58: Check case-insensitive hashing for CssFontValue

Font family names are case-insensitive in CSS ("Arial" vs "arial"). Ensure Hash/Eq for CssFontValue normalise case; otherwise distinct-cased duplicates slip through undetected.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/duplicate-fonts

🪧 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 @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai 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:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai 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 comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

Documentation and Community

  • 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.

@ematipico ematipico requested review from a team August 8, 2025 12:34
@github-actions github-actions bot added A-Linter Area: linter A-Parser Area: parser L-CSS Language: CSS labels Aug 8, 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: 6

🧹 Nitpick comments (14)
crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css (1)

6-8: Nice coverage for multi‑word font names

These additions exercise the false‑positive reported in #7152. Consider adding a couple of edge cases to harden normalisation:

  • Quoted vs unquoted mix of the same multi‑identifier font to ensure hashing/eq trims and joins correctly.
  • Whitespace/case variations across identifiers (e.g. SF Mono vs sf mono) that should normalise to duplicates only when truly the same font.

I can draft extra cases if helpful.

crates/biome_css_analyze/tests/quick_test.rs (2)

15-16: Quick test input aligned with the rule

Good minimal snippet for manual checks. When you unignore this, consider adding a duplicate to assert a diagnostic path too.


22-22: Rule filter switched correctly

Targeting "suspicious", "noDuplicateFontNames" matches the PR’s scope. Optional: un‑comment the assertion and flip it depending on whether you intend this snippet to be valid or invalid.

.changeset/beige-geckos-heal.md (2)

5-5: Polish wording and punctuation (en‑GB).

Comma around “e.g.” and singular “instance”.

-Fixed [#7152](https://github.com/biomejs/biome/issues/7152). Now the rule `noDuplicateFontNames` correctly detects font names with spaces e.g. `Liberation Mono`. The diagnostic of the rule now points to the first instances of the repeated font.
+Fixed [#7152](https://github.com/biomejs/biome/issues/7152). The `noDuplicateFontNames` rule now correctly detects font names with spaces, e.g., `Liberation Mono`. The diagnostic now points to the first instance of the repeated font name.

7-7: Prefer en‑GB “any more”, and end the sentence with a full stop.

Also reads better without a colon before the code block.

-The following example doesn't trigger the rule anymore:
+The following example no longer triggers the rule.
crates/biome_css_syntax/src/string_ext.rs (1)

5-7: Slightly simplify with map (functional style).

Equivalent, avoids the extra Ok(...) wrapper.

-    pub fn inner_string_text(&self) -> SyntaxResult<TokenText> {
-        Ok(inner_string_text(&self.value_token()?))
-    }
+    pub fn inner_string_text(&self) -> SyntaxResult<TokenText> {
+        self.value_token().map(|t| inner_string_text(&t))
+    }
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs (2)

73-94: Remove commented‑out legacy code before merging.

Dead code in comments ages poorly; the git history preserves it.

-        // let font_families = if is_font {
-        //     find_font_family(value_list)
-        // } else {
-        //     value_list
-        //         .into_iter()
-        //         .filter_map(|v| match v {
-        //             AnyCssGenericComponentValue::AnyCssValue(value) => match value {
-        //                 AnyCssValue::CssIdentifier(node) => {
-        //                     Some(CssFontValue::SingleValue(node.into()))
-        //                 }
-        //                 AnyCssValue::CssString(node) => {
-        //                     Some(CssFontValue::SingleValue(node.into()))
-        //                 }
-        //                 _ => None,
-        //             },
-        //             _ => None,
-        //         })
-        //         .collect()
-        // };

115-133: Diagnostic copy: tiny clarity tweak.

Make it explicit that the detail points to the first occurrence.

-            .detail(duplicate.range(), markup! {
-                "This is where the duplicate font name is found:"
-            })
+            .detail(duplicate.range(), markup! {
+                "First occurrence is here:"
+            })
crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs (1)

121-125: Unreachable (and allocating) var() check

Given the new collectors:

  • find_font_family skips CSS variables entirely.
  • collect_font_family_properties filters out functions, so var(...) won’t be present.

This branch becomes unreachable and also allocates via to_string(). Remove it to avoid cost and confusion.

Apply:

-        // Ignore the last value if it's a CSS variable now.
-        let last_value = font_families.last()?;
-        if last_value
-            .to_string()
-            .is_some_and(|s| is_css_variable(s.as_ref()))
-        {
-            return None;
-        }
-
-        Some(last_value.range())
+        // Report the last family (variables are filtered upstream).
+        Some(font_families.last()?.range())
crates/biome_css_analyze/src/fonts.rs (5)

116-133: Method name and allocation: to_string() allocates and can mislead

  • Naming to_string() shadows the conventional trait method naming. Prefer to_css_text() or raw_text() to reduce confusion.
  • It always allocates; most callers only need a view. Consider returning Option<Cow<str>> or Option<TokenText> for the single-value case, and avoid joining for MultipleValue unless strictly required.

If you keep it, document the allocation and intended use-cases.


159-166: Nit: variable shadowing hurts readability

let value = v.to_trimmed_text(); let lower_case_value = value.text()... shadows the parameter name value. Rename to value_text for clarity.

-    while let Some(v) = iter.next() {
-        let value = v.to_trimmed_text();
-        let lower_case_value = value.text().to_ascii_lowercase_cow();
+    while let Some(v) = iter.next() {
+        let value_text = v.to_trimmed_text();
+        let lower_case_value = value_text.text().to_ascii_lowercase_cow();

217-225: Avoid cloning the identifiers buffer

You can avoid cloning by moving out the buffer with mem::take:

-                if !identifiers_collector.is_empty() {
-                    font_families.push(CssFontValue::MultipleValue(
-                        identifiers_collector
-                            .clone()
-                            .into_iter()
-                            .map(AnyCssFontValue::from)
-                            .collect(),
-                    ));
-                    identifiers_collector.clear();
-                }
+                if !identifiers_collector.is_empty() {
+                    let nodes = std::mem::take(&mut identifiers_collector);
+                    font_families.push(CssFontValue::MultipleValue(
+                        nodes.into_iter().map(AnyCssFontValue::from).collect(),
+                    ));
+                }

254-264: Same: avoid clone on final MultipleValue push

Repeat the mem::take pattern here too.

-                            font_families.push(CssFontValue::MultipleValue(
-                                identifiers_collector
-                                    .clone()
-                                    .into_iter()
-                                    .map(AnyCssFontValue::from)
-                                    .collect::<Vec<_>>(),
-                            ));
-
-                            identifiers_collector.clear();
+                            let nodes = std::mem::take(&mut identifiers_collector);
+                            font_families.push(CssFontValue::MultipleValue(
+                                nodes.into_iter().map(AnyCssFontValue::from).collect(),
+                            ));

286-297: Minor: duplication in keyword lists

is_font_shorthand_keyword includes FONT_FAMILY_KEYWORDS but find_font_family immediately un-excludes them via !is_font_family_keyword. It’s fine, but you could simplify by removing FONT_FAMILY_KEYWORDS from this function to avoid the negation at the call site.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1e8008 and 43f661c.

⛔ Files ignored due to path filters (3)
  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/invalid.css.snap is excluded by !**/*.snap
  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css.snap is excluded by !**/*.snap
  • crates/biome_css_analyze/tests/suppression/suspicious/noDuplicateFontNames/noDuplicateFontNames.css.snap is excluded by !**/*.snap
📒 Files selected for processing (12)
  • .changeset/beige-geckos-heal.md (1 hunks)
  • crates/biome_css_analyze/src/fonts.rs (1 hunks)
  • crates/biome_css_analyze/src/lib.rs (1 hunks)
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs (3 hunks)
  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs (1 hunks)
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs (4 hunks)
  • crates/biome_css_analyze/src/utils.rs (1 hunks)
  • crates/biome_css_analyze/tests/quick_test.rs (1 hunks)
  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/invalid.css (1 hunks)
  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css (1 hunks)
  • crates/biome_css_syntax/src/lib.rs (3 hunks)
  • crates/biome_css_syntax/src/string_ext.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/invalid.css
  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css
  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
  • crates/biome_css_analyze/src/fonts.rs
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
  • crates/biome_css_analyze/src/fonts.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
  • crates/biome_css_analyze/src/fonts.rs
.changeset/*.md

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

.changeset/*.md: Changeset descriptions should be about user-facing changes, use past tense for what you did, present tense for Biome behavior, reference issues/rules/assists with links, include code blocks when applicable, and end every sentence with a full stop.
Headers in changesets should use #### or ##### only; other headers may break the changelog.

Files:

  • .changeset/beige-geckos-heal.md
🧠 Learnings (68)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/{use*,no*}_*{vue,react,angular,svelte}*.rs : If a rule overwhelmingly applies to a specific framework, it should be named using the `use<Framework>...` or `no<Framework>...` pattern (e.g., `noVueReservedProps`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unknown*_*.rs : Rules that report unknown entities (e.g., CSS units) should use the `noUnknown<Concept>` naming convention (e.g., `noUnknownUnit`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_duplicate*_*.rs : Rules that report duplicate entities should use the `noDuplicate<Concept>` naming convention (e.g., `noDuplicateObjectKeys`).
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Create new lint rules using `just new-js-lintrule`, `just new-css-lintrule`, `just new-json-lintrule`, or `just new-graphql-lintrule`, and the rule name must be camelCase
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_redundant*_*.rs : Rules that report redundant code should use the `noRedundant<Concept>` naming convention (e.g., `noRedundantUseStrict`).
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unknown*_*.rs : Rules that report unknown entities (e.g., CSS units) should use the `noUnknown<Concept>` naming convention (e.g., `noUnknownUnit`).

Applied to files:

  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/invalid.css
  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css
  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • .changeset/beige-geckos-heal.md
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_duplicate*_*.rs : Rules that report duplicate entities should use the `noDuplicate<Concept>` naming convention (e.g., `noDuplicateObjectKeys`).

Applied to files:

  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/invalid.css
  • .changeset/beige-geckos-heal.md
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/tests/specs/*/*/*.jsonc : Files ending with `.jsonc` in snapshot tests should contain arrays of code snippets for script environments.

Applied to files:

  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css
  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).

Applied to files:

  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css
  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • .changeset/beige-geckos-heal.md
  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/tests/specs/*/*/{invalid*,valid*}* : Snapshot tests for rules should be placed in `tests/specs/<group>/<rule_name>/` with files prefixed by `invalid` or `valid`.

Applied to files:

  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/specs/html/**/*.html : Create your first `.html` test file inside `tests/specs/html`, preferably organizing tests into subfolders by kind.

Applied to files:

  • crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/valid.css
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When banning certain functions or variables, always check if the variable is global using the semantic model to avoid false positives.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid deep indentation by using combinators like `map`, `filter`, and `and_then` instead of nested `if let` or `match` statements.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unused*_*.rs : Rules that report unused entities should use the `noUnused<Concept>` naming convention (e.g., `noUnusedVariables`).

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : Use `TypeData::Unknown` to represent cases where type inference is incomplete, and `TypeData::UnknownKeyword` to represent explicit user usage of the TypeScript `unknown` keyword.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_css_analyze/src/utils.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_redundant*_*.rs : Rules that report redundant code should use the `noRedundant<Concept>` naming convention (e.g., `noRedundantUseStrict`).

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()`.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `declare_lint_rule!` macro must be used to declare an analyzer rule type and implement the RuleMeta trait.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Each code block in rule documentation must specify a language and use `expect_diagnostic` for invalid examples.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a rule provides a code action, add the `fix_kind` metadata to the `declare_lint_rule!` macro and implement the `action` function.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • .changeset/beige-geckos-heal.md
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `rule_category!` macro should be used in diagnostics to statically inject the category at compile time.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When a rule needs to query multiple node types, use the `declare_node_union!` macro to define a union type.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions must be prefixed with `parse_` and use the name defined in the grammar file (e.g., `parse_for_statement`).

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/use*_*.rs : Rules that mandate a single concept should be named using the `use<Concept>` prefix (e.g., `useValidLang` for mandating valid HTML `lang` attribute values).

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Use conditional syntax handling to add diagnostics if a syntax is not supported in the current file or context, and wrap invalid syntax in a `BOGUS` node if necessary.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no*_*.rs : Rules that forbid a single concept should be named using the `no<Concept>` prefix (e.g., `noDebugger` for disallowing `debugger` statements).

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_constant*_*.rs : Rules that report computations always evaluated to the same value should use the `noConstant<Concept>` naming convention (e.g., `noConstantMathMinMaxClamp`).

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When implementing the `run` function for a rule, prefer transforming `Result` into `Option` and using the `?` operator for concise code.

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/{use*,no*}_*{vue,react,angular,svelte}*.rs : If a rule overwhelmingly applies to a specific framework, it should be named using the `use<Framework>...` or `no<Framework>...` pattern (e.g., `noVueReservedProps`).

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
  • .changeset/beige-geckos-heal.md
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_undeclared*_*.rs : Rules that report undeclared entities should use the `noUndeclared<Concept>` naming convention (e.g., `noUndeclaredVariables`).

Applied to files:

  • crates/biome_css_analyze/src/lint/correctness/no_unknown_function.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to .changeset/*.md : Changeset descriptions should be about user-facing changes, use past tense for what you did, present tense for Biome behavior, reference issues/rules/assists with links, include code blocks when applicable, and end every sentence with a full stop.

Applied to files:

  • .changeset/beige-geckos-heal.md
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a lint rule is ported from another ecosystem (e.g., ESLint), add a `sources` metadata field in `declare_lint_rule!` referencing the original rule.

Applied to files:

  • .changeset/beige-geckos-heal.md
  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
PR: biomejs/biome#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:

  • .changeset/beige-geckos-heal.md
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : New rules must be placed inside the `nursery` group for incubation before promotion.

Applied to files:

  • .changeset/beige-geckos-heal.md
  • crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `version` field in `declare_lint_rule!` must be set to `next` for new rules.

Applied to files:

  • .changeset/beige-geckos-heal.md
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/lib.rs : Add the provided formatting infrastructure code inside your `lib.rs` file when creating a new formatter crate for a language (e.g., biome_html_formatter).

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new prefix (e.g., `html_`) to `LANGUAGE_PREFIXES` in `language_kind.rs` for each new language.

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Create a `lexer/mod.rs` file inside the parser crate for each language to implement the lexer.

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/{spec_test.rs,spec_tests.rs,language.rs} : Inside the `biome_html_formatter` crate, create a `tests` folder containing a `specs` folder and the files `spec_test.rs`, `spec_tests.rs`, and `language.rs` for test infrastructure.

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-08-05T14:50:35.163Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:35.163Z
Learning: Applies to crates/biome_diagnostics/crates/biome_diagnostics_categories/src/categories.rs : When declaring a new diagnostic category, add it to crates/biome_diagnostics_categories/src/categories.rs to ensure it is statically registered.

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/src/generated/ : Create a `generated/` folder inside the `src/` folder of each new language crate (e.g., `crates/biome_html_syntax/src/generated/`).

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Use boxed slices (`Box<[Box<str>]>`) instead of `Vec<String>` for string arrays in rule options to save memory.

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new variant to `LanguageKind` in `language_kind.rs` for each new language, and implement all required methods for the new variant.

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-08-05T13:25:32.395Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Applies to benches/html_formatter.rs : Benchmark for HTML formatter must be in `benches/html_formatter.rs`

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
  • crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-08-05T13:25:32.395Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Applies to **/*.{rs,toml} : Format code (Rust + TOML) using `just format`

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Applied to files:

  • crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Test rules using quick tests in the appropriate test file (e.g., `biome_js_analyze/tests/quick_test.rs`) and snapshot tests in `tests/specs/`.

Applied to files:

  • crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_css_analyze/tests/quick_test.rs
  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Add tests for watcher workspace methods in watcher.tests.rs (src/workspace/watcher.tests.rs)

Applied to files:

  • crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Rule documentation must start with a single-line summary, followed by detailed paragraphs, and include `## Examples` with `### Invalid` and `### Valid` sections.

Applied to files:

  • crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Use Rust's `dbg!()` macro for debugging and pass `--show-output` to `cargo` to display debug output during tests.

Applied to files:

  • crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Document and test the effect of rule options as part of the rule's documentation and test suite.

Applied to files:

  • crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.

Applied to files:

  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/token_source*.rs : Implement a token source as a thin layer wrapping the lexer, supporting lookahead, re-lexing, and checkpoint features.

Applied to files:

  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/context.rs : Define the `HtmlFormatContext` type inside a file called `context.rs`, including `comments` and `source_map` fields, and implement the `FormatContext` and `CstFormatContext` traits.

Applied to files:

  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, if a token is mandatory and the AST has that information, use the token from the AST node (e.g., `node.l_paren_token().format()`) instead of hardcoding the token (e.g., `token("(")`).

Applied to files:

  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/comments.rs : Define the `HtmlCommentStyle` type (as `HtmlComments`) inside a file called `comments.rs` and ensure it implements the `CommentStyle` trait.

Applied to files:

  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code when formatting AST nodes. If a mandatory token or node is missing, return `None` instead.

Applied to files:

  • crates/biome_css_syntax/src/string_ext.rs
  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/src/*_kinds_src.rs : Create a new file called `src/<lang>_kinds_src.rs` for each language, which must return a static `KindSrc`.

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes for enclosing syntax errors must have the word `Bogus` in their name (e.g., `HtmlBogusAttribute`).

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Bogus nodes must be part of a variant (e.g., included in a union node definition).

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating a new AST node formatter.

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions should take a `&mut` reference to the parser as their only parameter and return a `ParsedSyntax`.

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Consult the grammar to identify the appropriate `BOGUS` node for error recovery in your parse rule.

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_useless*_*.rs : Rules that report unnecessary code should use the `noUseless<Concept>` naming convention (e.g., `noUselessConstructor`).

Applied to files:

  • crates/biome_css_analyze/src/utils.rs
  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When deprecating a rule, specify the reason using the `deprecated:` field in the `declare_lint_rule!` macro.

Applied to files:

  • crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/use_consistent*_*.rs : Rules that ensure consistency should use the `useConsistent<Concept>` naming convention (e.g., `useConsistentArrayType`).

Applied to files:

  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When a rule requires semantic information, use the `Semantic<>` query type and access the semantic model via `ctx.model()`.

Applied to files:

  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Rule options must be placed inside the `biome_rule_options` crate, with a file named after the rule (e.g., `use_this_convention.rs`).

Applied to files:

  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_misleading*_*.rs : Rules that report misleading code should use the `noMisleading<Concept>` naming convention (e.g., `noMisleadingCharacterClass`).

Applied to files:

  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
🪛 LanguageTool
.changeset/beige-geckos-heal.md

[uncategorized] ~5-~5: Possible missing comma found.
Context: ...amescorrectly detects font names with spaces e.g.Liberation Mono`. The diagnostic ...

(AI_HYDRA_LEO_MISSING_COMMA)


[locale-violation] ~7-~7: In British English, the spelling ‘anymore’ is sometimes considered incorrect. Did you mean “any more”?
Context: ...lowing example doesn't trigger the rule anymore: ```css c { font-family: SF Mono, Libe...

(ANYMORE)

⏰ 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). (24)
  • GitHub Check: autofix
  • GitHub Check: Test Node.js API
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_formatter)
🔇 Additional comments (14)
crates/biome_css_analyze/src/lib.rs (1)

4-4: Module added cleanly; centralising font helpers is a win

Looks good. Ensure public items inside fonts are pub(crate)/pub as needed for sibling modules; the module itself doesn’t need to be pub.

crates/biome_css_analyze/tests/specs/suspicious/noDuplicateFontNames/invalid.css (1)

6-6: Keep this invalid duplicate case; newline is fine

Good to keep a shorthand font example with sans-serif duplicated. Trailing newline conforms to POSIX conventions.

crates/biome_css_syntax/src/string_ext.rs (1)

1-1: LGTM: clean, crate-local extension.

Imports are minimal and the method mirrors the root helper neatly.

crates/biome_css_syntax/src/lib.rs (3)

7-7: Module hook looks good.

Keeping string_ext private while exposing the method via impl is spot on.


18-18: TokenText import is appropriate.

Required for the new helper’s return type; no churn elsewhere.


186-196: Helper is correct and non‑allocating; handles both quote styles.

The slice is safe for minimal ""/''. Consider a quick unit test covering single/double quotes and a non‑string token.

Would you like me to add a small test file verifying:

  • CSS_STRING_LITERAL with single and double quotes.
  • A non‑string token returns the original TokenText untouched?
crates/biome_css_analyze/src/utils.rs (2)

14-14: Good: bring in both case helpers.

StrLikeExtension and StrOnlyExtension are both used (to_ascii_lowercase_cow, to_lowercase_cow).


3-4: Import list tidy‑up aligns with the refactor.

Font‑related keywords remain referenced here only where needed.

Also applies to: 6-6, 11-11

crates/biome_css_analyze/src/lint/suspicious/no_duplicate_font_names.rs (4)

1-1: Right direction: use typed font values.

Switching to CssFontValue/find_font_family eliminates the substring false positives.


42-44: Examples updated: great coverage of the original bug.

Valid cases with spaced names in both font-family and font help prevent regressions.


99-105: Generic family skip applies only to font – is that intentional?

The comment and linked stylelint thread suggest skipping cases like "sans-serif", sans-serif. That can appear under font-family too. As written, we skip only when the property is font.

Two asks:

  • Confirm intended parity with stylelint: should generic families be ignored in both font and font-family?
  • If yes, drop the && is_font condition.

Happy to add targeted tests covering:

  • font-family: "sans-serif", sans-serif (no diagnostic if intended).
  • font: 1em "sans-serif", sans-serif (no diagnostic).

57-57: State carries both occurrences – nice.

Enables the code frame on the first instance. Good call.

crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs (2)

1-4: Imports update looks good

Switching to the new fonts module and keeping is_css_variable in utils is consistent with the refactor.


176-188: Collector change looks sound

Limiting to identifiers and strings for font-family properties is correct given variables/functions are handled elsewhere.

Copy link

codspeed-hq bot commented Aug 8, 2025

CodSpeed Performance Report

Merging #7156 will not alter performance

Comparing fix/duplicate-fonts (cb62685) with main (3651051)1

Summary

✅ 128 untouched benchmarks

Footnotes

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

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

♻️ Duplicate comments (1)
crates/biome_css_analyze/src/fonts.rs (1)

70-96: Equality should ignore case to match CSS semantics

PartialEq still compares trimmed texts with ==, making "SF Mono" and "sf mono" different. That contradicts the rule’s goal and the behaviour of Hash, and was flagged previously. Please compare case-insensitively (eq_ignore_ascii_case) to keep Hash/Eq in sync.

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

230-276: Avoid unnecessary cloning of identifier vectors

identifiers_collector.clone() is copied into every CssFontValue::MultipleValue. Using std::mem::take(&mut identifiers_collector) would move the data out without allocation and then leave you an empty Vec – cheaper and simpler.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 43f661c and e394001.

📒 Files selected for processing (2)
  • crates/biome_css_analyze/src/fonts.rs (1 hunks)
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

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

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_css_analyze/src/fonts.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_css_analyze/src/fonts.rs
🧠 Learnings (16)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unknown*_*.rs : Rules that report unknown entities (e.g., CSS units) should use the `noUnknown<Concept>` naming convention (e.g., `noUnknownUnit`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/{use*,no*}_*{vue,react,angular,svelte}*.rs : If a rule overwhelmingly applies to a specific framework, it should be named using the `use<Framework>...` or `no<Framework>...` pattern (e.g., `noVueReservedProps`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_duplicate*_*.rs : Rules that report duplicate entities should use the `noDuplicate<Concept>` naming convention (e.g., `noDuplicateObjectKeys`).
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Create new lint rules using `just new-js-lintrule`, `just new-css-lintrule`, `just new-json-lintrule`, or `just new-graphql-lintrule`, and the rule name must be camelCase
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_redundant*_*.rs : Rules that report redundant code should use the `noRedundant<Concept>` naming convention (e.g., `noRedundantUseStrict`).
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/comments.rs : Define the `HtmlCommentStyle` type (as `HtmlComments`) inside a file called `comments.rs` and ensure it implements the `CommentStyle` trait.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Use boxed slices (`Box<[Box<str>]>`) instead of `Vec<String>` for string arrays in rule options to save memory.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unknown*_*.rs : Rules that report unknown entities (e.g., CSS units) should use the `noUnknown<Concept>` naming convention (e.g., `noUnknownUnit`).

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/context.rs : Define the `HtmlFormatContext` type inside a file called `context.rs`, including `comments` and `source_map` fields, and implement the `FormatContext` and `CstFormatContext` traits.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()`.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid deep indentation by using combinators like `map`, `filter`, and `and_then` instead of nested `if let` or `match` statements.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code when formatting AST nodes. If a mandatory token or node is missing, return `None` instead.

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T13:25:32.395Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Applies to benches/html_formatter.rs : Benchmark for HTML formatter must be in `benches/html_formatter.rs`

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, if a token is mandatory and the AST has that information, use the token from the AST node (e.g., `node.l_paren_token().format()`) instead of hardcoding the token (e.g., `token("(")`).

Applied to files:

  • crates/biome_css_analyze/src/fonts.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When implementing the `run` function for a rule, prefer transforming `Result` into `Option` and using the `?` operator for concise code.

Applied to files:

  • crates/biome_css_analyze/src/fonts.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). (24)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: autofix
🔇 Additional comments (1)
crates/biome_css_analyze/src/fonts.rs (1)

47-66: Hash implementation looks solid

Nice switch to safe Option handling; no more panic risk.

@ematipico ematipico merged commit 137d111 into main Aug 9, 2025
30 checks passed
@ematipico ematipico deleted the fix/duplicate-fonts branch August 9, 2025 20:39
@github-actions github-actions bot mentioned this pull request Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter A-Parser Area: parser L-CSS Language: CSS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 noDuplicateFontNames reports false duplicate

1 participant

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