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

Skip to content

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented Sep 20, 2025

Summary

Several ruledoc code blocks still contained parse errors, which were silently ignored by just lint-rules. This tightens the validation and resolves parse errors in various rule documentation examples.

Test Plan

just lint-rules should still be green.

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Sep 20, 2025

⚠️ No Changeset found

Latest commit: 88c3e65

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added A-Linter Area: linter A-Tooling Area: internal tools L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS L-JSON Language: JSON and super languages labels Sep 20, 2025
let parse = biome_css_parser::parse_css(code, CssParserOptions::default());
let parse_options = CssParserOptions::default()
.allow_css_modules()
.allow_tailwind_directives();
Copy link
Contributor Author

@arendjr arendjr Sep 20, 2025

Choose a reason for hiding this comment

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

The CSS parser options are updated here too: biomejs/website#3130

I'm thinking we may want to do even more code sharing here...

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 20, 2025

Walkthrough

This PR primarily updates documentation code blocks across multiple lint/assist rules (language tags, expectations, examples) without changing rule behaviour. It tightens code-block attribute validation in biome_ruledoc_utils (early bail on unknown attributes). It refactors xtask/rules_check: simplifies DiagnosticWriter (defaultable, internal state), introduces write_parse_error, adjusts final diagnostics evaluation, changes parse_rule_options signature (test -> block), and enables CSS modules/Tailwind during CSS parsing.

Possibly related PRs

Suggested labels

A-Tooling, A-Linter, A-Diagnostic

Suggested reviewers

  • siketyan
  • ematipico

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix: resolve parse errors in ruledoc code blocks" is concise and accurately describes the primary change: tightening ruledoc validation and fixing parse errors in documentation examples (including the xtask/rules_check changes and various ruledoc examples). It is specific, actionable, and directly maps to the raw summary and PR objectives.
Description Check ✅ Passed The PR description clearly states the problem (ruledoc code blocks with parse errors), the intended fix (tightened validation and corrected examples), and a simple test plan ("just lint-rules" should remain green), so it is on-topic and sufficient for this lenient check. The description aligns with the file-level changes in the raw summary.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (7)
crates/biome_ruledoc_utils/src/codeblock.rs (1)

141-155: Clarify error and avoid redundant lookups (optional).

Minor tidy-up: compute the file source once and use a clearer message that covers both attributes and language tags.

Apply this diff:

-                        if DocumentFileSource::from_extension(token) == DocumentFileSource::Unknown
-                        {
-                            bail!("Unrecognised attribute in code block: {token}");
-                        }
-
-                        if code_block.document_file_source() != DocumentFileSource::Unknown {
+                        let token_source = DocumentFileSource::from_extension(token);
+                        if token_source == DocumentFileSource::Unknown {
+                            bail!("Unrecognised attribute or language tag in code block: {token}");
+                        }
+                        if !code_block.tag.is_empty() {
                             bail!(
                                 "Only one language tag is accepted per code block. Found '{}' and '{}'",
                                 code_block.tag,
                                 token
                             );
                         }
-
-                        code_block.tag = token.to_string();
+                        code_block.tag = token.to_owned();

If the repository prefers US English, consider “Unrecognized” instead. Up to you—just be consistent.

crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs (1)

85-93: Doc typo: variable name mismatch (mutableField vs mutableCount)

Both functions should reference mutableCount.

Apply this diff in the “Do this instead” snippet:

 export function getMutableCount() {
-  return mutableField;
+  return mutableCount;
 }

 export function incrementCount() {
-  mutableField += 1;
+  mutableCount += 1;
 }
crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs (1)

65-65: Should this example assert a diff?

This object looks unsorted and would typically trigger the assist. If that’s the intent, consider annotating with expect_diff so the ruledoc test verifies the fix is produced.

Apply this if appropriate:

-/// ```js
+/// ```js,expect_diff
xtask/rules_check/src/lib.rs (4)

402-430: Result evaluation flow reads well; wording nit

The new fail-fast on parse errors and the “exactly one diagnostic” rule for expect_diagnostic are solid. For expect_diff, you now check for any diagnostic; if you ever want to assert an actual code action, consider tightening this later. Minor copy tweak: “returned no diagnostics” would be more precise than “returned no diff”.


479-485: Grammar fix in error text

Small wording nit in the bail message.

-            "The following non-JSON code block for '{group}/{}' was marked as containing configuration options. Only JSON code blocks can used to provide configuration options.\n\n{code}",
+            "The following non-JSON code block for '{group}/{}' was marked as containing configuration options. Only JSON code blocks can be used to provide configuration options.\n\n{code}",

624-631: LGTM: explicit none-case for configuration

Clear error when deserialisation yields None. Consider including a hint that this often means an unexpected shape that doesn’t match the schema.


151-166: Make print_all_diagnostics take &self; import TextSize from biome_rowan

  • print_all_diagnostics doesn't mutate self — change signature.
-    fn print_all_diagnostics(&mut self) {
+    fn print_all_diagnostics(&self) {
         let mut console = biome_console::EnvConsole::default();
         for diag in self.all_diagnostics.iter() {
             console.println(
                 biome_console::LogLevel::Error,
                 markup! { {PrintDiagnostic::verbose(diag)} },
             );
         }
     }
  • Decouple JS-specific types: biome_rowan re-exports TextSize (crates/biome_rowan/src/lib.rs:39), so prefer importing it from biome_rowan.
-use biome_js_syntax::{EmbeddingKind, JsFileSource, JsLanguage, TextSize};
+use biome_js_syntax::{EmbeddingKind, JsFileSource, JsLanguage};
+use biome_rowan::TextSize;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6bc556d and 88c3e65.

📒 Files selected for processing (13)
  • crates/biome_css_analyze/src/lint/suspicious/no_irregular_whitespace.rs (0 hunks)
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs (3 hunks)
  • crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/style/use_block_statements.rs (0 hunks)
  • crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs (2 hunks)
  • crates/biome_ruledoc_utils/src/codeblock.rs (1 hunks)
  • xtask/rules_check/src/lib.rs (11 hunks)
💤 Files with no reviewable changes (2)
  • crates/biome_css_analyze/src/lint/suspicious/no_irregular_whitespace.rs
  • crates/biome_js_analyze/src/lint/style/use_block_statements.rs
🧰 Additional context used
📓 Path-based instructions (3)
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_js_analyze/src/lint/complexity/no_useless_constructor.rs
  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs
  • crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs
  • crates/biome_ruledoc_utils/src/codeblock.rs
  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs
  • crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format all Rust source files before committing (just f)

Files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs
  • crates/biome_ruledoc_utils/src/codeblock.rs
  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs
  • crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs
  • xtask/rules_check/src/lib.rs
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs
🧠 Learnings (16)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.517Z
Learning: Update documentation when features change; for rules/assists/options, use inline Rust rustdoc
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Code blocks in rule docs must specify language; invalid snippets require `expect_diagnostic`; use `options`/`full_options`/`use_options` markers as appropriate
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/lib/src/{lint,assist}/**/*.rs : When banning globals (e.g., `noConsoleLog`), check the semantic model to avoid false positives from locally shadowed bindings

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs
  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Code blocks in rule docs must specify language; invalid snippets require `expect_diagnostic`; use `options`/`full_options`/`use_options` markers as appropriate

Applied to files:

  • crates/biome_ruledoc_utils/src/codeblock.rs
  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs
  • xtask/rules_check/src/lib.rs
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Avoid avoidable string allocations: prefer comparing `&str` or using `TokenText` over calling `to_string()`

Applied to files:

  • crates/biome_ruledoc_utils/src/codeblock.rs
📚 Learning: 2025-08-11T11:48:52.001Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:52.001Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to fix code: if a mandatory token/node is missing, return None instead

Applied to files:

  • crates/biome_ruledoc_utils/src/codeblock.rs
📚 Learning: 2025-09-07T17:35:00.517Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.517Z
Learning: Update documentation when features change; for rules/assists/options, use inline Rust rustdoc

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : In declare_lint_rule! macros, set `version: "next"` for new or updated rules

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Follow rule naming conventions: use `no<Concept>` to forbid and `use<Concept>` to mandate; prefer consistent prefixes (e.g., `noDuplicate<Concept>`, `useConsistent<Concept>`)

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Documentation for rules: first paragraph must be a single line; include `## Examples` with `### Invalid` first then `### Valid`

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Avoid deep indentation and panics; prefer `?`, `ok()?`, and combinators (`map`, `and_then`, `filter`) over nested `if let`/`unwrap`/`expect`

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
  • crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs
  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : If a rule returns a code action (implements `action`), add `fix_kind` in `declare_lint_rule!` and use `ctx.metadata().applicability()` when building the action

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
📚 Learning: 2025-08-11T11:50:12.090Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:50:12.090Z
Learning: Applies to crates/biome_js_type_info/src/**/*.rs : Use TypeData::Unknown for unimplemented inference and TypeData::UnknownKeyword for the explicit TypeScript unknown keyword; treat them semantically the same but keep them distinct for measurement

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
📚 Learning: 2025-08-11T11:50:12.090Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:50:12.090Z
Learning: Applies to crates/biome_js_type_info/src/**/*.rs : Represent links between types using TypeReference (not Arc) to avoid cross-module retention and recursive structures; store type data in linear vectors

Applied to files:

  • crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper advice types from biome_diagnostics::v2 (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) when suitable

Applied to files:

  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
  • crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Quick test: edit `tests/quick_test.rs`, remove or comment `#[ignore]`, set `SOURCE`, and adjust `RuleFilter`

Applied to files:

  • crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs
📚 Learning: 2025-09-10T08:05:22.867Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-10T08:05:22.867Z
Learning: Applies to crates/biome_analyze/**/src/{lint,assist}/**/*.rs : Set the `language` field in `declare_lint_rule!` to the primary language (`js`, `jsx`, `ts`, or `tsx`) the rule targets

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
  • crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs
🧬 Code graph analysis (2)
crates/biome_ruledoc_utils/src/codeblock.rs (1)
crates/biome_service/src/file_handlers/mod.rs (1)
  • from_extension (176-178)
xtask/rules_check/src/lib.rs (3)
crates/biome_service/src/file_handlers/css.rs (1)
  • parse (397-438)
crates/biome_service/src/file_handlers/json.rs (1)
  • parse (381-396)
crates/biome_css_parser/src/lib.rs (1)
  • parse_css (27-30)
⏰ 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). (23)
  • GitHub Check: Documentation
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: autofix
🔇 Additional comments (17)
crates/biome_ruledoc_utils/src/codeblock.rs (2)

141-145: Early bail on unknown tokens: nice tightening.

This prevents silently accepting typos in attributes/tags. Good call.


160-161: Do we still require a language tag?

With the late “unknown tag” check gone, a block with only attributes (e.g. ignore) now parses without a language. If policy is “code blocks must specify language” (per CONTRIBUTING), add a final guard.

Apply this diff:

         }
 
-        Ok(code_block)
+        if code_block.document_file_source() == DocumentFileSource::Unknown {
+            bail!("Missing or unsupported language tag in code block");
+        }
+        Ok(code_block)
crates/biome_js_analyze/src/lint/nursery/use_sorted_classes.rs (1)

63-63: Doc example now parses (self‑closing JSX) — LGTM

Consistent with the other JSX example. Nice tidy‑up.

crates/biome_js_analyze/src/lint/complexity/no_useless_type_constraint.rs (1)

61-61: Closed fence fixes the snippet — LGTM

This removes a silent parse failure in the ruledoc block.

crates/biome_js_analyze/src/lint/complexity/no_useless_constructor.rs (1)

59-72: Switching the example to ts is correct here

Protected constructor requires TS; example now parses. All good.

crates/biome_json_analyze/src/assist/source/use_sorted_keys.rs (2)

49-56: Use expect_diff for assists — spot on

Also removed trailing comma, so JSON parses under stricter checks.


68-75: Consistent expect_diff in lexicographic example — LGTM

Matches the action’s behaviour and keeps the docs executable.

crates/biome_js_analyze/src/lint/correctness/no_invalid_use_before_declaration.rs (1)

27-27: Use let instead of const — correct

const x; is invalid; let x; makes the invalid‑usage example parseable.

crates/biome_js_analyze/src/lint/style/no_restricted_imports.rs (1)

264-265: Import sample normalised — LGTM

Keeps the example syntactically sound under the stricter ruledoc parser.

crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (1)

69-75: Great: added TS case showing comment handling

Demonstrates the “associated comments” behaviour clearly. Looks good.

crates/biome_js_analyze/src/lint/complexity/no_static_only_class.rs (1)

37-45: TS fence for TS‑only example — LGTM

The class with readonly is TS; fence matches content.

crates/biome_js_analyze/src/assist/source/use_sorted_keys.rs (2)

103-111: LGTM: options + expect_diff pairing is correct.

Natural order example now asserts a produced fix. Looks right.


122-130: LGTM: options + expect_diff pairing is correct.

Lexicographic order example also asserts a fix. All good.

xtask/rules_check/src/lib.rs (4)

315-319: LGTM: CSS parser accommodates common ruledoc patterns.

Enabling CSS Modules and Tailwind directives here should eliminate false parse errors in docs.


548-566: LGTM: synthetic JSON wrapper is correct

Good layering of {linter|assist}.{rules|actions}.{group}.{rule} and preservation of BOM/EOF.


579-582: LGTM: precise span offset adjustment

The zipped/checked subtraction guards against underflow; neat.


606-622: LGTM: deserialisation diagnostics surfaced clearly

Collecting and printing before bailing makes failures actionable.

@arendjr arendjr merged commit ea23d15 into biomejs:next Sep 20, 2025
27 checks passed
@codspeed-hq
Copy link

codspeed-hq bot commented Sep 20, 2025

CodSpeed Performance Report

Merging #7544 will not alter performance

Comparing arendjr:fix-ruledoc-compile-errors (88c3e65) with next (6bc556d)

Summary

✅ 133 untouched

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter A-Tooling Area: internal tools L-CSS Language: CSS L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant