Skip to content

feat(lint): add noUnsafeReturn - #12422

Merged
dyc3 merged 1 commit into
mainfrom
dyc3/port-typescript-eslint-no-unsafe-return-thr_6zjrd4v72k
Oct 22, 2026
Merged

dyc3 merged 1 commit into
mainfrom
dyc3/port-typescript-eslint-no-unsafe-return-thr_6zjrd4v72k

Conversation

@dyc3

@dyc3 dyc3 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

This adds noUnsafeReturn, which is a port of https://typescript-eslint.io/rules/no-unsafe-return

implemented by Opus 5.5

Test Plan

snapshots

Docs

@changeset-bot

changeset-bot Bot commented Oct 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 157e503

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-android-arm64 Patch
@biomejs/cli-android-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-win32-x64 Patch
@biomejs/runtime Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/wasm-web 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-CLI Area: CLI A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Diagnostic Area: diagnostocis A-Type-Inference Area: type inference labels Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: biomejs/biome/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 2417f79d-4cf7-4227-9dd0-9fc81bb13a46
📥 Commits

Reviewing files that changed from the base of the PR and between acdcea5 and 157e503.

⛔ Files ignored due to path filters: 10
  • crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs is excluded by !**/migrate/eslint_any_rule_to_biome.rs and included by **
  • crates/biome_configuration/src/analyzer/linter/rules.rs is excluded by !**/rules.rs and included by **
  • crates/biome_configuration/src/generated/domain_selector.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_configuration/src/generated/linter_options_check.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_diagnostics_categories/src/categories.rs is excluded by !**/categories.rs and included by **
  • crates/biome_js_analyze/tests/specs/nursery/noUnsafeReturn/invalid.ts.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/nursery/noUnsafeReturn/valid.ts.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/nursery/noUnsafeReturn/validDefaultExport.ts.snap is excluded by !**/*.snap and included by **
  • 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: 10
  • .changeset/add-no-unsafe-return-rule.md
  • crates/biome_js_analyze/src/lint/nursery/no_unsafe_return.rs
  • crates/biome_js_analyze/tests/specs/nursery/noUnsafeReturn/invalid.ts
  • crates/biome_js_analyze/tests/specs/nursery/noUnsafeReturn/valid.ts
  • crates/biome_js_analyze/tests/specs/nursery/noUnsafeReturn/validDefaultExport.ts
  • crates/biome_js_type_info/src/inferred_type.rs
  • crates/biome_js_type_info/src/inferred_type/any_type_kind.rs
  • crates/biome_js_type_info/src/lib.rs
  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/no_unsafe_return.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

The pull request adds the TypeScript nursery rule noUnsafeReturn. It reports unsafe any return values and unsafe any type arguments, with handling for declared and contextual return types, async functions, and generic types. New type-information helpers support these checks. The change also adds rule options, valid and invalid fixtures, and a Changesets patch entry.

Priority: ➖ Normal

Change: Feature

Merge Risk: 🔵 Low · up to 157e5

The rule is mergeable with awareness that unrelated generic types sharing a name may occasionally receive an incorrect lint diagnostic.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the addition of the noUnsafeReturn lint rule, which is the main change.
Description check Passed The description accurately relates the changeset to adding noUnsafeReturn as a port of the typescript-eslint rule and mentions the test plan.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@codspeed

codspeed Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 5.63%

⚠️ 7 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚡ 2 improved benchmarks
✅ 105 untouched benchmarks
⏩ 314 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ e2e_no_unresolved_imports 2.9 ms 2.7 ms +6.1%
⚡ js_formatter[router_17129688031671448157.ts] 16.4 ms 15.6 ms +5.16%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing dyc3/port-typescript-eslint-no-unsafe-return-thr_6zjrd4v72k (157e503) with main (4de5d3d)

Open in CodSpeed

Footnotes

  1. 314 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. ↩

@dyc3
dyc3 merged commit 0be8d10 into main Oct 22, 2026
37 checks passed
@dyc3
dyc3 deleted the dyc3/port-typescript-eslint-no-unsafe-return-thr_6zjrd4v72k branch October 22, 2026 13:37
@github-actions github-actions Bot mentioned this pull request Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Diagnostic Area: diagnostocis A-Linter Area: linter A-Project Area: project A-Type-Inference Area: type inference L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant