fix(useOptionalChain): correctly track prefix expression#9345
Conversation
🦋 Changeset detectedLatest commit: 627dc0d 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 |
WalkthroughThis PR enhances the Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/biome_js_analyze/tests/specs/complexity/useOptionalChain/invalidLogicalAndCases7.js (1)
27-28: Minor: Duplicate test case.Line 28 (
bar && foo && foo.length;) is identical to line 4. If the intent is purely documentation (referencing the original issue), consider adding it as a comment alongside line 4 rather than a separate test case that produces duplicate diagnostics.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_js_analyze/tests/specs/complexity/useOptionalChain/invalidLogicalAndCases7.js` around lines 27 - 28, The test file contains a duplicate test case "bar && foo && foo.length;" (same as the earlier instance) which creates redundant diagnostics; remove the second occurrence from crates/biome_js_analyze/tests/specs/complexity/useOptionalChain/invalidLogicalAndCases7.js or convert it to a comment referencing the original instance so it doesn't produce a duplicate test—locate the duplicate string "bar && foo && foo.length;" and either delete that line or prefix it with comment markers to keep it as documentation only.
🤖 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/tests/specs/complexity/useOptionalChain/invalidLogicalAndCases7.js`:
- Around line 27-28: The test file contains a duplicate test case "bar && foo &&
foo.length;" (same as the earlier instance) which creates redundant diagnostics;
remove the second occurrence from
crates/biome_js_analyze/tests/specs/complexity/useOptionalChain/invalidLogicalAndCases7.js
or convert it to a comment referencing the original instance so it doesn't
produce a duplicate test—locate the duplicate string "bar && foo && foo.length;"
and either delete that line or prefix it with comment markers to keep it as
documentation only.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 042ba863-3f52-422b-abab-da8bac24ac2b
⛔ Files ignored due to path filters (1)
crates/biome_js_analyze/tests/specs/complexity/useOptionalChain/invalidLogicalAndCases7.js.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (3)
.changeset/fix-use-optional-chain-prefix.mdcrates/biome_js_analyze/src/lint/complexity/use_optional_chain.rscrates/biome_js_analyze/tests/specs/complexity/useOptionalChain/invalidLogicalAndCases7.js
Merging this PR will not alter performance
Comparing Footnotes
|
|
hum... checking the preview build, this seems to have open a few new false positive... for example : or (this one , you need to make sure it's not undef to check for |
|
Open a new issue with a playground link Commenting on closed issues or PRs is rarely visible |
|
my bad, i've created it here #9428 |
Summary
Closes #7214
I used Claude Code to fix the issue. It's very simple!
Test Plan
Added various tests
Docs