+
Skip to content

Conversation

Netail
Copy link
Contributor

@Netail Netail commented Sep 11, 2025

Summary

Improve documentation for noDuplicateDependencies due to; #7468

Copy link

changeset-bot bot commented Sep 11, 2025

⚠️ No Changeset found

Latest commit: 5342190

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 L-JSON Language: JSON and super languages labels Sep 11, 2025
Copy link
Contributor

coderabbitai bot commented Sep 11, 2025

Walkthrough

The PR expands the doc comment for the NoDuplicateDependencies lint (crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs) to a multi-group spec listing supported dependency groups, an explicit same‑group duplicate prohibition, cross‑group constraints, and valid/invalid object/array examples. It also updates packages/@biomejs/biome/CHANGELOG.md to change links to biomejs.dev and add JSON examples for the rule in the 2.2.4 notes. No functional code or public API signatures were changed.

Possibly related PRs

Suggested reviewers

  • ematipico
  • arendjr

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title "docs: improve noDuplicateDependencies" is concise and accurately describes the primary change (documentation improvements for the noDuplicateDependencies lint rule), making it clear for reviewers and history scanning.
Description Check ✅ Passed The description states the intent to improve documentation for noDuplicateDependencies and links to the motivating discussion, which matches the diff (expanded rule docs and changelog updates).
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent 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 6960459 and da410aa.

📒 Files selected for processing (2)
  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs (1 hunks)
  • packages/@biomejs/biome/CHANGELOG.md (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/@biomejs/biome/CHANGELOG.md
  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.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). (26)
  • GitHub Check: Test Node.js API
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Documentation
  • GitHub Check: End-to-end tests
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check JS Files
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: autofix
✨ 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: 2

🧹 Nitpick comments (4)
packages/@biomejs/biome/CHANGELOG.md (2)

85-121: Duplicate example blocks across two 2.2.4 entries

You’ve added the three JSON examples here and again under the later 2.2.4 entry (Line 177+). Consider keeping the examples in a single entry and cross‑referencing to avoid churn in the changelog.

- For example, the following snippets will trigger the rule:
+ For examples, see the entry below in this release (noDuplicateDependencies), which demonstrates cross‑section duplicates.

177-213: Avoid repeating identical example blocks

This section repeats the same three JSON examples already added earlier in this release. Prefer linking once to keep the changelog tight.

- For example, the following snippets will trigger the rule:
+ For examples, see the earlier 2.2.4 entry for noDuplicateDependencies.
crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs (2)

51-56: Tighten cross‑group wording and parallelism

Small phrasing tweaks improve clarity and match the code’s behaviour (UNIQUE_PROPERTY_KEYS).

-/// Some dependency group dependencies are checked against other dependency groups;
-///  - Dependencies listed in "dependencies" cannot be listed under "devDependencies", "optionalDependencies" or "peerDependencies".
-///  - Dependencies listed in "optionalDependencies" cannot be listed under "peerDependencies" (and vice versa).
-///
-/// Dependencies listed in "devDependencies" are allowed to be listed in "optionalDependencies" or "peerDependencies".
-/// And dependencies listed in "overrides" & "bundleDependencies" are not checked within other dependency groups other than their own.
+/// Cross‑group checks:
+/// - Items in "dependencies" must not also appear in "devDependencies", "optionalDependencies", or "peerDependencies".
+/// - Items in "optionalDependencies" must not appear in "peerDependencies" (and vice versa).
+///
+/// Items in "devDependencies" may also appear in "optionalDependencies" or "peerDependencies".
+/// Items in "overrides" and "bundleDependencies" are only checked for duplicates within their own group (no cross‑group checks).

58-82: Consider adding an optional vs peer invalid example

You document that optional vs peer duplicates are disallowed; adding a short invalid snippet here would make that explicit.

 /// ### Invalid
 ///
 /// ```json
 /// {
-///     "dependencies": {
-///         "foo": "1.0.0"
-///     },
-///     "devDependencies": {
-///         "foo": "1.0.0"
-///     }
+///   "optionalDependencies": {
+///     "bar": "1.0.0"
+///   },
+///   "peerDependencies": {
+///     "bar": "1.0.0"
+///   }
 /// }
 /// ```
📜 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 46fd85e and 6960459.

📒 Files selected for processing (2)
  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs (1 hunks)
  • packages/@biomejs/biome/CHANGELOG.md (2 hunks)
🧰 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_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format all Rust source files before committing (just f)

Files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
🧠 Learnings (5)
📓 Common learnings
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
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 : When deprecating a rule, add `deprecated: "<reason>"` to `declare_lint_rule!`
📚 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_json_analyze/src/lint/nursery/no_duplicate_dependencies.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_json_analyze/src/lint/nursery/no_duplicate_dependencies.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 : When deprecating a rule, add `deprecated: "<reason>"` to `declare_lint_rule!`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.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_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: Check JS Files
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
🔇 Additional comments (2)
crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs (2)

20-27: LGTM on intra-group duplicate example

Good, clear invalid example for duplicate keys within the same group.


11-16: Docs opening reads well

Single‑line summary and immediate scoping of supported groups match our docs guidelines.

Comment on lines 18 to 49
/// ### Invalid
///
/// ```json
/// {
/// "dependencies": {
/// "foo": "1.0.0",
/// "foo": "2.0.0"
/// }
/// }
/// ```
///
/// ``json
/// {
/// "bundleDependencies": ["foo", "foo"]
/// }
/// ```
///
/// ### Valid
///
/// ```json
/// {
/// "dependencies": {
/// "foo": "2.0.0"
/// }
/// }
/// ```
///
/// ```json
/// {
/// "bundleDependencies": ["foo"]
/// }
/// ```
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Mark invalid snippets per docs testing conventions

Per contributor docs, invalid examples should be marked so doctests expect a diagnostic. Please confirm the correct marker for JSON rule snippets (e.g. fence modifiers) and apply it to the “Invalid” blocks.


🏁 Script executed:

#!/bin/bash
# Locate similar rule docs that use expect_diagnostic in JSON examples
rg -nP -C2 '```json.*expect_diagnostic|expect_diagnostic' crates/biome_*_analyze/src/lint/**/ -g '!**/target/**'

Length of output: 0


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "1) Search repo for 'expect_diagnostic' (anywhere)"
rg -n --hidden -S 'expect_diagnostic' || true

echo -e "\n2) Search for fenced json blocks that include 'expect_diagnostic' on the fence line"
rg -nP --hidden -S '```(?:json|jsonc)\s*expect_diagnostic' || true

echo -e "\n3) Search for '### Invalid' followed by a json code fence (multiline search)"
rg -nP --hidden -S '(?s)###\s*Invalid.*?```(?:json|jsonc)' || true

echo -e "\n4) Show the target file (first 200 lines) for context"
sed -n '1,200p' crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs || true

Length of output: 122372


Mark Invalid JSON examples with expect_diagnostic & fix the broken fence

Add ,expect_diagnostic to all "### Invalid" JSON code fences and correct the malformed ``json fence.

  • File: crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs — change the initial ```json```json,expect_diagnostic and the stray ``json → ```json,expect_diagnostic; also update the later "### Invalid" (dependencies/devDependencies) snippet to ` ```json,expect_diagnostic `.
🤖 Prompt for AI Agents
In crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
around lines 18 to 49, the "### Invalid" JSON code fences are missing the
expect_diagnostic marker and one fence is malformed; update each invalid example
by replacing the opening "```json" fence with "```json,expect_diagnostic" (apply
to the initial invalid dependencies example, the stray malformed ``json fence,
and the later invalid dependencies/devDependencies snippet) so all invalid
examples are properly marked and the broken fence is corrected.

@github-actions github-actions bot added the A-Project Area: project label Sep 11, 2025
Copy link

codspeed-hq bot commented Sep 11, 2025

CodSpeed Performance Report

Merging #7471 will not alter performance

Comparing Netail:docs/improve-no-duplicate-dependencies (5342190) with main (ea585a9)1

Summary

✅ 133 untouched benchmarks

Footnotes

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

@Netail Netail force-pushed the docs/improve-no-duplicate-dependencies branch from 1a21169 to da410aa Compare September 11, 2025 09:18
@github-actions github-actions bot removed the A-Project Area: project label Sep 11, 2025
@github-actions github-actions bot added the A-Project Area: project label Sep 11, 2025
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Thank you !

@ematipico ematipico merged commit 1054ff1 into biomejs:main Sep 12, 2025
31 checks passed
@Netail Netail deleted the docs/improve-no-duplicate-dependencies branch September 12, 2025 07:58
kedevked pushed a commit to kedevked/biome that referenced this pull request Sep 22, 2025
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

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