This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no-shadowed-variable: fix bugs and add ignore options (#3030)
[new-rule-option] `no-shadowed-variable` let's you optionally ignore certain kinds of declarations [bugfix] `no-shadowed-variable` fixed false positive with parameter inside function decorator Fixes: #3000 [bugfix] `no-shadowed-variable` don't warn for shadowed type parameter on static class members Fixes: #3019
- Loading branch information
Showing
7 changed files
with
185 additions
and
25 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
File renamed without changes.
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,16 @@ | ||
class C { | ||
constructor() { | ||
var C; | ||
var D; | ||
~ [Shadowed name: 'D'] | ||
{ | ||
class C { | ||
constructor() { | ||
var C; | ||
~ [Shadowed name: 'C'] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
interface D {} |
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,5 @@ | ||
{ | ||
"rules": { | ||
"no-shadowed-variable": [true, {"class": false}] | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
test/rules/no-shadowed-variable/ignore-import/test.ts.lint
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,13 @@ | ||
import {diff} from "diff"; | ||
import clear from "storage-helper"; | ||
|
||
diff(original, current).forEach((diff) => { | ||
console.log(diff); | ||
}); | ||
|
||
{ | ||
(function clear() { | ||
let clear = true; | ||
~~~~~ [Shadowed name: 'clear'] | ||
})(); | ||
} |
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,5 @@ | ||
{ | ||
"rules": { | ||
"no-shadowed-variable": [true, {"import": false}] | ||
} | ||
} |