feat(lint): support class methods, object methods, and getters in noMisleadingReturnType#9873
Conversation
🦋 Changeset detectedLatest commit: e91972f The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThis PR extends the Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rs (1)
101-101: Computed property names are silently skipped.Using
as_js_literal_member_name()means methods with computed names (e.g.,[Symbol.iterator]()or["getStatus"]()) won't be analysed. This is probably fine as a deliberate scope limitation, but worth documenting if not already covered.🤖 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` at line 101, The code silently skips methods with computed names because it calls method.name().ok()?.as_js_literal_member_name() when computing let name = ..., so either document this deliberate limitation or extend the logic to handle computed property names: update the lookup around method.name()/as_js_literal_member_name() to detect computed names (check method.name() variants), resolve their string/symbol form (or fallback to a synthetic representation) and use that for analysis, or add a clear comment/docstring near this code (referencing method.name(), as_js_literal_member_name(), and the let name assignment) stating that computed property names are intentionally excluded.
🤖 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`:
- Line 101: The code silently skips methods with computed names because it calls
method.name().ok()?.as_js_literal_member_name() when computing let name = ...,
so either document this deliberate limitation or extend the logic to handle
computed property names: update the lookup around
method.name()/as_js_literal_member_name() to detect computed names (check
method.name() variants), resolve their string/symbol form (or fallback to a
synthetic representation) and use that for analysis, or add a clear
comment/docstring near this code (referencing method.name(),
as_js_literal_member_name(), and the let name assignment) stating that computed
property names are intentionally excluded.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8632f519-16c6-4997-966d-5e494b2dd3cd
⛔ Files ignored due to path filters (2)
crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/invalid.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.ts.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (5)
crates/biome_js_analyze/src/lint/nursery/no_misleading_return_type.rscrates/biome_js_analyze/src/services/typed.rscrates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/invalid.tscrates/biome_js_analyze/tests/specs/nursery/noMisleadingReturnType/valid.tscrates/biome_js_type_info/src/type.rs
Merging this PR will not alter performance
Comparing Footnotes
|
dyc3
left a comment
There was a problem hiding this comment.
Needs a changeset, since the rule was released in the last patch
f2a0778 to
e91972f
Compare
Added in e91972f. |
I used Claude Code to assist with this implementation.
Summary
Addresses items from #9810: extends
noMisleadingReturnTypeto class methods, object methods, class getters, and object getters.Adds
type_of_membertoTypedServiceandfind_member_typetoTypefor member-level type lookup. Skips generators and class method overloads.Test Plan
Snapshot tests.