Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(test): add missing diagnostics header to allowImplicitInvalid.js
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
  • Loading branch information
Matt Van Horn and claude committed Mar 17, 2026
commit fa7c8642f71fa4acf39908253c63fa23d5da0fca
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// should generate diagnostics

// some paths return values, others fall through without any return

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.

Invalid files must have // should not generate diagnostics. You're using an AI agent, load the skills we provide.

This comment was marked as low quality.

@ematipico ematipico Mar 16, 2026

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.

Yeah sorry, between the two files I got confused, but it's easily understandable:

  • valid -> should not
  • invalid -> should

Every file should have the top-level comments

This comment was marked as low quality.

[1, 2, 3].map((x) => {
if (x > 2) return x;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
source: crates/biome_js_analyze/tests/spec_tests.rs
assertion_line: 154
expression: allowImplicitInvalid.js
---
# Input
```js
// should generate diagnostics

// some paths return values, others fall through without any return
[1, 2, 3].map((x) => {
if (x > 2) return x;
Expand All @@ -20,31 +21,31 @@ expression: allowImplicitInvalid.js

# Diagnostics
```
allowImplicitInvalid.js:2:11 lint/suspicious/useIterableCallbackReturn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
allowImplicitInvalid.js:4:11 lint/suspicious/useIterableCallbackReturn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× This callback passed to map() iterable method should always return a value.

1 │ // some paths return values, others fall through without any return
> 2 │ [1, 2, 3].map((x) => {
3 │ // some paths return values, others fall through without any return
> 4 │ [1, 2, 3].map((x) => {
│ ^^^
3 │ if (x > 2) return x;
4 │ // falls through - likely a bug
5 │ if (x > 2) return x;
6 │ // falls through - likely a bug

i Add missing return statements so that this callback returns a value on all execution paths.


```

```
allowImplicitInvalid.js:8:11 lint/suspicious/useIterableCallbackReturn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
allowImplicitInvalid.js:10:11 lint/suspicious/useIterableCallbackReturn ━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× This callback passed to map() iterable method should always return a value.

7 │ // no returns at all
> 8 │ [1, 2, 3].map((x) => {
9 │ // no returns at all
> 10 │ [1, 2, 3].map((x) => {
│ ^^^
9 │ console.log(x);
10 │ });
11 │ console.log(x);
12 │ });

i Add a return with a value to this callback.

Expand Down