-
-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(noUnusedVariables): don't panic when renaming ref at the start
- Loading branch information
Showing
5 changed files
with
44 additions
and
4 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
2 changes: 2 additions & 0 deletions
2
crates/biome_js_analyze/tests/specs/correctness/noUnusedVariables/issue4114.js
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,2 @@ | ||
c; | ||
const c = 0; |
31 changes: 31 additions & 0 deletions
31
crates/biome_js_analyze/tests/specs/correctness/noUnusedVariables/issue4114.js.snap
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,31 @@ | ||
--- | ||
source: crates/biome_js_analyze/tests/spec_tests.rs | ||
expression: issue4114.js | ||
--- | ||
# Input | ||
```jsx | ||
c; | ||
const c = 0; | ||
``` | ||
|
||
# Diagnostics | ||
``` | ||
issue4114.js:2:7 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
! This variable is unused. | ||
1 │ c; | ||
> 2 │ const c = 0; | ||
│ ^ | ||
i Unused variables usually are result of incomplete refactoring, typos and other source of bugs. | ||
i Unsafe fix: If this is intentional, prepend c with an underscore. | ||
1 │ - c; | ||
2 │ - const·c·=·0; | ||
1 │ + _c; | ||
2 │ + const·_c·=·0; | ||
``` |
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