Skip to content

Commit 9e18238

Browse files
committed
fix inverted diagnostics
1 parent ab54ee3 commit 9e18238

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

crates/biome_js_analyze/src/lint/nursery/no_return_assign.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ impl Rule for NoReturnAssign {
8080
rule_category!(),
8181
state,
8282
match ctx.query() {
83-
AnyReturn::JsReturnStatement(_) =>
83+
AnyReturn::JsArrowFunctionExpression(_) =>
8484
markup! {
8585
<Emphasis>"Arrow function"</Emphasis>" should not return "<Emphasis>"assignment"</Emphasis>"."
8686
},
87-
AnyReturn::JsArrowFunctionExpression(_) =>
87+
AnyReturn::JsReturnStatement(_) =>
8888
markup! {
8989
<Emphasis>"Function"</Emphasis>" should not return "<Emphasis>"assignment"</Emphasis>"."
9090
},
9191
}
9292
)
9393
.note(markup! {
94-
"noReturnAssign: Return statements are often considered side-effect free.\nYou likely want to do a comparison `==`\nOtherwise move the assignment outside of the return statement"
94+
"Return statements are often considered side-effect free.\nYou likely want to do a comparison `==`\nOtherwise move the assignment outside of the return statement"
9595
}),
9696
)
9797
}

crates/biome_js_analyze/tests/specs/nursery/noReturnAssign/invalid.js.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function f(a, b) {
3434
```
3535
invalid.js:3:9 lint/nursery/noReturnAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
3636
37-
× Arrow function should not return assignment.
37+
× Function should not return assignment.
3838
3939
1 │ /* should generate diagnostics */
4040
2 │ function f(a) {
@@ -43,7 +43,7 @@ invalid.js:3:9 lint/nursery/noReturnAssign ━━━━━━━━━━━━
4343
4}
4444
5 │
4545
46-
i noReturnAssign: Return statements are often considered side-effect free.
46+
i Return statements are often considered side-effect free.
4747
You likely want to do a comparison `==`
4848
Otherwise move the assignment outside of the return statement
4949
@@ -53,15 +53,15 @@ invalid.js:3:9 lint/nursery/noReturnAssign ━━━━━━━━━━━━
5353
```
5454
invalid.js:7:10 lint/nursery/noReturnAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
5555
56-
× Arrow function should not return assignment.
56+
× Function should not return assignment.
5757
5858
6 │ function f(a) {
5959
> 7return (a = 1);
6060
^^^^^
6161
8}
6262
9 │
6363
64-
i noReturnAssign: Return statements are often considered side-effect free.
64+
i Return statements are often considered side-effect free.
6565
You likely want to do a comparison `==`
6666
Otherwise move the assignment outside of the return statement
6767
@@ -71,15 +71,15 @@ invalid.js:7:10 lint/nursery/noReturnAssign ━━━━━━━━━━━━
7171
```
7272
invalid.js:11:16 lint/nursery/noReturnAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
7373
74-
× Arrow function should not return assignment.
74+
× Function should not return assignment.
7575
7676
10 │ function f(a, b, c) {
7777
> 11return (a, b, c = 1);
7878
^^^^^
7979
12}
8080
13 │
8181
82-
i noReturnAssign: Return statements are often considered side-effect free.
82+
i Return statements are often considered side-effect free.
8383
You likely want to do a comparison `==`
8484
Otherwise move the assignment outside of the return statement
8585
@@ -89,15 +89,15 @@ invalid.js:11:16 lint/nursery/noReturnAssign ━━━━━━━━━━━
8989
```
9090
invalid.js:15:15 lint/nursery/noReturnAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
9191
92-
× Arrow function should not return assignment.
92+
× Function should not return assignment.
9393
9494
14 │ function f(a, b, c) {
9595
> 15return a == (b = c);
9696
^^^^^
9797
16}
9898
17 │ function f(a, b, c) {
9999
100-
i noReturnAssign: Return statements are often considered side-effect free.
100+
i Return statements are often considered side-effect free.
101101
You likely want to do a comparison `==`
102102
Otherwise move the assignment outside of the return statement
103103
@@ -107,7 +107,7 @@ invalid.js:15:15 lint/nursery/noReturnAssign ━━━━━━━━━━━
107107
```
108108
invalid.js:18:13 lint/nursery/noReturnAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
109109
110-
× Arrow function should not return assignment.
110+
× Function should not return assignment.
111111
112112
16}
113113
17 │ function f(a, b, c) {
@@ -116,7 +116,7 @@ invalid.js:18:13 lint/nursery/noReturnAssign ━━━━━━━━━━━
116116
19}
117117
20 │ function f(a, b) {
118118
119-
i noReturnAssign: Return statements are often considered side-effect free.
119+
i Return statements are often considered side-effect free.
120120
You likely want to do a comparison `==`
121121
Otherwise move the assignment outside of the return statement
122122
@@ -126,7 +126,7 @@ invalid.js:18:13 lint/nursery/noReturnAssign ━━━━━━━━━━━
126126
```
127127
invalid.js:21:15 lint/nursery/noReturnAssign ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
128128
129-
× Arrow function should not return assignment.
129+
× Function should not return assignment.
130130
131131
19}
132132
20 │ function f(a, b) {
@@ -135,7 +135,7 @@ invalid.js:21:15 lint/nursery/noReturnAssign ━━━━━━━━━━━
135135
22}
136136
23 │
137137
138-
i noReturnAssign: Return statements are often considered side-effect free.
138+
i Return statements are often considered side-effect free.
139139
You likely want to do a comparison `==`
140140
Otherwise move the assignment outside of the return statement
141141

0 commit comments

Comments
 (0)