-
-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(linter): false positive in
no-return-assign
(#6128)
- Loading branch information
Showing
2 changed files
with
98 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,127 @@ | ||
--- | ||
source: crates/oxc_linter/src/tester.rs | ||
--- | ||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:16] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:23] | ||
1 │ function x() { return result = a * b; }; | ||
· ────────────────────── | ||
· ────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:16] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:23] | ||
1 │ function x() { return (result) = (a * b); }; | ||
· ────────────────────────── | ||
· ────────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:16] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:23] | ||
1 │ function x() { return result = a * b; }; | ||
· ────────────────────── | ||
· ────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:16] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:23] | ||
1 │ function x() { return (result) = (a * b); }; | ||
· ────────────────────────── | ||
· ────────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:9] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:16] | ||
1 │ () => { return result = a * b; } | ||
· ────────────────────── | ||
· ────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Arrow function should not return an assignment. | ||
╭─[no_return_assign.tsx:1:1] | ||
⚠ eslint(no-return-assign): Arrow functions should not return an assignment. | ||
╭─[no_return_assign.tsx:1:7] | ||
1 │ () => result = a * b | ||
· ──────────────────── | ||
· ────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:16] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:23] | ||
1 │ function x() { return result = a * b; }; | ||
· ────────────────────── | ||
· ────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:16] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:24] | ||
1 │ function x() { return (result = a * b); }; | ||
· ──────────────────────── | ||
· ────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:16] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:1:34] | ||
1 │ function x() { return result || (result = a * b); }; | ||
· ────────────────────────────────── | ||
· ────────────── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:2:20] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:2:27] | ||
1 │ function foo(){ | ||
2 │ return a = b | ||
· ──────────── | ||
· ───── | ||
3 │ } | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:2:20] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:2:27] | ||
1 │ function doSomething() { | ||
2 │ return foo = bar && foo > 0; | ||
· ──────────────────────────── | ||
· ──────────────────── | ||
3 │ } | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:2:20] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:2:27] | ||
1 │ function doSomething() { | ||
2 │ ╭─▶ return foo = function(){ | ||
3 │ │ return (bar = bar1) | ||
4 │ ╰─▶ } | ||
5 │ } | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:2:20] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:2:27] | ||
1 │ function doSomething() { | ||
2 │ return foo = () => a | ||
· ──────────────────── | ||
· ───────────── | ||
3 │ } | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Arrow function should not return an assignment. | ||
╭─[no_return_assign.tsx:2:27] | ||
⚠ eslint(no-return-assign): Arrow functions should not return an assignment. | ||
╭─[no_return_assign.tsx:2:33] | ||
1 │ function doSomething() { | ||
2 │ return () => a = () => b | ||
· ───────────────── | ||
· ─────────── | ||
3 │ } | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Return statement should not contain an assignment. | ||
╭─[no_return_assign.tsx:3:24] | ||
⚠ eslint(no-return-assign): Return statements should not contain an assignment. | ||
╭─[no_return_assign.tsx:3:31] | ||
2 │ return function bar(b){ | ||
3 │ return a = b | ||
· ──────────── | ||
· ───── | ||
4 │ } | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? | ||
|
||
⚠ eslint(no-return-assign): Arrow function should not return an assignment. | ||
╭─[no_return_assign.tsx:1:20] | ||
⚠ eslint(no-return-assign): Arrow functions should not return an assignment. | ||
╭─[no_return_assign.tsx:1:27] | ||
1 │ const foo = (a) => (b) => a = b | ||
· ──────────── | ||
· ───── | ||
╰──── | ||
help: Did you mean to use `==` instead of `=`? |