-
-
Notifications
You must be signed in to change notification settings - Fork 714
docs: improve noDuplicateDependencies #7471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: improve noDuplicateDependencies #7471
Conversation
|
WalkthroughThe 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
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
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.
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 detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
⏰ 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)
✨ Finishing touches
🧪 Generate unit tests
Comment |
There was a problem hiding this 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 entriesYou’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 blocksThis 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 parallelismSmall 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 exampleYou 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
📒 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 exampleGood, clear invalid example for duplicate keys within the same group.
11-16
: Docs opening reads wellSingle‑line summary and immediate scoping of supported groups match our docs guidelines.
/// ### 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"] | ||
/// } | ||
/// ``` |
There was a problem hiding this comment.
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.
crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
Outdated
Show resolved
Hide resolved
CodSpeed Performance ReportMerging #7471 will not alter performanceComparing Summary
Footnotes |
1a21169
to
da410aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you !
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Summary
Improve documentation for noDuplicateDependencies due to; #7468