-
-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(linter/no-unused-vars): false positive for functions and classes …
…in arrays (#6394) Fixes a false positive when a function or class expression is an array element. Found while linting Jest tests in an internal repo. ```js import { stringify } from './custom-stringify'; test.each(['a', 1, function foo() {}])('When stringifying %p, matches the snapshot', input => { expect(stringify(input)).toMatchSnapshot(); }) ```
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
source: crates/oxc_linter/src/tester.rs | ||
--- | ||
⚠ eslint(no-unused-vars): Function 'foo' is declared but never used. | ||
╭─[no_unused_vars.tsx:1:12] | ||
1 │ ;[function foo() {}] | ||
· ─┬─ | ||
· ╰── 'foo' is declared here | ||
╰──── | ||
help: Consider removing this declaration. | ||
|
||
⚠ eslint(no-unused-vars): Class 'Foo' is declared but never used. | ||
╭─[no_unused_vars.tsx:1:9] | ||
1 │ ;[class Foo {}] | ||
· ─┬─ | ||
· ╰── 'Foo' is declared here | ||
╰──── | ||
help: Consider removing this declaration. |