Skip to content

feat(useExplicitType): relax rule for trivially inferrable types#9795

Merged
dyc3 merged 19 commits into
mainfrom
arnold095/relax-useExplicitType
Apr 4, 2026
Merged

feat(useExplicitType): relax rule for trivially inferrable types#9795
dyc3 merged 19 commits into
mainfrom
arnold095/relax-useExplicitType

Conversation

@dyc3

@dyc3 dyc3 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Supersedes #8246

Test Plan

CI green

Docs

@changeset-bot

changeset-bot Bot commented Apr 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 14a7afd

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 4, 2026
@dyc3 dyc3 marked this pull request as ready for review April 4, 2026 19:08
@codspeed-hq

codspeed-hq Bot commented Apr 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 196 skipped benchmarks1


Comparing arnold095/relax-useExplicitType (14a7afd) with main (4af4a3a)

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.

@github-actions github-actions Bot added the A-Project Area: project label Apr 4, 2026
@coderabbitai

coderabbitai Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ae7d53ac-fb06-496f-86a7-92525b6fa8c1

📥 Commits

Reviewing files that changed from the base of the PR and between 4af4a3a and cd54369.

⛔ Files ignored due to path filters (3)
  • crates/biome_js_analyze/tests/specs/nursery/useExplicitType/invalid.ts.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/nursery/useExplicitType/invalidArguments.ts.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/nursery/useExplicitType/valid.ts.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (4)
  • .changeset/relax-use-explicit-type.md
  • crates/biome_js_analyze/src/lint/nursery/use_explicit_type.rs
  • crates/biome_js_analyze/tests/specs/nursery/useExplicitType/invalid.ts
  • crates/biome_js_analyze/tests/specs/nursery/useExplicitType/valid.ts

Walkthrough

This pull request relaxes the useExplicitType linter rule to allow omitting type annotations for variables and parameters when types are trivially inferrable. The rule now recognises binary expressions, comparisons, logical expressions, class instantiations, array literals, conditional expressions, and function calls as sources of sufficient type information. Type annotations on parameter default values are no longer required. Additionally, any type validation was removed from the rule, delegating that concern exclusively to the noExplicitAny rule. Implementation and test fixtures were updated accordingly.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately summarises the main change: relaxing the useExplicitType rule to allow trivially inferrable types.
Description check ✅ Passed The description relates to the changeset by referencing the PR it supersedes and mentioning CI validation, though it lacks detailed change explanation.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch arnold095/relax-useExplicitType

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

@dyc3 dyc3 merged commit 1d09f0f into main Apr 4, 2026
19 checks passed
@dyc3 dyc3 deleted the arnold095/relax-useExplicitType branch April 4, 2026 19:39
@github-actions github-actions Bot mentioned this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter A-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants