Skip to content

fix(lint): fix false positive in noMisleadingReturnType for getter with matching setter#10037

Merged
ematipico merged 5 commits into
biomejs:mainfrom
minseong0324:fix/no-misleading-return-type-getter-with-matching-setter
Apr 20, 2026
Merged

fix(lint): fix false positive in noMisleadingReturnType for getter with matching setter#10037
ematipico merged 5 commits into
biomejs:mainfrom
minseong0324:fix/no-misleading-return-type-getter-with-matching-setter

Conversation

@minseong0324

Copy link
Copy Markdown
Contributor

I used Claude Code to assist with this implementation.

Summary

Addresses items from #9810: Getter with matching setter

Test Plan

Snapshot tests.

@changeset-bot

changeset-bot Bot commented Apr 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d097cf0

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-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Apr 18, 2026
@minseong0324 minseong0324 force-pushed the fix/no-misleading-return-type-getter-with-matching-setter branch 3 times, most recently from cb1c525 to e84f6c5 Compare April 18, 2026 20:05
@codspeed-hq

codspeed-hq Bot commented Apr 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 196 skipped benchmarks1


Comparing minseong0324:fix/no-misleading-return-type-getter-with-matching-setter (d097cf0) with main (bd1e74f)

Open in CodSpeed

Footnotes

  1. 196 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.

@minseong0324 minseong0324 marked this pull request as ready for review April 18, 2026 20:28
@minseong0324 minseong0324 force-pushed the fix/no-misleading-return-type-getter-with-matching-setter branch from e84f6c5 to a80b7f2 Compare April 18, 2026 20:31
@coderabbitai

coderabbitai Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The noMisleadingReturnType lint rule was updated to skip reporting on a getter when a same-named setter exists in the same parent namespace and both share the static/non-static status. Getter name extraction now uses the name() token. New helper logic and union types were added to detect static accessors, canonicalise member names, and locate matching setters. Tests were added for instance, object-literal and static getter/setter pairs demonstrating the behaviour.

Possibly related PRs

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main fix: addressing a false positive in the noMisleadingReturnType rule when a getter has a matching setter.
Description check ✅ Passed The description is related to the changeset, referencing the GitHub issue and explaining that the PR fixes a false positive for getters with matching setters.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts (1)

157-160: Add one negative test for static mismatch.

These valid cases cover matching instance/object/static pairs, but a regression that ignores static would still pass. Please add an invalid snapshot for get status with static set status — and/or the inverse — to lock the namespace check down. As per coding guidelines, “bug fixes require tests that reproduce and validate the fix.”

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts`
around lines 157 - 160, Add a negative test that reproduces a static vs instance
namespace mismatch by creating a class (or snippet) where a getter is non-static
(e.g., "get status" on an instance) but the setter is static (e.g., "static set
status") or vice versa; ensure the test file uses the same naming as existing
tests (e.g., "get status" and "static set status", referencing class names like
StaticStore or a similar class) and add an invalid snapshot asserting the
analyzer flags the namespace mismatch so regressions that ignore the static
modifier will fail.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/brave-dolphins-sing.md:
- Line 5: Update the changeset text so the referenced rule name
noMisleadingReturnType is a Markdown link to its documentation (replace the
plain rule name with a link to the rule docs page for noMisleadingReturnType),
ensuring the wording stays the same but the rule is clickable for readers.

In `@crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs`:
- Around line 353-357: The current comparison uses
JsLiteralMemberName::token_text_trimmed() which compares raw source spelling;
change it to compare the semantic property name by calling
JsLiteralMemberName::name() and comparing that normalized name to getter_name.
In the closure inside
child.children().find_map(JsLiteralMemberName::cast).and_then(|n|
n.value().ok()).is_some_and(...), replace the token_text_trimmed() ==
*getter_name check with a comparison using n.name() (or n.name().map(|nm|
nm.as_str() / nm.text() as appropriate) == Some(getter_name) or equivalent) so
quoted and unquoted property names match semantically.

---

Nitpick comments:
In `@crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts`:
- Around line 157-160: Add a negative test that reproduces a static vs instance
namespace mismatch by creating a class (or snippet) where a getter is non-static
(e.g., "get status" on an instance) but the setter is static (e.g., "static set
status") or vice versa; ensure the test file uses the same naming as existing
tests (e.g., "get status" and "static set status", referencing class names like
StaticStore or a similar class) and add an invalid snapshot asserting the
analyzer flags the namespace mismatch so regressions that ignore the static
modifier will fail.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 73fb5112-581d-4391-aede-3f2133126b53

📥 Commits

Reviewing files that changed from the base of the PR and between bd1e74f and e84f6c5.

⛔ Files ignored due to path filters (1)
  • crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/brave-dolphins-sing.md
  • crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs
  • crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts

Comment thread .changeset/brave-dolphins-sing.md Outdated
Comment thread crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs Outdated
@minseong0324 minseong0324 force-pushed the fix/no-misleading-return-type-getter-with-matching-setter branch from a80b7f2 to ea79713 Compare April 18, 2026 21:03
@minseong0324 minseong0324 force-pushed the fix/no-misleading-return-type-getter-with-matching-setter branch from ea79713 to 80a42e4 Compare April 18, 2026 21:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs (3)

117-134: LGTM — nice, surgical fix for the false positive.

Early‑return before computing func_type keeps the common case cheap, and doing the same thing for both class and object getters is consistent. One tiny follow‑up to consider: the two getter arms are now near‑identical; factoring the shared body into a small helper taking getter.syntax(), name, annotation.range() and getter.body() would remove the duplication. Totally optional.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs` around
lines 117 - 134, The two nearly identical match arms for
AnyFunctionLikeWithReturnType::JsGetterClassMember and ::JsGetterObjectMember
should delegate to a small helper (e.g., handle_getter_member) to remove
duplication: extract the common logic that takes the getter.syntax(), the
computed name (literal_member_name_text result), annotation.range(), and
getter.body().ok()? and returns the same Option by performing the early
has_matching_setter check, computing func_type via ctx.type_of_member, and
calling run_for_member; then replace each arm's body with a call to this helper,
preserving the existing Option/Result propagation and short-circuit behavior.

312-314: Switching to name.name() — please double‑check call sites.

Good call aligning with the previous review feedback so quoted/unquoted names compare equal. Just worth confirming nothing else in this file relied on the old value()-based spelling (e.g. is_class_method_overload_implementation at lines 316‑338 still uses value().token_text_trimmed() on both sides, so it stays internally consistent — but a mixed‑quoting overload set would now behave differently from the getter path). If that asymmetry is intentional, all good; otherwise consider routing that helper through literal_member_name_text too for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs` around
lines 312 - 314, You changed literal_member_name_text to use name.name().ok(),
so audit all call sites (e.g., is_class_method_overload_implementation which
still uses value().token_text_trimmed()) and decide whether those comparisons
should be quote-normalized too; if so, replace uses of
value().token_text_trimmed() with calls to literal_member_name_text (or route
that helper through literal_member_name_text) so both getter and overload paths
compare the same token text; if the asymmetry is intentional, add a clarifying
comment in is_class_method_overload_implementation explaining why it must use
value().token_text_trimmed() instead of literal_member_name_text.

343-369: Consider using typed accessor methods instead of manual tree walking for static detection.

The modifier list kinds are actually correct—both JsGetterClassMember and JsSetterClassMember expose their modifiers via a modifiers() accessor that returns JsMethodModifierList, so is_static_accessor will work as intended. However, the current implementation walks the syntax tree manually to find JS_METHOD_MODIFIER_LIST, when the typed accessors already exist. Using JsGetterClassMember::modifiers() and JsSetterClassMember::modifiers() directly would be more idiomatic and safer against future grammar changes—something like:

fn is_static_accessor(node: &JsSyntaxNode) -> bool {
    JsGetterClassMember::cast(node.clone())
        .map(|getter| getter.modifiers())
        .or_else(|_| JsSetterClassMember::cast(node.clone())
            .map(|setter| setter.modifiers()))
        .is_some_and(|modifiers| {
            modifiers.iter().any(|m| m.kind() == JsSyntaxKind::JS_STATIC_MODIFIER)
        })
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs` around
lines 343 - 369, Replace the manual syntax-tree walk in is_static_accessor with
the typed accessors on getter/setter nodes: attempt to cast the node to
JsGetterClassMember or JsSetterClassMember, call their modifiers()
(JsMethodModifierList) and then check modifiers().iter().any(|m| m.kind() ==
JsSyntaxKind::JS_STATIC_MODIFIER); update is_static_accessor to use these casts
and modifier iteration instead of find/find_map so it relies on the typed API.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs`:
- Around line 117-134: The two nearly identical match arms for
AnyFunctionLikeWithReturnType::JsGetterClassMember and ::JsGetterObjectMember
should delegate to a small helper (e.g., handle_getter_member) to remove
duplication: extract the common logic that takes the getter.syntax(), the
computed name (literal_member_name_text result), annotation.range(), and
getter.body().ok()? and returns the same Option by performing the early
has_matching_setter check, computing func_type via ctx.type_of_member, and
calling run_for_member; then replace each arm's body with a call to this helper,
preserving the existing Option/Result propagation and short-circuit behavior.
- Around line 312-314: You changed literal_member_name_text to use
name.name().ok(), so audit all call sites (e.g.,
is_class_method_overload_implementation which still uses
value().token_text_trimmed()) and decide whether those comparisons should be
quote-normalized too; if so, replace uses of value().token_text_trimmed() with
calls to literal_member_name_text (or route that helper through
literal_member_name_text) so both getter and overload paths compare the same
token text; if the asymmetry is intentional, add a clarifying comment in
is_class_method_overload_implementation explaining why it must use
value().token_text_trimmed() instead of literal_member_name_text.
- Around line 343-369: Replace the manual syntax-tree walk in is_static_accessor
with the typed accessors on getter/setter nodes: attempt to cast the node to
JsGetterClassMember or JsSetterClassMember, call their modifiers()
(JsMethodModifierList) and then check modifiers().iter().any(|m| m.kind() ==
JsSyntaxKind::JS_STATIC_MODIFIER); update is_static_accessor to use these casts
and modifier iteration instead of find/find_map so it relies on the typed API.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 896cd66b-644c-4414-89fb-064aa932a085

📥 Commits

Reviewing files that changed from the base of the PR and between a80b7f2 and ea79713.

⛔ Files ignored due to path filters (1)
  • crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • .changeset/brave-dolphins-sing.md
  • crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs
  • crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts
✅ Files skipped from review due to trivial changes (1)
  • .changeset/brave-dolphins-sing.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts

Comment on lines +348 to +358
member_list.children().any(|child| {
matches!(
child.kind(),
JsSyntaxKind::JS_SETTER_CLASS_MEMBER | JsSyntaxKind::JS_SETTER_OBJECT_MEMBER
) && is_static_accessor(&child) == getter_is_static
&& child
.children()
.find_map(JsLiteralMemberName::cast)
.and_then(|name_node| name_node.name().ok())
.is_some_and(|setter_name| setter_name == *getter_name)
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Compose all with filter_map, and eventually return a typed node from filter_map

@minseong0324 minseong0324 Apr 19, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a sibling_setters() helper that does filter_map(AnyJsSetter::cast), and the any closure in has_matching_setter now operates on a typed AnyJsSetter. 679390d

/// Returns true if the getter has a same-named sibling setter in the same
/// namespace. TypeScript widens the getter's type to match the setter's
/// parameter type, so the wider annotation is not misleading.
fn has_matching_setter(getter_syntax: &JsSyntaxNode, getter_name: &TokenText) -> bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do not pass a generic node, always pass a typed node.

In fact the docs are even incorrect, they talk about a getter, but the node passed is generic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

has_matching_setter is now a method on AnyJsGetter, so the parameter is typed and the doc is accurate. 679390d

Comment on lines +363 to +368
node.children()
.find(|child| child.kind() == JsSyntaxKind::JS_METHOD_MODIFIER_LIST)
.is_some_and(|list| {
list.children()
.any(|modifier| modifier.kind() == JsSyntaxKind::JS_STATIC_MODIFIER)
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's good to navigate the children, but if you use find, use find_map instead and return a typed node.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Didn't go with find_map - dropped the children walk instead. AnyJsGetter::is_static() / AnyJsSetter::is_static() call .modifiers() on the class member variant, which already returns a typed JsMethodModifierList. Let me know if you'd rather keep the children walk with find_map. d2827c3

@minseong0324 minseong0324 force-pushed the fix/no-misleading-return-type-getter-with-matching-setter branch 13 times, most recently from 977cf83 to 16d4177 Compare April 19, 2026 14:48
@minseong0324 minseong0324 force-pushed the fix/no-misleading-return-type-getter-with-matching-setter branch from 16d4177 to d2827c3 Compare April 19, 2026 15:37
@minseong0324 minseong0324 requested a review from ematipico April 19, 2026 16:16

@ematipico ematipico left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice methods and utilities. I would move them in the syntax crate

Comment on lines +75 to +77
declare_node_union! {
pub AnyJsGetter = JsGetterClassMember | JsGetterObjectMember
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This unions seems to be really useful, maybe we should add it to the syntax crate instead (with all the methods).

https://github.com/biomejs/biome/tree/main/crates/biome_js_syntax/src

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ematipico Moved to accessor_ext.rs in d097cf0. Only thing I touched is has_matching_setter's doc - the TS-widening line is rule-specific, so it's gone.

@github-actions github-actions Bot added the A-Parser Area: parser label Apr 20, 2026
@minseong0324 minseong0324 force-pushed the fix/no-misleading-return-type-getter-with-matching-setter branch 2 times, most recently from 2883063 to 08715af Compare April 20, 2026 11:42
@minseong0324 minseong0324 force-pushed the fix/no-misleading-return-type-getter-with-matching-setter branch from 08715af to d097cf0 Compare April 20, 2026 11:47
@minseong0324 minseong0324 requested a review from ematipico April 20, 2026 11:51
@ematipico ematipico merged commit f785e8c into biomejs:main Apr 20, 2026
31 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 20, 2026
OIRNOIR pushed a commit to OIRNOIR/YouTube-Helper-Server that referenced this pull request Apr 24, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [@biomejs/biome](https://biomejs.dev) ([source](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome)) | patch | `2.4.12` → `2.4.13` |

---

### Release Notes

<details>
<summary>biomejs/biome (@&#8203;biomejs/biome)</summary>

### [`v2.4.13`](https://github.com/biomejs/biome/blob/HEAD/packages/@&#8203;biomejs/biome/CHANGELOG.md#2413)

[Compare Source](https://github.com/biomejs/biome/compare/@biomejs/biome@2.4.12...@biomejs/biome@2.4.13)

##### Patch Changes

- [#&#8203;9969](biomejs/biome#9969) [`c5eb92b`](biomejs/biome@c5eb92b) Thanks [@&#8203;officialasishkumar](https://github.com/officialasishkumar)! - Added the nursery rule [`noUnnecessaryTemplateExpression`](https://biomejs.dev/linter/rules/no-unnecessary-template-expression/), which disallows template literals that only contain string literal expressions. These can be replaced with a simpler string literal.

  For example, the following code triggers the rule:

  ```js
  const a = `${"hello"}`; // can be 'hello'
  const b = `${"prefix"}_suffix`; // can be 'prefix_suffix'
  const c = `${"a"}${"b"}`; // can be 'ab'
  ```

- [#&#8203;10037](biomejs/biome#10037) [`f785e8c`](biomejs/biome@f785e8c) Thanks [@&#8203;minseong0324](https://github.com/minseong0324)! - Fixed [#&#8203;9810](biomejs/biome#9810): [`noMisleadingReturnType`](https://biomejs.dev/linter/rules/no-misleading-return-type/) no longer reports false positives on a getter with a matching setter in the same namespace.

  ```ts
  class Store {
    get status(): string {
      if (Math.random() > 0.5) return "loading";
      return "idle";
    }
    set status(v: string) {}
  }
  ```

- [#&#8203;10084](biomejs/biome#10084) [`5e2f90c`](biomejs/biome@5e2f90c) Thanks [@&#8203;jiwon79](https://github.com/jiwon79)! - Fixed [#&#8203;10034](biomejs/biome#10034): [`noUselessEscapeInRegex`](https://biomejs.dev/linter/rules/no-useless-escape-in-regex/) no longer flags escapes of `ClassSetReservedPunctuator` characters (`&`, `!`, `#`, `%`, `,`, `:`, `;`, `<`, `=`, `>`, `@`, `` ` ``, `~`) inside `v`-flag character classes as useless. These characters are reserved as individual code points in `v`-mode, so the escape is required.

  The following pattern is now considered valid:

  ```js
  /[a-z\&]/v;
  ```

- [#&#8203;10063](biomejs/biome#10063) [`c9ffa16`](biomejs/biome@c9ffa16) Thanks [@&#8203;Netail](https://github.com/Netail)! - Added extra rule sources from ESLint CSS. `biome migrate eslint` should do a bit better detecting rules in your eslint configurations.

- [#&#8203;10035](biomejs/biome#10035) [`946b50e`](biomejs/biome@946b50e) Thanks [@&#8203;Netail](https://github.com/Netail)! - Fixed [#&#8203;10032](biomejs/biome#10032): [useIframeSandbox](https://biomejs.dev/linter/rules/use-iframe-sandbox/) now flags if there's no initializer value.

- [#&#8203;9865](biomejs/biome#9865) [`68fb8d4`](biomejs/biome@68fb8d4) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Added the new nursery rule [`useDomNodeTextContent`](https://biomejs.dev/linter/rules/use-dom-node-text-content/), which prefers `textContent` over `innerText` for DOM node text access and destructuring.

  For example, the following snippet triggers the rule:

  ```js
  const foo = node.innerText;
  ```

- [#&#8203;10023](biomejs/biome#10023) [`bd1e74f`](biomejs/biome@bd1e74f) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Added a new nursery rule [`noReactNativeDeepImports`](https://biomejs.dev/linter/rules/no-react-native-deep-imports/) that disallows deep imports from the `react-native` package. Internal paths like `react-native/Libraries/...` are not part of the public API and may change between versions.

  For example, the following code triggers the rule:

  ```js
  import View from "react-native/Libraries/Components/View/View";
  ```

- [#&#8203;9885](biomejs/biome#9885) [`3dce737`](biomejs/biome@3dce737) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Added a new nursery rule [`useDomQuerySelector`](https://biomejs.dev/linter/rules/use-dom-query-selector/) that prefers `querySelector()` and `querySelectorAll()` over older DOM query methods such as `getElementById()` and `getElementsByClassName()`.

- [#&#8203;9995](biomejs/biome#9995) [`4da9caf`](biomejs/biome@4da9caf) Thanks [@&#8203;siketyan](https://github.com/siketyan)! - Fixed [#&#8203;9994](biomejs/biome#9994): Biome now parses nested CSS rules correctly when declarations follow them inside embedded snippets.

- [#&#8203;10009](biomejs/biome#10009) [`b41cc5a`](biomejs/biome@b41cc5a) Thanks [@&#8203;Jayllyz](https://github.com/Jayllyz)! - Fixed [#&#8203;10004](biomejs/biome#10004): [`noComponentHookFactories`](https://biomejs.dev/linter/rules/no-component-hook-factories/) no longer reports false positives for object methods and class methods.

- [#&#8203;9988](biomejs/biome#9988) [`eabf54a`](biomejs/biome@eabf54a) Thanks [@&#8203;Netail](https://github.com/Netail)! - Tweaked the diagnostics range for [useAltText](https://biomejs.dev/linter/rules/use-alt-text), [useButtonType](https://biomejs.dev/linter/rules/use-button-type), [useHtmlLang](https://biomejs.dev/linter/rules/use-html-lang), [useIframeTitle](https://biomejs.dev/linter/rules/use-iframe-title), [useValidAriaRole](https://biomejs.dev/linter/rules/use-valid-aria-role) & [useIfameSandbox](https://biomejs.dev/linter/rules/use-iframe-sandbox) to report on the opening tag instead of the full tag.

- [#&#8203;10043](biomejs/biome#10043) [`fc65902`](biomejs/biome@fc65902) Thanks [@&#8203;mujpao](https://github.com/mujpao)! - Fixed [#&#8203;10003](biomejs/biome#10003): Biome no longer panics when parsing Svelte files containing `{#}`.

- [#&#8203;9815](biomejs/biome#9815) [`5cc83b1`](biomejs/biome@5cc83b1) Thanks [@&#8203;dyc3](https://github.com/dyc3)! - Added the new nursery rule [`noLoopFunc`](https://biomejs.dev/linter/rules/no-loop-func/). When enabled, it warns when a function declared inside a loop captures outer variables that can change across iterations.

- [#&#8203;9702](biomejs/biome#9702) [`ef470ba`](biomejs/biome@ef470ba) Thanks [@&#8203;ryan-m-walker](https://github.com/ryan-m-walker)! - Added the nursery rule [`useRegexpTest`](https://biomejs.dev/linter/rules/use-regexp-test/) that enforces `RegExp.prototype.test()` over `String.prototype.match()` and `RegExp.prototype.exec()` in boolean contexts. `test()` returns a boolean directly, avoiding unnecessary computation of match results.

  **Invalid**

  ```js
  if ("hello world".match(/hello/)) {
  }
  ```

  **Valid**

  ```js
  if (/hello/.test("hello world")) {
  }
  ```

- [#&#8203;9743](biomejs/biome#9743) [`245307d`](biomejs/biome@245307d) Thanks [@&#8203;leetdavid](https://github.com/leetdavid)! - Fixed [#&#8203;2245](biomejs/biome#2245): Svelte `<script>` tag language detection when the `generics` attribute contains `>` characters (e.g., `<script lang="ts" generics="T extends Record<string, unknown>">`). Biome now correctly recognizes TypeScript in such script blocks.

- [#&#8203;10046](biomejs/biome#10046) [`0707de7`](biomejs/biome@0707de7) Thanks [@&#8203;Conaclos](https://github.com/Conaclos)! - Fixed [#&#8203;10038](biomejs/biome#10038): [`organizeImports`](https://biomejs.dev/assist/actions/organize-imports/) now sorts imports in TypeScript modules and declaration files.

  ```diff
    declare module "mymodule" {
  -  	import type { B } from "b";
    	import type { A } from "a";
  +  	import type { B } from "b";
    }
  ```

- [#&#8203;10012](biomejs/biome#10012) [`94ccca9`](biomejs/biome@94ccca9) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Added the nursery rule [`noReactNativeLiteralColors`](https://biomejs.dev/linter/rules/no-react-native-literal-colors/), which disallows color literals inside React Native styles.

  The rule belongs to the `reactNative` domain. It reports properties whose name contains `color` and whose value is a string literal when they appear inside a `StyleSheet.create(...)` call or inside a JSX attribute whose name contains `style`.

  ```jsx
  // Invalid
  const Hello = () => <Text style={{ backgroundColor: "#FFFFFF" }}>hi</Text>;

  const styles = StyleSheet.create({
    text: { color: "red" },
  });
  ```

  ```jsx
  // Valid
  const red = "#f00";
  const styles = StyleSheet.create({
    text: { color: red },
  });
  ```

- [#&#8203;10005](biomejs/biome#10005) [`131019e`](biomejs/biome@131019e) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Added the nursery rule [`noReactNativeRawText`](https://biomejs.dev/linter/rules/no-react-native-raw-text/), which disallows raw text outside of `<Text>` components in React Native.

  The rule belongs to the new `reactNative` domain.

  ```jsx
  // Invalid
  <View>some text</View>
  <View>{'some text'}</View>
  ```

  ```jsx
  // Valid
  <View>
    <Text>some text</Text>
  </View>
  ```

  Additional components can be allowlisted through the `skip` option:

  ```json
  {
    "options": {
      "skip": ["Title"]
    }
  }
  ```

- [#&#8203;9911](biomejs/biome#9911) [`1603f78`](biomejs/biome@1603f78) Thanks [@&#8203;Netail](https://github.com/Netail)! - Added the nursery rule [`noJsxLeakedDollar`](https://biomejs.dev/linter/rules/no-jsx-leaked-dollar), which flags text nodes with a trailing `$` if the next sibling node is a JSX expression. This could be an unintentional mistake, resulting in a '$' being rendered as text in the output.

  **Invalid**:

  ```jsx
  function MyComponent({ user }) {
    return <div>Hello ${user.name}</div>;
  }
  ```

- [#&#8203;9999](biomejs/biome#9999) [`f42405f`](biomejs/biome@f42405f) Thanks [@&#8203;minseong0324](https://github.com/minseong0324)! - Fixed `noMisleadingReturnType` incorrectly flagging functions with reassigned `let` variables.

- [#&#8203;10075](biomejs/biome#10075) [`295f97f`](biomejs/biome@295f97f) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Fixed [`#9983`](biomejs/biome#9983): Biome now parses functions declared inside Svelte `#snippet` blocks without throwing errors.

- [#&#8203;10006](biomejs/biome#10006) [`cf4c1c9`](biomejs/biome@cf4c1c9) Thanks [@&#8203;minseong0324](https://github.com/minseong0324)! - Fixed [#&#8203;9810](biomejs/biome#9810): `noMisleadingReturnType` incorrectly flagging nested object literals with widened properties.

- [#&#8203;10033](biomejs/biome#10033) [`11ddc05`](biomejs/biome@11ddc05) Thanks [@&#8203;ematipico](https://github.com/ematipico)! - Added the nursery rule [`useReactNativePlatformComponents`](https://biomejs.dev/linter/rules/use-react-native-platform-components/) that ensures platform-specific React Native components (e.g. `ProgressBarAndroid`, `ActivityIndicatorIOS`) are only imported in files with a matching platform suffix. It also reports when Android and iOS components are mixed in the same file.

  The following code triggers the rule when the file does not have an `.android.js` suffix:

  ```js
  // file.js
  import { ProgressBarAndroid } from "react-native";
  ```

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMzkuNiIsInVwZGF0ZWRJblZlciI6IjQzLjEzOS42IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Server/pulls/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter A-Parser Area: parser L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants