-
-
Notifications
You must be signed in to change notification settings - Fork 716
feat(lint): add useBiomeIgnoreFolder
and noBiomeFirstException
#7159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: a6a9012 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
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 |
useBiomeIgnoreFolder
and noBiomeFirstException
Walkthrough
Possibly related PRs
Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 9
🧹 Nitpick comments (12)
crates/biome_json_analyze/src/utils.rs (1)
50-51
: Doc nit: grammar and formattingTweak wording and code-style markers.
-/// Finds the first ancestor [JsonMember], and returns [true] if it's name matches the given input +/// Finds the first ancestor [JsonMember] and returns `true` if its name matches the given input.changeset/floppy-sloths-visit.md (1)
7-8
: Finish the sentence with a full stop.Guidelines require every sentence in a changeset to end with a period; swap the trailing colon for “.”.
.changeset/proud-olives-exist.md (1)
7-8
: Replace the trailing colon with a period.Keeps the prose compliant with the changelog rules.
crates/biome_rule_options/src/use_biome_ignore_folder.rs (1)
3-6
: Consider a unit structWith no fields you can drop
Default
+serde
boilerplate:-#[derive(Default, Clone, Debug, Deserialize, Deserializable, Eq, PartialEq, Serialize)] -pub struct UseBiomeIgnoreFolderOptions {} +#[derive(Clone, Debug, Deserializable, Eq, PartialEq)] +pub struct UseBiomeIgnoreFolderOptions;Smaller binary and zero-cost.
crates/biome_json_analyze/src/lint/nursery/use_biome_ignore_folder.rs (2)
42-49
: Missing## Options
sectionContribution guide demands an
## Options
doc block – even if empty – under the rustdoc. Please add it.
108-114
: Diagnostic copy-text typo“use the trailing
/**
” → “use the trailing/**
” is duplicated wordthe
.crates/biome_json_analyze/src/lint/nursery/no_biome_first_exception.rs (4)
108-114
: Sharpen diagnostic wordingMake the message explicit about “includes” and why it fails.
- "Incorrect usage of the exception detected." + "Do not start `files.includes` with a negation pattern (`!`)." @@ - "Having a pattern that starts with `!` as first item will cause Biome to match no files." + "If the first `includes` pattern starts with `!`, Biome will match no files."
140-141
: Typo in fix descriptionSpotted “patter”; should be “pattern”.
- "Add the patter "<Emphasis>"**"</Emphasis>" at the beginning of the list." + "Add the pattern "<Emphasis>"**"</Emphasis>" at the beginning of the list."
14-41
: Doc polish: code fences and missing Options section
- Invalid example should use
expect_diagnostic
per CONTRIBUTING.- Use
jsonc
fences for config examples.- Add an “Options” section (even if none).
- /// ### Invalid + /// ### Invalid @@ - /// ```json,ignore + /// ```jsonc,expect_diagnostic @@ - /// ### Valid + /// ### Valid @@ - /// ```json,ignore + /// ```jsonc @@ - /// ``` + /// ``` + /// + /// ## Options + /// + /// This rule has no options.
121-135
: Autofix rebuilds separators; may drop triviaRebuilding the entire element list with freshly minted separators can drop existing separator trivia (e.g. comments/spacing). If preserving trivia is important, prefer a “prepend one element” mutation API (insert a new element at index 0), reusing existing separators. If that API isn’t available here, current approach is acceptable for a Safe fix.
Happy to sketch a version using insert-before if desired.
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
1706-1709
: Replace placeholder JSDoc with a meaningful summaryDocument what the rule enforces so clients surface helpful help text.
Apply:
- /** - * Succinct description of the rule. - */ + /** + * Enforce folder ignore patterns in Biome configs without trailing slashes or globstars + * (prefer "dist" over "dist/" or "dist/**"). + */crates/biome_configuration/src/analyzer/linter/rules.rs (1)
4388-4399
: Fragile hard-coded indices in*_RULES_AS_FILTERS
Adding two rules shifted every index, forcing a manual update. Future edits are error-prone.
Consider generating these filter arrays programmatically:
const RECOMMENDED_RULES_AS_FILTERS: &[RuleFilter<'static>] = &[ // derive with `enumerate()` over an inline list of names ];This removes the need to juggle magic numbers.
Also applies to: 4461-4466
Self::UseNamingConvention => RuleGroup::Style, | ||
Self::UseNodeAssertStrict => RuleGroup::Style, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
UseNamingConvention
still listed under Nursery
The rule is now mapped to RuleGroup::Style
, yet it remains in Nursery::GROUP_RULES
and the derived index tables.
This inconsistency will cause filters & CLI group queries to mis-report the rule’s group.
Delete the entry from GROUP_RULES
(and adjust subsequent index arithmetic) or move it to the Style
group constant.
Also applies to: 4321-4325, 4461-4466
🤖 Prompt for AI Agents
In crates/biome_configuration/src/analyzer/linter/rules.rs around lines
1106-1107 and also at lines 4321-4325 and 4461-4466, the rule
UseNamingConvention is mapped to RuleGroup::Style but still listed under
Nursery::GROUP_RULES and related index tables. To fix this, remove
UseNamingConvention from the Nursery::GROUP_RULES array and adjust any index
calculations accordingly, or alternatively move it to the Style group constant
to maintain consistency between the mapping and group listings.
pub mod no_biome_first_exception; | ||
pub mod no_quickfix_biome; | ||
declare_lint_group! { pub Nursery { name : "nursery" , rules : [self :: no_quickfix_biome :: NoQuickfixBiome ,] } } | ||
pub mod use_biome_ignore_folder; | ||
declare_lint_group! { pub Nursery { name : "nursery" , rules : [self :: no_biome_first_exception :: NoBiomeFirstException , self :: no_quickfix_biome :: NoQuickfixBiome , self :: use_biome_ignore_folder :: UseBiomeIgnoreFolder ,] } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Broken mod
path
pub mod no_biome_first_exception;
won’t resolve while the file is named no_biome_first_expection.rs
. Align them.
🤖 Prompt for AI Agents
In crates/biome_json_analyze/src/lint/nursery.rs around lines 6 to 9, the module
declaration `pub mod no_biome_first_exception;` does not match the filename
`no_biome_first_expection.rs`. Rename the file to `no_biome_first_exception.rs`
to align with the module path or update the module declaration to match the
existing filename, ensuring the module path resolves correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we disable suggestions for these auto-generated files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a setting to ignore certain files
crates/biome_json_analyze/src/lint/nursery/no_biome_first_exception.rs
Outdated
Show resolved
Hide resolved
CodSpeed Performance ReportMerging #7159 will not alter performanceComparing Summary
|
…ption.rs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that it makes sense for these to be rules, because they can end up disabled by the user.
For things about biome that are wrong, we usually just emit diagnostics, right? Though if we did that, we'd lose the code actions.
Yeah my thoughts exactly. However there's nothing wrong with Biome, it's just misconfiguration caused by the user. A diagnostic during the deserialization could catch possible extended configurations, but we won't have the code actions. Another alternative, make these rules as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (2)
7989-7990
: Optionless rules use= null
; avoid{}
for consistency and schema compatibilityNeighbouring rules (e.g. UseAnchorHrefOptions) use
= null
. Using{}
alters the schema surface and can trip consumers.Regenerate from sources to emit
null
:-export interface UseBiomeIgnoreFolderOptions {} +export type UseBiomeIgnoreFolderOptions = null;Note: don’t hand-edit this file; fix the Rust options type so codegen produces
null
.
7914-7914
: Replace empty interface with anull
type for optionless rulesThe nearby
UseAnchorHrefOptions
is declared asexport type UseAnchorHrefOptions = null;
, so we should mirror that pattern here to keep the JSON schema stable.• packages/@biomejs/backend-jsonrpc/src/workspace.ts:7914
-export interface NoBiomeFirstExceptionOptions {} +export type NoBiomeFirstExceptionOptions = null;Please update the codegen/source schema to emit
= null
for optionless rules.
🧹 Nitpick comments (1)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
1558-1561
: Add rule entry: noBiomeFirstException — LGTMWiring and docs look good. Please ensure the rule only runs for Biome config files to avoid noise elsewhere (it sounds like you already do).
Given the discussion: if enforceability is key, consider making this a Syntax/Configuration diagnostic while still exposing a code action when diagnostics are pulled for config files. Happy to sketch that path if useful.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
crates/biome_configuration/src/analyzer/linter/rules.rs
(19 hunks)packages/@biomejs/backend-jsonrpc/src/workspace.ts
(11 hunks)packages/@biomejs/biome/configuration_schema.json
(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/biome_configuration/src/analyzer/linter/rules.rs
- packages/@biomejs/biome/configuration_schema.json
🧰 Additional context used
🧠 Learnings (33)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: You are encouraged to split the work for a new rule into multiple PRs and describe your plan in an issue if unfamiliar with Biome's APIs.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a lint rule is ported from another ecosystem (e.g., ESLint), add a `sources` metadata field in `declare_lint_rule!` referencing the original rule.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : New rules must be placed inside the `nursery` group for incubation before promotion.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a rule provides a code action, add the `fix_kind` metadata to the `declare_lint_rule!` macro and implement the `action` function.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Rule documentation must start with a single-line summary, followed by detailed paragraphs, and include `## Examples` with `### Invalid` and `### Valid` sections.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Set the `severity` field in `declare_lint_rule!` to `Severity::Warning` or `Severity::Error` as appropriate for the rule.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When deprecating a rule, specify the reason using the `deprecated:` field in the `declare_lint_rule!` macro.
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to crates/biome_lint_rules/**/*.rs : Linter rules must have a `version` metadata field in their implementation, set to "next" for new rules and updated to the new version when releasing.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Rule options must be documented in the `## Options` section of the rule's documentation, with each option having its own header and example.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `version` field in `declare_lint_rule!` must be set to `next` for new rules.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `declare_lint_rule!` macro must be used to declare an analyzer rule type and implement the RuleMeta trait.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Assign the `domains` field in `declare_lint_rule!` if the rule belongs to a specific domain (e.g., testing, framework).
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a lint rule is ported from another ecosystem (e.g., ESLint), add a `sources` metadata field in `declare_lint_rule!` referencing the original rule.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : New rules must be placed inside the `nursery` group for incubation before promotion.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a rule provides a code action, add the `fix_kind` metadata to the `declare_lint_rule!` macro and implement the `action` function.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `version` field in `declare_lint_rule!` must be set to `next` for new rules.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Rule documentation must start with a single-line summary, followed by detailed paragraphs, and include `## Examples` with `### Invalid` and `### Valid` sections.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When deprecating a rule, specify the reason using the `deprecated:` field in the `declare_lint_rule!` macro.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Rule options must be documented in the `## Options` section of the rule's documentation, with each option having its own header and example.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Assign the `domains` field in `declare_lint_rule!` if the rule belongs to a specific domain (e.g., testing, framework).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Set the `severity` field in `declare_lint_rule!` to `Severity::Warning` or `Severity::Error` as appropriate for the rule.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/{use*,no*}_*{vue,react,angular,svelte}*.rs : If a rule overwhelmingly applies to a specific framework, it should be named using the `use<Framework>...` or `no<Framework>...` pattern (e.g., `noVueReservedProps`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_empty*_*.rs : Rules that report empty code constructs should use the `noEmpty<Concept>` naming convention (e.g., `noEmptyBlockStatements`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_useless*_*.rs : Rules that report unnecessary code should use the `noUseless<Concept>` naming convention (e.g., `noUselessConstructor`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Rule options must be placed inside the `biome_rule_options` crate, with a file named after the rule (e.g., `use_this_convention.rs`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
PR: biomejs/biome#7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/use_consistent*_*.rs : Rules that ensure consistency should use the `useConsistent<Concept>` naming convention (e.g., `useConsistentArrayType`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unused*_*.rs : Rules that report unused entities should use the `noUnused<Concept>` naming convention (e.g., `noUnusedVariables`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/{no_invalid*,use_valid*}_*.rs : Rules that report invalid code should use the `noInvalid<Concept>` or `useValid<Concept>` naming conventions (e.g., `noInvalidConstructorSuper`, `useValidTypeof`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no*_*.rs : Rules that forbid a single concept should be named using the `no<Concept>` prefix (e.g., `noDebugger` for disallowing `debugger` statements).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unsafe*_*.rs : Rules that report unsafe code should use the `noUnsafe<Concept>` naming convention (e.g., `noUnsafeOptionalChaining`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_restricted*_*.rs : Rules that report restricted entities should use the `noRestricted<Concept>` naming convention (e.g., `noRestrictedGlobals`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/use*_*.rs : Rules that mandate a single concept should be named using the `use<Concept>` prefix (e.g., `useValidLang` for mandating valid HTML `lang` attribute values).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/use_shorthand*_*.rs : Rules that promote shorthand syntax should use the `useShorthand<Concept>` naming convention (e.g., `useShorthandAssign`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_redundant*_*.rs : Rules that report redundant code should use the `noRedundant<Concept>` naming convention (e.g., `noRedundantUseStrict`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_unknown*_*.rs : Rules that report unknown entities (e.g., CSS units) should use the `noUnknown<Concept>` naming convention (e.g., `noUnknownUnit`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Rule option structs must derive `Deserializable`, `Serialize`, `Deserialize`, and (optionally) `JsonSchema` for configuration and schema support.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Document and test the effect of rule options as part of the rule's documentation and test suite.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/specs/html/**/options.json : If you require non-default formatting options for tests, create an `options.json` file in the same folder as the `.html` files. These options will apply to all files in that folder.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid deep indentation by using combinators like `map`, `filter`, and `and_then` instead of nested `if let` or `match` statements.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_misleading*_*.rs : Rules that report misleading code should use the `noMisleading<Concept>` naming convention (e.g., `noMisleadingCharacterClass`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When banning certain functions or variables, always check if the variable is global using the semantic model to avoid false positives.
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/no_undeclared*_*.rs : Rules that report undeclared entities should use the `noUndeclared<Concept>` naming convention (e.g., `noUndeclaredVariables`).
Applied to files:
packages/@biomejs/backend-jsonrpc/src/workspace.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (26)
- GitHub Check: Test Node.js API
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_html_formatter)
- GitHub Check: Bench (biome_html_parser)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Check JS Files
- GitHub Check: autofix
🔇 Additional comments (6)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (6)
1710-1713
: Add rule entry: useBiomeIgnoreFolder — LGTMNicely documented and placed in Nursery.
2906-2909
: Type union for NoBiomeFirstException fix config — LGTMMatches existing pattern for fix-capable rules.
3017-3020
: Type union for UseBiomeIgnoreFolder fix config — LGTMConsistent with neighbouring declarations.
5114-5127
: RuleWithFixOptions_for_NoBiomeFirstExceptionOptions — LGTMShape aligns with other fixable rules (fix, level, options).
5532-5545
: RuleWithFixOptions_for_UseBiomeIgnoreFolderOptions — LGTMConsistent with the codegen conventions.
8642-8642
: Categories wired for new rules — LGTMThe Category union includes both new entries; good for LSP surfacing.
Also applies to: 8698-8698
Yeah, let's keep them as rules. I think having the code actions is more valuable than the alternatives. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc (1)
1-10
: Add coverage for trailing slash without glob (e.g. "!dist/").If the rule also disallows a bare trailing slash, add a sibling invalid fixture to lock this down.
Proposed new test file contents:
// crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid_trailing_slash.biome.jsonc // should generate diagnostics { "files": { "includes": [ "**", "!dist/", "!**/dist/" ] } }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (5)
crates/biome_json_analyze/tests/specs/suspicious/noBiomeFirstException/invalid.biome.jsonc.snap
is excluded by!**/*.snap
crates/biome_json_analyze/tests/specs/suspicious/noBiomeFirstException/valid.biome.jsonc.snap
is excluded by!**/*.snap
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc.snap
is excluded by!**/*.snap
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc.snap
is excluded by!**/*.snap
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid_overrides.biome.jsonc.snap
is excluded by!**/*.snap
📒 Files selected for processing (5)
crates/biome_json_analyze/tests/specs/suspicious/noBiomeFirstException/invalid.biome.jsonc
(1 hunks)crates/biome_json_analyze/tests/specs/suspicious/noBiomeFirstException/valid.biome.jsonc
(1 hunks)crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
(1 hunks)crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc
(1 hunks)crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid_overrides.biome.jsonc
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- crates/biome_json_analyze/tests/specs/suspicious/noBiomeFirstException/invalid.biome.jsonc
- crates/biome_json_analyze/tests/specs/suspicious/noBiomeFirstException/valid.biome.jsonc
- crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid_overrides.biome.jsonc
🧰 Additional context used
📓 Path-based instructions (1)
crates/biome_*/**/*
📄 CodeRabbit Inference Engine (CLAUDE.md)
Core crates must be located in
/crates/biome_*/
Files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use meaningful, cross-language-capable rule names when appropriate; use language/framework-specific names when constrained
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Set version: "next" in declare_lint_rule! for new or changing rules
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use precise naming conventions for rules: no<Concept> to forbid, use<Concept> to mandate; and established patterns like noDuplicate<>, noUnused<>, useConsistent<>
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : New analyzer rules must be placed in the nursery group
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Assign domains to rules when applicable (e.g., testing, frameworks) via domains field
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Deprecate rules by adding deprecated: reason in declare_lint_rule!
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : If a rule provides code actions, add fix_kind to declare_lint_rule! and pass category and applicability in action()
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Use the declare_lint_rule! macro to declare each rule
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : When porting a lint rule, specify sources in declare_lint_rule! (e.g., RuleSource::Eslint(...).same() or .inspired())
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Set rule severity appropriately; default is info, explicitly set Severity when needed
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/specs/**/*.jsonc : .jsonc snapshot test files must contain an array of strings (snippets) and are interpreted as script
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/specs/** : Place JS rule snapshot tests under tests/specs/<group>/<ruleName>/ with files prefixed by invalid* and valid*
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Quick test lives in biome_js_analyze/tests/quick_test.rs; unignore it and set RuleFilter appropriately when using
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
📚 Learning: 2025-08-11T11:48:27.756Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.756Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/specs/html/**/options.json : When non-default formatting options are needed for a test group, place an options.json (biome.json format) alongside the .html files in that folder
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
📚 Learning: 2025-08-11T11:48:27.756Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.756Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/specs/html/**/*.html : Place HTML test fixtures under tests/specs/html and subfolders, using .html files
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc
📚 Learning: 2025-08-11T11:48:27.756Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.756Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_tests.rs : Create tests/spec_tests.rs in the biome_html_formatter crate that generates tests via tests_macros::gen_tests! for all HTML files at tests/specs/html/**/*.html
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
PR: biomejs/biome#7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
📚 Learning: 2025-08-11T11:48:27.756Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.756Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
📚 Learning: 2025-08-11T11:43:46.589Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:43:46.589Z
Learning: Applies to crates/biome_analyze/**/src/lint/nursery/**/*.rs : Code blocks in docs must specify language; invalid examples must use expect_diagnostic; snippets must emit exactly one diagnostic
Applied to files:
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc
🔇 Additional comments (3)
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/valid.biome.jsonc (2)
5-8
: LGTM: correct folder-ignore patterns without trailing globs.This uses "!dist" and "!/dist" (no "/"), which aligns with the intended rule and should avoid unnecessary file crawling. Covers both root and nested dist folders.
5-8
: Question: do we need both "!dist" and "!/dist"?**Depending on the matcher semantics of "/dist" (zero-or-more segments), "!/dist" alone may already match the root "dist". If so, "!dist" is redundant. Worth verifying to keep guidance crisp.
crates/biome_json_analyze/tests/specs/suspicious/useBiomeIgnoreFolder/invalid.biome.jsonc (1)
6-8
: Good invalid cases: trailing "/" should be flagged.**These patterns are exactly what the rule aims to catch and should yield diagnostics. Nice contrast with the valid fixture.
…7159) Co-authored-by: dyc3 <1808807+dyc3@users.noreply.github.com> Co-authored-by: siketyan <12772118+siketyan@users.noreply.github.com>
Summary
This PR adds new rules exclusive to Biome. Please review the changesets to understand their purpose.
I want to make these lint rules stable for v2.2, hence breaking our non-written rule regarding the stabilisation of lint rules.
useBiomeIgnoreFolder
is very important for the upcoming v2.2, because it will speed up some projects where the crawling affected the performance.As for
noBiomeFirstException
, there have been many cases where users incorrectly used the patterns. I thought a rule could catch these cases early.Please let me know what you think @biomejs/core-contributors and @biomejs/maintainers
Test Plan
Added new tests
Docs
Added in this PR