Skip to content

Conversation

@tylersayshi
Copy link
Contributor

AI Discloser: This PR was written primarily by Claude Code. I personally read through everything and did cleanup as needed after having claude code model this change after #7142

Summary

This adds the rule discussed here: #8280

It allows the enforcement of required package.json scripts, which is useful for large monorepos that need a set of consistent scripts in each of their workspaces.

Test Plan

Tests added with snapshots (modeled after #7142)

Docs

documentation is part of the rule definition. I'm happy to add more as is necessary 🙌

@changeset-bot
Copy link

changeset-bot bot commented Nov 26, 2025

🦋 Changeset detected

Latest commit: 29b0ac6

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

@github-actions github-actions bot added A-Project Area: project A-Linter Area: linter L-JSON Language: JSON and super languages A-Diagnostic Area: diagnostocis labels Nov 26, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

Walkthrough

Adds a new nursery lint rule UseRequiredScripts that enforces presence of configured script names in package.json, including rule state, run and diagnostic implementations. Adds tests with valid/invalid fixtures and per-test options files. Introduces UseRequiredScriptsOptions and exposes its module. Adds is_package_json utility and updates no_duplicate_dependencies to use it. Moves camino from dev-dependencies to regular dependencies in the analyzer crate. Adds patch changelog entries.

Suggested reviewers

  • ematipico
  • dyc3

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding a new linter rule called useRequiredScripts for JSON analysis.
Description check ✅ Passed The description clearly explains the purpose, context, and implementation approach, relating directly to the changeset throughout.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 2416055 and 29b0ac6.

⛔ Files ignored due to path filters (4)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/package.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/package.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/no-scripts-section/package.json.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (1)
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files using just format before committing

Files:

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use the dbg!() macro for debugging in Rust code, and run tests with --show-output flag to see debug output

Files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧠 Learnings (41)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noInvalid` prefix for rules that report runtime errors from mistyping (e.g., `noInvalidConstructorSuper`)
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `declare_lint_rule!` macro must include metadata fields: `version` (set to 'next'), `name` (rule identifier), `language` (applicable language), `recommended` (boolean), and optional fields like `severity`, `fix_kind`, `sources`, `domains`, and `deprecated`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Deprecate rules by adding a `deprecated` field to the `declare_lint_rule!` macro with a message explaining the reason for deprecation (e.g., 'Use the rule noAnotherVar')

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `no` prefix naming convention when the sole intention is to forbid a single concept (e.g., `noDebugger` to disallow debugger statements)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useShorthand` prefix for rules that report syntax rewritable using equivalent compact syntax (e.g., `useShorthandAssign`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noMisleading` prefix for rules that report valid but potentially misleading code (e.g., `noMisleadingCharacterClass`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `rule_category!()` macro instead of dynamic string parsing to refer to rule diagnostic categories for compile-time validation

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T15:53:30.831Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T15:53:30.831Z
Learning: Applies to **/crates/biome_analyze/**/*.rs : Update inline rustdoc documentation for rules, assists, and their options when implementing new features or changes

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `action` function must return a `JsRuleAction` (or equivalent language-specific action type) with category `ctx.action_category(ctx.category(), ctx.group())` and applicability from `ctx.metadata().applicability()`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : In rule documentation code blocks, mark invalid examples with the `expect_diagnostic` property and valid examples without it; each invalid example must emit exactly one diagnostic

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rule diagnostics must explain to the user what the error is, why it is triggered, and what should be done to fix it following the three pillars: (1) what the error is, (2) why the error is triggered, (3) what the user should do

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Document rules with a one-line brief description in the first paragraph of the doc comment, followed by detailed paragraphs, `## Examples` section with `### Invalid` and `### Valid` subsections, and optional `## Options` section

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : For rules ported from other ecosystems like ESLint or Clippy, add a `sources` field with `RuleSource` metadata using `.same()` for identical behavior or `.inspired()` for different behavior

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T15:53:30.831Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T15:53:30.831Z
Learning: Applies to **/crates/*/Cargo.toml : Use path dependencies for dev-dependencies to avoid requiring published versions of internal crates

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noInvalid` prefix for rules that report runtime errors from mistyping (e.g., `noInvalidConstructorSuper`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `run` function of a lint rule should return `Option<Self::State>` or an iterable like `Vec<Self::State>` or `Box<[Self::State]>` to signal zero or more diagnostics

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Code actions must specify a `fix_kind` field in the `declare_lint_rule!` macro as either `FixKind::Safe` or `FixKind::Unsafe` to indicate whether fixes always preserve program behavior

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When navigating CST nodes that return `Result`, use the try operator `?` to convert to `Option`, or use `let else` pattern for `Vec` return types in rule run functions

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T15:53:30.831Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T15:53:30.831Z
Learning: Create a changeset for user-facing changes using `just new-changeset` command

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧬 Code graph analysis (1)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1)
crates/biome_json_analyze/src/utils.rs (1)
  • is_package_json (17-22)
🔇 Additional comments (3)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (3)

9-15: LGTM!

Clean state structure with appropriate fields for the diagnostic.


77-133: LGTM!

Solid implementation with proper error handling, appropriate early returns, and efficient missing script detection. The logic correctly handles both the "no scripts section" and "some scripts missing" cases with appropriate ranges for diagnostics.


135-154: LGTM!

The diagnostic properly follows the rule pillars (what, why, what to do) with clear singular/plural handling. The _ctx parameter is correctly prefixed with an underscore since it's genuinely unused in the function body.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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 (1)
crates/biome_rule_options/src/use_required_scripts.rs (1)

10-10: Consider using Box<[Box<str>]> for memory efficiency.

Per project conventions, array-type options should use Box<[Box<str>]> instead of Vec<String> to reduce memory overhead. This is a minor optimisation you might defer if you prefer.

-    pub required_scripts: Vec<String>,
+    pub required_scripts: Box<[Box<str>]>,

Based on learnings, rule option fields should use Box<[Box<str>]> instead of Vec<String> for array types to save memory.

📜 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 8107ef3 and 8441a12.

⛔ Files ignored due to path filters (13)
  • crates/biome_configuration/src/analyzer/linter/rules.rs is excluded by !**/rules.rs and included by **
  • crates/biome_diagnostics_categories/src/categories.rs is excluded by !**/categories.rs and included by **
  • crates/biome_json_analyze/src/lint/nursery.rs is excluded by !**/nursery.rs and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/package.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/package.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/options.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/package.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/options.json.snap is excluded by !**/*.snap and included by **
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/package.json.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (14)
  • .changeset/brave-scripts-dance.md (1 hunks)
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/package.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/package.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/options.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/package.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/options.json (1 hunks)
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/package.json (1 hunks)
  • crates/biome_rule_options/src/lib.rs (1 hunks)
  • crates/biome_rule_options/src/use_required_scripts.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use the Rust dbg!() macro for debugging output during test execution, and pass the --show-output flag to cargo test to display debug output.
Use snapshot testing with the insta crate for testing in Rust projects. Accept or reject snapshots using cargo insta accept, cargo insta reject, or cargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against the next branch of the website repository.
Set the version metadata field in linter rule implementations to 'next' for newly created rules. Update this field to the new version number when releasing a minor or major version.

Files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_required_scripts.rs
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
**/.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Files:

  • .changeset/brave-scripts-dance.md
🧠 Learnings (36)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/tests/specs/**/*.{js,ts,tsx,jsx,json,css,graphql} : Test files for rules should be placed inside 'tests/specs/' directory organized by group and rule name (e.g., 'tests/specs/nursery/myRuleName/')
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/package.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/tests/specs/**/*.{js,ts,tsx,jsx,json,css,graphql} : Test files should use 'invalid' or 'valid' prefixes to indicate whether they contain code reported by the rule

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/package.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/tests/specs/**/*.{js,ts,tsx,jsx,json,css,graphql} : Test files for rules should be placed inside 'tests/specs/' directory organized by group and rule name (e.g., 'tests/specs/nursery/myRuleName/')

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/package.json
  • .changeset/brave-scripts-dance.md
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/package.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'options' should contain only rule-specific options in JSON/JSONC format, while 'full_options' contains complete biome.json configuration

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/options.json
  • crates/biome_rule_options/src/use_required_scripts.rs
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_required_scripts.rs
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Multi-file documentation snippets should use 'file=<path>' property to create an in-memory file system for testing cross-file rule behavior

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must have a '## Options' section after the '## Examples' section if the rule supports options, with each option having its own h3 header

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_rule_options/src/use_required_scripts.rs
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must include a '## Examples' header followed by '### Invalid' and '### Valid' sections, with '### Invalid' appearing first

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'use_options' must follow a preceding configuration block marked with 'options' or 'full_options'

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json
  • crates/biome_rule_options/src/use_required_scripts.rs
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 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:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/package.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/options.json
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json
📚 Learning: 2025-11-24T18:03:52.014Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.014Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.

Applied to files:

  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • .changeset/brave-scripts-dance.md
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that overwhelmingly apply to a specific framework should be named using 'use<Framework>...' or 'no<Framework>...' prefix (e.g., `noVueReservedProps`)

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule names should follow the 'use<Concept>' prefix when a rule's sole intention is to mandate a single concept (e.g., `useValidLang` for valid HTML lang attribute values)

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that promote equivalent compact syntax should use the 'useShorthand<Concept>' naming convention (e.g., `useShorthandAssign`)

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ban functions or variables should use the semantic model to check if the variable is global before reporting, to avoid false positives on locally redeclared variables

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The first paragraph of rule documentation must be a single line and serves as the brief description for the rule overview page

Applied to files:

  • crates/biome_rule_options/src/lib.rs
  • .changeset/brave-scripts-dance.md
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report unnecessary code that could be removed or simplified should use the 'noUseless<Concept>' naming convention (e.g., `noUselessConstructor`)

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ensure consistency across the codebase should use the 'useConsistent<Concept>' naming convention (e.g., `useConsistentArrayType`)

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Avoid deep indentation in rule implementations by using Rust helper functions like 'map', 'filter', and 'and_then' instead of nested if-let statements

Applied to files:

  • crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option structs must derive 'Deserializable', 'Serialize', 'Deserialize', and optionally 'JsonSchema' traits with serde attributes

Applied to files:

  • crates/biome_rule_options/src/use_required_scripts.rs
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : The rule option serde configuration must include 'rename_all = "camelCase"' to match biome.json naming conventions

Applied to files:

  • crates/biome_rule_options/src/use_required_scripts.rs
  • crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option structs must implement the 'biome_deserialize::Merge' trait to handle merging shared and user configurations

Applied to files:

  • crates/biome_rule_options/src/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should be wrapped in 'Option<_>' to properly track set and unset options during configuration merging

Applied to files:

  • crates/biome_rule_options/src/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : The rule option serde configuration must include 'deny_unknown_fields' to raise errors for extraneous fields in configuration

Applied to files:

  • crates/biome_rule_options/src/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should use 'Box<[Box<str>]>' instead of 'Vec<String>' for array types to save memory

Applied to files:

  • crates/biome_rule_options/src/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'

Applied to files:

  • .changeset/brave-scripts-dance.md
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:03:52.013Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.013Z
Learning: Applies to **/.changeset/*.md : Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Applied to files:

  • .changeset/brave-scripts-dance.md
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: New rules must be placed inside the 'nursery' group, which serves as an incubation space exempt from semantic versioning

Applied to files:

  • .changeset/brave-scripts-dance.md
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default

Applied to files:

  • .changeset/brave-scripts-dance.md
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that provide code actions must declare a 'fix_kind' field in the 'declare_lint_rule!' macro with either 'FixKind::Safe' or 'FixKind::Unsafe'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should be implemented with the 'impl Rule for RuleName' trait, including 'run' function that returns signals and optional 'diagnostic' and 'action' functions

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule implementation should use 'Type Query = Ast<NodeType>' to query the AST/CST for specific node types

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.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). (15)
  • GitHub Check: Documentation
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: lint
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Test Node.js API
  • GitHub Check: Validate rules documentation
  • GitHub Check: autofix
🔇 Additional comments (13)
crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/package.json (1)

1-8: Test fixture looks good.

The fixture correctly demonstrates all required scripts being present. LGTM!

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/options.json (1)

1-3: Configuration correct.

The camelCase requiredScripts property is properly defined and aligns with the test scenario.

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/options.json (1)

1-3: Configuration correct.

The camelCase requiredScripts property is properly defined and aligns with the test scenario.

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-single-script/package.json (1)

1-6: Test fixture looks good.

The fixture correctly demonstrates a missing required script (build), paired with the options configuration. LGTM!

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/options.json (1)

1-3: Configuration correct.

The camelCase requiredScripts property is properly defined and aligns with the test scenario.

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/extra-scripts-present/package.json (1)

1-10: Test fixture looks good.

The fixture correctly demonstrates all required scripts present with extras included. This validates the rule doesn't reject additional scripts. LGTM!

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/valid/all-required-scripts-present/options.json (1)

1-3: Configuration correct.

The camelCase requiredScripts property is properly defined and aligns with the test scenario.

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-all-scripts/package.json (1)

1-6: Test fixture looks good.

The fixture correctly demonstrates all required scripts being missing, paired with the options configuration. LGTM!

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/options.json (1)

1-3: LGTM!

Test configuration correctly specifies the required scripts for the missing-multiple-scripts scenario. The format aligns with the pattern used in other rule test specs.

crates/biome_json_analyze/tests/specs/nursery/useRequiredScripts/invalid/missing-multiple-scripts/package.json (1)

1-6: LGTM!

Test fixture correctly demonstrates the missing-multiple-scripts scenario — only test is present while build and lint are absent.

.changeset/brave-scripts-dance.md (1)

1-47: Well-documented changeset!

Clear, user-facing description with appropriate examples. Follows the changeset guidelines with past tense for the action ("Added") and includes helpful configuration and diagnostic output examples.

crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1)

63-123: LGTM!

The rule implementation is well-structured with appropriate early exits for non-applicable files and empty configuration. The logic for detecting missing scripts is correct and efficient using FxHashSet.

crates/biome_rule_options/src/lib.rs (1)

352-352: Based on my investigation, I cannot directly access the codebase to verify whether the use_required_scripts module export was added via codegen or manually edited. However, I can confirm from the web search that:

  1. Biome uses cargo xtask codegen to generate rule options and related modules in the biome_rule_options crate
  2. Files marked "Generated file, do not edit by hand, see xtask/codegen" must not be manually edited—they should only be modified through the codegen process
  3. The module appears in alphabetical order (after use_regex_literals, before use_self_closing_elements), which is consistent with automated generation

However, I cannot verify the specific method used to add this line without access to the git history and codegen scripts. The concern raised in the review comment is legitimate and requires manual verification of:

  • Whether the change was committed as part of running cargo xtask codegen
  • Or whether the file was manually edited directly

Verify whether this module export was added via cargo xtask codegen or through manual file editing.

The file header states "Generated file, do not edit by hand, see xtask/codegen". Check the git commit history or codegen configuration to confirm the proper generation method was used.

tylersayshi and others added 2 commits November 26, 2025 15:52
…s.rs

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 26, 2025

CodSpeed Performance Report

Merging #8281 will not alter performance

Comparing tylersayshi:use-required-scripts (29b0ac6) with main (e7e0f6c)

Summary

✅ 15 untouched
⏩ 135 skipped1

Footnotes

  1. 135 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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_json_analyze/src/lint/nursery/use_required_scripts.rs (1)

125-125: Fix the parameter name mismatch—this won't compile.

Line 125 declares the parameter as _ctx, but Line 140 uses ctx without the underscore. This is a compilation error.

Apply this diff:

-    fn diagnostic(_ctx: &RuleContext<Self>, state: &Self::State) -> Option<RuleDiagnostic> {
+    fn diagnostic(ctx: &RuleContext<Self>, state: &Self::State) -> Option<RuleDiagnostic> {

Also applies to: 140-140

🧹 Nitpick comments (2)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (2)

9-12: Condense the first paragraph to a single line.

The first paragraph should be a single line that serves as the brief description for the rule overview page.

Based on learnings, rule documentation formatting.

Apply this diff:

-    /// Enforce the presence of required scripts in package.json.
-    ///
-    /// This rule ensures that specified scripts are defined in the `scripts` section of a `package.json` file.
-    /// It's particularly useful in monorepo environments where consistency across workspaces is important.
+    /// Enforce the presence of required scripts in package.json.
+    ///
+    /// This rule ensures that specified scripts are defined in the `scripts` section of a `package.json` file, particularly useful in monorepo environments where consistency across workspaces is important.

45-50: Simplify the options code block to show only rule-specific options.

The options code block should contain only the rule-specific options in JSON format, not the wrapper object structure.

Based on learnings, code blocks marked with 'options' should contain only rule-specific options.

Apply this diff:

-    /// ```json,options
-    /// {
-    ///     "options": {
-    ///         "requiredScripts": ["test", "build", "lint"]
-    ///     }
-    /// }
-    /// ```
+    /// ```json,options
+    /// {
+    ///     "requiredScripts": ["test", "build", "lint"]
+    /// }
+    /// ```
📜 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 8441a12 and 6fbb503.

📒 Files selected for processing (1)
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use the Rust dbg!() macro for debugging output during test execution, and pass the --show-output flag to cargo test to display debug output.
Use snapshot testing with the insta crate for testing in Rust projects. Accept or reject snapshots using cargo insta accept, cargo insta reject, or cargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against the next branch of the website repository.
Set the version metadata field in linter rule implementations to 'next' for newly created rules. Update this field to the new version number when releasing a minor or major version.

Files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/tests/specs/**/*.{js,ts,tsx,jsx,json,css,graphql} : Test files for rules should be placed inside 'tests/specs/' directory organized by group and rule name (e.g., 'tests/specs/nursery/myRuleName/')
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : The rule option serde configuration must include 'rename_all = "camelCase"' to match biome.json naming conventions
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'options' should contain only rule-specific options in JSON/JSONC format, while 'full_options' contains complete biome.json configuration
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must have a '## Options' section after the '## Examples' section if the rule supports options, with each option having its own h3 header
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule names should follow the 'use<Concept>' prefix when a rule's sole intention is to mandate a single concept (e.g., `useValidLang` for valid HTML lang attribute values)
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that provide code actions must declare a 'fix_kind' field in the 'declare_lint_rule!' macro with either 'FixKind::Safe' or 'FixKind::Unsafe'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should be implemented with the 'impl Rule for RuleName' trait, including 'run' function that returns signals and optional 'diagnostic' and 'action' functions

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The first paragraph of rule documentation must be a single line and serves as the brief description for the rule overview page

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should only have severity set to 'error' if they report hard errors, dangerous code, or accessibility issues; use 'warn' for possibly erroneous code; use 'info' for stylistic suggestions

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report unnecessary code that could be removed or simplified should use the 'noUseless<Concept>' naming convention (e.g., `noUselessConstructor`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule names should follow the 'use<Concept>' prefix when a rule's sole intention is to mandate a single concept (e.g., `useValidLang` for valid HTML lang attribute values)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report redundant code should use the 'noRedundant<Concept>' naming convention (e.g., `noRedundantUseStrict`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that promote equivalent compact syntax should use the 'useShorthand<Concept>' naming convention (e.g., `useShorthandAssign`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule diagnostic and action functions must set the category using 'rule_category!()' macro instead of dynamically parsing string names

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ensure consistency across the codebase should use the 'useConsistent<Concept>' naming convention (e.g., `useConsistentArrayType`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should use 'Type Signals = Box<[Self::State]>' instead of 'Vec<Self::State>' to report multiple diagnostics for a single query match, to save memory

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report code that can lead to runtime failures should use the 'noUnsafe<Concept>' naming convention (e.g., `noUnsafeOptionalChaining`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in rule documentation must specify a language and use 'expect_diagnostic' property for invalid snippets that should emit exactly one diagnostic

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule implementation should use 'Type Query = Ast<NodeType>' to query the AST/CST for specific node types

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should be wrapped in 'Option<_>' to properly track set and unset options during configuration merging

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧬 Code graph analysis (1)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1)
crates/biome_analyze/src/rule.rs (1)
  • recommended (602-605)

@tylersayshi
Copy link
Contributor Author

the coderabbit and changelog setup here is quite nice 👏

Copy link
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

I love reviewing easy PRs. Great first draft! Nice attention to detail on the diagnostic. Just a couple of other notes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 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 260906a and 66c591f.

⛔ Files ignored due to path filters (2)
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
  • packages/@biomejs/biome/configuration_schema.json is excluded by !**/configuration_schema.json and included by **
📒 Files selected for processing (2)
  • .changeset/brave-scripts-dance.md (1 hunks)
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/brave-scripts-dance.md
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use the Rust dbg!() macro for debugging output during test execution, and pass the --show-output flag to cargo test to display debug output.
Use snapshot testing with the insta crate for testing in Rust projects. Accept or reject snapshots using cargo insta accept, cargo insta reject, or cargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against the next branch of the website repository.
Set the version metadata field in linter rule implementations to 'next' for newly created rules. Update this field to the new version number when releasing a minor or major version.

Files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧠 Learnings (29)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must have a '## Options' section after the '## Examples' section if the rule supports options, with each option having its own h3 header
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : The rule option serde configuration must include 'rename_all = "camelCase"' to match biome.json naming conventions
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare 'domains' field in 'declare_lint_rule!' to specify which domain(s) they belong to (e.g., RuleDomain::Test for testing rules)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option structs must derive 'Deserializable', 'Serialize', 'Deserialize', and optionally 'JsonSchema' traits with serde attributes
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that provide code actions must declare a 'fix_kind' field in the 'declare_lint_rule!' macro with either 'FixKind::Safe' or 'FixKind::Unsafe'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should be implemented with the 'impl Rule for RuleName' trait, including 'run' function that returns signals and optional 'diagnostic' and 'action' functions

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The first paragraph of rule documentation must be a single line and serves as the brief description for the rule overview page

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare 'domains' field in 'declare_lint_rule!' to specify which domain(s) they belong to (e.g., RuleDomain::Test for testing rules)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report unnecessary code that could be removed or simplified should use the 'noUseless<Concept>' naming convention (e.g., `noUselessConstructor`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule names should follow the 'use<Concept>' prefix when a rule's sole intention is to mandate a single concept (e.g., `useValidLang` for valid HTML lang attribute values)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report redundant code should use the 'noRedundant<Concept>' naming convention (e.g., `noRedundantUseStrict`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that promote equivalent compact syntax should use the 'useShorthand<Concept>' naming convention (e.g., `useShorthandAssign`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule diagnostic and action functions must set the category using 'rule_category!()' macro instead of dynamically parsing string names

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ensure consistency across the codebase should use the 'useConsistent<Concept>' naming convention (e.g., `useConsistentArrayType`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should use 'Type Signals = Box<[Self::State]>' instead of 'Vec<Self::State>' to report multiple diagnostics for a single query match, to save memory

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report code that can lead to runtime failures should use the 'noUnsafe<Concept>' naming convention (e.g., `noUnsafeOptionalChaining`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should only have severity set to 'error' if they report hard errors, dangerous code, or accessibility issues; use 'warn' for possibly erroneous code; use 'info' for stylistic suggestions

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in rule documentation must specify a language and use 'expect_diagnostic' property for invalid snippets that should emit exactly one diagnostic

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule implementation should use 'Type Query = Ast<NodeType>' to query the AST/CST for specific node types

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should be wrapped in 'Option<_>' to properly track set and unset options during configuration merging

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Use 'let else' pattern to reduce code branching when the rule's run function returns 'Vec'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must have a '## Options' section after the '## Examples' section if the rule supports options, with each option having its own h3 header

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'options' should contain only rule-specific options in JSON/JSONC format, while 'full_options' contains complete biome.json configuration

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-21T01:10:53.036Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.036Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:03:52.013Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.013Z
Learning: Applies to **/*.rs : Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against the `next` branch of the website repository.

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'use_options' must follow a preceding configuration block marked with 'options' or 'full_options'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧬 Code graph analysis (1)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1)
crates/biome_analyze/src/rule.rs (1)
  • recommended (602-605)
🔇 Additional comments (1)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1)

60-141: LGTM!

The rule implementation is solid:

  • Proper early returns for non-package.json files and empty configurations
  • Uses if let chains appropriately (line 86-89)
  • Avoids unnecessary HashSet allocation by using iter().any() for membership checks (line 111)
  • Clean singular/plural handling in diagnostics
  • Correct usage of rule_category!() macro

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_json_analyze/src/lint/nursery/use_required_scripts.rs (1)

13-50: Restructure docs: move options snippet and simplify its JSON.

The json,options block currently lives under ### Invalid and wraps the options in an extra "options" object, which doesn’t match the documented convention for rule docs.

To align with the usual pattern:

  • Keep ## Examples as-is, but remove the json,options block from under ### Invalid.
  • Under ## Options### \requiredScripts`, add a json,options` block that contains only the rule-specific options payload.

Roughly:

-    /// ### Invalid
-    ///
-    /// ```json,options
-    /// {
-    ///     "options": {
-    ///         "requiredScripts": ["test", "build"]
-    ///     }
-    /// }
-    /// ```
-    ///
-    /// ```json,expect_diagnostic,use_options
+    /// ### Invalid
+    ///
+    /// ```json,expect_diagnostic,use_options
@@
-    /// ## Options
-    ///
-    /// ### `requiredScripts`
-    ///
-    /// An array of script names that must be present in the `scripts` section of `package.json`.
-    /// Default: `[]` (no scripts required)
-    ///
+    /// ## Options
+    ///
+    /// ### `requiredScripts`
+    ///
+    /// An array of script names that must be present in the `scripts` section of `package.json`.
+    /// Default: `[]` (no scripts required)
+    ///
+    /// ```json,options
+    /// {
+    ///     "requiredScripts": ["test", "build"]
+    /// }
+    /// ```
+    ///

This keeps use_options working while matching the rule-doc lints. Based on learnings.

🧹 Nitpick comments (2)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (2)

65-77: Consider making requiredScripts an optional field in the options type.

Here options.required_scripts is used as a plain Vec<String> with an emptiness check. The usual pattern for rule options is to wrap fields in Option<_> so configuration merging can distinguish “unset” from “explicitly set to empty”.

That would look like (sketch):

-// in biome_rule_options/src/use_required_scripts.rs
-pub struct UseRequiredScriptsOptions {
-    pub required_scripts: Vec<String>,
-}
+pub struct UseRequiredScriptsOptions {
+    pub required_scripts: Option<Vec<String>>,
+}

and then in this rule:

-        if options.required_scripts.is_empty() {
+        let required = options.required_scripts.as_deref().unwrap_or(&[]);
+        if required.is_empty() {
             return None;
         }
@@
-        let missing_scripts: Vec<String> = options
-            .required_scripts
+        let missing_scripts: Vec<String> = required
             .iter()
             .filter(|script| !existing_scripts.iter().any(|s| s == *script))
             .cloned()
             .collect();

Not a blocker, but worth considering for consistency with other rules. Based on learnings.


127-140: Tidy up the markup! conditional for readability.

The nested {{ … }} in the note is a bit hard to read; the common style is to use a single brace group for the conditional text:

-        Some(
-            RuleDiagnostic::new(rule_category!(), ctx.query().range(), message).note(markup! {
-                "Add the missing script"{{if missing_count > 1 { "s" } else { "" }}}" to your package.json."
-            }),
-        )
+        Some(
+            RuleDiagnostic::new(rule_category!(), ctx.query().range(), message).note(markup! {
+                "Add the missing script"
+                { if missing_count > 1 { "s" } else { "" } }
+                " to your package.json."
+            }),
+        )

Same output, but a bit less squinting for the next person reading it.

📜 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 66c591f and f5a1438.

📒 Files selected for processing (1)
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use the Rust dbg!() macro for debugging output during test execution, and pass the --show-output flag to cargo test to display debug output.
Use snapshot testing with the insta crate for testing in Rust projects. Accept or reject snapshots using cargo insta accept, cargo insta reject, or cargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against the next branch of the website repository.
Set the version metadata field in linter rule implementations to 'next' for newly created rules. Update this field to the new version number when releasing a minor or major version.

Files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧠 Learnings (30)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare 'domains' field in 'declare_lint_rule!' to specify which domain(s) they belong to (e.g., RuleDomain::Test for testing rules)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must have a '## Options' section after the '## Examples' section if the rule supports options, with each option having its own h3 header
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that provide code actions must declare a 'fix_kind' field in the 'declare_lint_rule!' macro with either 'FixKind::Safe' or 'FixKind::Unsafe'
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that provide code actions must declare a 'fix_kind' field in the 'declare_lint_rule!' macro with either 'FixKind::Safe' or 'FixKind::Unsafe'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should be implemented with the 'impl Rule for RuleName' trait, including 'run' function that returns signals and optional 'diagnostic' and 'action' functions

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The first paragraph of rule documentation must be a single line and serves as the brief description for the rule overview page

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule names should follow the 'use<Concept>' prefix when a rule's sole intention is to mandate a single concept (e.g., `useValidLang` for valid HTML lang attribute values)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report unnecessary code that could be removed or simplified should use the 'noUseless<Concept>' naming convention (e.g., `noUselessConstructor`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report redundant code should use the 'noRedundant<Concept>' naming convention (e.g., `noRedundantUseStrict`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that promote equivalent compact syntax should use the 'useShorthand<Concept>' naming convention (e.g., `useShorthandAssign`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule diagnostic and action functions must set the category using 'rule_category!()' macro instead of dynamically parsing string names

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ensure consistency across the codebase should use the 'useConsistent<Concept>' naming convention (e.g., `useConsistentArrayType`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should use 'Type Signals = Box<[Self::State]>' instead of 'Vec<Self::State>' to report multiple diagnostics for a single query match, to save memory

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report code that can lead to runtime failures should use the 'noUnsafe<Concept>' naming convention (e.g., `noUnsafeOptionalChaining`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules should only have severity set to 'error' if they report hard errors, dangerous code, or accessibility issues; use 'warn' for possibly erroneous code; use 'info' for stylistic suggestions

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in rule documentation must specify a language and use 'expect_diagnostic' property for invalid snippets that should emit exactly one diagnostic

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule implementation should use 'Type Query = Ast<NodeType>' to query the AST/CST for specific node types

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should be wrapped in 'Option<_>' to properly track set and unset options during configuration merging

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Use 'let else' pattern to reduce code branching when the rule's run function returns 'Vec'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must have a '## Options' section after the '## Examples' section if the rule supports options, with each option having its own h3 header

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'options' should contain only rule-specific options in JSON/JSONC format, while 'full_options' contains complete biome.json configuration

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-21T01:10:53.036Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.036Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:03:52.013Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.013Z
Learning: Applies to **/*.rs : Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against the `next` branch of the website repository.

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'use_options' must follow a preceding configuration block marked with 'options' or 'full_options'

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must include a '## Examples' header followed by '### Invalid' and '### Valid' sections, with '### Invalid' appearing first

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Code blocks in documentation marked with 'expect_diagnostic' must emit exactly one diagnostic for the build system to generate it automatically

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧬 Code graph analysis (1)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (2)
crates/biome_service/src/workspace.rs (1)
  • markup (1176-1178)
crates/biome_analyze/src/rule.rs (1)
  • recommended (602-605)
🔇 Additional comments (1)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1)

79-121: Rule logic and AST walk look solid.

Nice use of early returns, Ast<JsonRoot>, and the iter().any approach for checking presence instead of building a set. The restriction to package.json and the “no options ⇒ no-op” behaviour make sense for a nursery rule.

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.

The rule isn't working. Check the snapshots, there aren't any diagnostics

Comment on lines 72 to 74
if !path.ends_with(PACKAGE_JSON) {
return None;
}
Copy link
Member

Choose a reason for hiding this comment

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

This causes false positives. A file called _package.json would trigger the rule. Please use a better check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i added a utility that matches on the path filename and used it for both rules.

This relied on using Utf8Path from camino, and from the cargo errors, it seemed that I needed to move camino from a dev-dep to a dependency.

Copy link
Member

Choose a reason for hiding this comment

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

If you decide to fix it, you'd need to create a changeset for that too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's fixed. i added a note to the changeset. is that what you meant? or were you wanting another changeset file?

Copy link
Member

Choose a reason for hiding this comment

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

I meant a new changeset. Each fix gets its own changeset

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, added a new changeset file.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

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

⚠️ Outside diff range comments (1)
crates/biome_json_analyze/src/utils.rs (1)

3-22: Fix is_package_json comparison to avoid a type mismatch

Path::file_name yields Option<&OsStr>, so name == "package.json" won’t compile because &OsStr doesn’t implement PartialEq<&str>. You can keep this nice helper and make it compile by using Path::ends_with instead:

-pub(crate) fn is_package_json(path: &Path) -> bool {
-    match path.file_name() {
-        Some(name) => name == "package.json",
-        None => false,
-    }
-}
+pub(crate) fn is_package_json(path: &Path) -> bool {
+    path.ends_with("package.json")
+}

This keeps the intent clear and works across nested workspaces as well.

🧹 Nitpick comments (1)
crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs (1)

10-11: is_package_json guard looks good (tiny ordering nit if you fancy)

Nice extraction of the package.json check into a shared helper, and wiring it into the rule keeps things DRY and clearer about scope. If you want to be extra tidy, you can bail out before poking at the JSON value:

 fn run(ctx: &RuleContext<Self>) -> Self::Signals {
     let query = ctx.query();
     let path = ctx.file_path();
 
-    let value = query.value().ok()?;
-    let object_value = value.as_json_object_value()?;
-
     if !is_package_json(path) {
         return None;
     }
+
+    let value = query.value().ok()?;
+    let object_value = value.as_json_object_value()?;

Not a blocker; the current placement is functionally fine.

Also applies to: 136-138

📜 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 f5a1438 and fc96d5a.

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files using just format before committing

Files:

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use the dbg!() macro for debugging in Rust code, and run tests with --show-output flag to see debug output

Files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
  • crates/biome_json_analyze/src/utils.rs
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release version
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare a 'recommended' field in 'declare_lint_rule!' to indicate if they should be enabled by default
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T15:53:30.817Z
Learning: Applies to **/crates/biome_analyze/**/*.rs : Update inline rustdoc documentation for rules, assists, and their options when implementing new features or changes
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'language' field in 'declare_lint_rule!' should be set to the specific JavaScript dialect (jsx, ts, tsx) if the rule only applies to that dialect, otherwise use 'js'
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rule documentation must have a '## Options' section after the '## Examples' section if the rule supports options, with each option having its own h3 header
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that provide code actions must declare a 'fix_kind' field in the 'declare_lint_rule!' macro with either 'FixKind::Safe' or 'FixKind::Unsafe'
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules can declare 'domains' field in 'declare_lint_rule!' to specify which domain(s) they belong to (e.g., RuleDomain::Test for testing rules)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report duplication overriding previous occurrences should use the 'noDuplicate<Concept>' naming convention (e.g., `noDuplicateObjectKeys`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Deprecated rules must include a 'deprecated' field in the 'declare_lint_rule!' macro with the reason for deprecation

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report redundant code should use the 'noRedundant<Concept>' naming convention (e.g., `noRedundantUseStrict`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Use 'declare_node_union!' macro to query multiple node types at once instead of repeating rule implementations for similar nodes

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ban functions or variables should use the semantic model to check if the variable is global before reporting, to avoid false positives on locally redeclared variables

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report unnecessary code that could be removed or simplified should use the 'noUseless<Concept>' naming convention (e.g., `noUselessConstructor`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ensure consistency across the codebase should use the 'useConsistent<Concept>' naming convention (e.g., `useConsistentArrayType`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Avoid deep indentation in rule implementations by using Rust helper functions like 'map', 'filter', and 'and_then' instead of nested if-let statements

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
  • crates/biome_json_analyze/src/utils.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that report unused entities should use the 'noUnused<Concept>' naming convention (e.g., `noUnusedVariables`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : The rule option serde configuration must include 'deny_unknown_fields' to raise errors for extraneous fields in configuration

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule options must be defined in the `biome_rule_options` crate in a file matching the rule name (e.g., 'use_this_convention.rs' for rule `useThisConvention`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option structs must derive 'Deserializable', 'Serialize', 'Deserialize', and optionally 'JsonSchema' traits with serde attributes

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Rule option fields should be wrapped in 'Option<_>' to properly track set and unset options during configuration merging

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs
🧬 Code graph analysis (1)
crates/biome_json_analyze/src/lint/nursery/no_duplicate_dependencies.rs (1)
crates/biome_json_analyze/src/utils.rs (1)
  • is_package_json (17-22)

@tylersayshi
Copy link
Contributor Author

The rule isn't working. Check the snapshots, there aren't any diagnostics

Whoops, thanks! should be fixed now

Copy link
Contributor

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

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

Good work. No more notes from me, thank you!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1)

56-62: Consider adding a code example to the Options section.

Whilst the description is clear, including a json,options code block showing the schema would help users understand how to configure this rule, following patterns in other rules.

Example:

/// ## Options
///
/// ### `requiredScripts`
///
/// An array of script names that must be present in the `scripts` section of `package.json`.
/// Default: `[]` (no scripts required)
///
/// ```json,options
/// {
///     "requiredScripts": ["test", "build"]
/// }
/// ```
📜 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 6a0e199 and 4709fb4.

📒 Files selected for processing (2)
  • .changeset/brave-scripts-dance.md (1 hunks)
  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/brave-scripts-dance.md
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files using just format before committing

Files:

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

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use the dbg!() macro for debugging in Rust code, and run tests with --show-output flag to see debug output

Files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧠 Learnings (37)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `declare_lint_rule!` macro must include metadata fields: `version` (set to 'next'), `name` (rule identifier), `language` (applicable language), `recommended` (boolean), and optional fields like `severity`, `fix_kind`, `sources`, `domains`, and `deprecated`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Deprecate rules by adding a `deprecated` field to the `declare_lint_rule!` macro with a message explaining the reason for deprecation (e.g., 'Use the rule noAnotherVar')

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `no` prefix naming convention when the sole intention is to forbid a single concept (e.g., `noDebugger` to disallow debugger statements)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useShorthand` prefix for rules that report syntax rewritable using equivalent compact syntax (e.g., `useShorthandAssign`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noMisleading` prefix for rules that report valid but potentially misleading code (e.g., `noMisleadingCharacterClass`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `rule_category!()` macro instead of dynamic string parsing to refer to rule diagnostic categories for compile-time validation

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T15:53:30.831Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T15:53:30.831Z
Learning: Applies to **/crates/biome_analyze/**/*.rs : Update inline rustdoc documentation for rules, assists, and their options when implementing new features or changes

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `action` function must return a `JsRuleAction` (or equivalent language-specific action type) with category `ctx.action_category(ctx.category(), ctx.group())` and applicability from `ctx.metadata().applicability()`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : In rule documentation code blocks, mark invalid examples with the `expect_diagnostic` property and valid examples without it; each invalid example must emit exactly one diagnostic

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rule diagnostics must explain to the user what the error is, why it is triggered, and what should be done to fix it following the three pillars: (1) what the error is, (2) why the error is triggered, (3) what the user should do

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-21T01:10:53.059Z
Learnt from: dyc3
Repo: biomejs/biome PR: 8171
File: crates/biome_js_analyze/src/lint/nursery/no_leaked_render.rs:125-137
Timestamp: 2025-11-21T01:10:53.059Z
Learning: In the Biome codebase, each lint rule has its own options type declaration (e.g., `type Options = RuleNameOptions`) as part of the codegen process, even if the options struct is empty or unused. This is standard practice and should not be flagged as an issue.

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Document rules with a one-line brief description in the first paragraph of the doc comment, followed by detailed paragraphs, `## Examples` section with `### Invalid` and `### Valid` subsections, and optional `## Options` section

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Biome linter is designed to work across languages, so rule naming should be generic if potentially implementable for multiple languages, or specific if meant for one language only

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : For rules ported from other ecosystems like ESLint or Clippy, add a `sources` field with `RuleSource` metadata using `.same()` for identical behavior or `.inspired()` for different behavior

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T15:53:30.831Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T15:53:30.831Z
Learning: Applies to **/crates/*/Cargo.toml : Use path dependencies for dev-dependencies to avoid requiring published versions of internal crates

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `run` function of a lint rule should return `Option<Self::State>` or an iterable like `Vec<Self::State>` or `Box<[Self::State]>` to signal zero or more diagnostics

Applied to files:

  • crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs
🧬 Code graph analysis (1)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (1)
crates/biome_json_analyze/src/utils.rs (1)
  • is_package_json (17-22)
🔇 Additional comments (4)
crates/biome_json_analyze/src/lint/nursery/use_required_scripts.rs (4)

1-7: LGTM!

The imports are well-organised and include all necessary dependencies for the rule.


9-15: LGTM!

The state struct is well-defined with appropriate fields and documentation.


77-140: LGTM!

The run function implementation is solid:

  • Proper early returns for non-package.json files and empty options
  • Clean use of find_map and iter().any following past review feedback
  • No unwrap/expect calls, maintaining safe error handling

29-35: Based on the web search results, I've discovered important context. Let me clarify the situation:

The web search shows that Biome's configuration format requires a nested structure with an "options" object for rule-specific settings. This is the official Biome configuration format.

However, I notice the review comment is about documentation examples (lines 29-35 in a Rust source file), not actual user configuration. The distinction is important:

  • User Configuration Format (biome.json): Requires nested "options" object ✓ (confirmed by web search)
  • Documentation Examples: May or may not follow the same format

The review comment claims this should be "flat" rather than nested, but the web search confirms that Biome's actual configuration format uses the nested structure shown in the current code.

This suggests the review comment may be incorrect. The past feedback marked as "✅ Addressed in commit f5a1438" may have been wrong, or there may be a misunderstanding about whether documentation should match the actual configuration format.

Given that:

  1. I cannot access the repository directly to verify the exact file state
  2. Web search confirms nested format is Biome's standard configuration structure
  3. The learnings reference standard Biome practices for rule declarations

Verify the current state of the file and whether the nested format is indeed correct per Biome's documentation standards.

@dyc3 dyc3 merged commit 30b046f into biomejs:main Nov 28, 2025
20 checks passed
@github-actions github-actions bot mentioned this pull request Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Diagnostic Area: diagnostocis 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.

3 participants