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.
Implement 4201: add option to ignore shadowed underscore (#4546)
* add option to ignore shadowed underscore * allow shadowing of multiple unused parameters
- Loading branch information
Showing
4 changed files
with
27 additions
and
3 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
10 changes: 10 additions & 0 deletions
10
test/rules/no-shadowed-variable/ignore-underscore/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,10 @@ | ||
import _ = require('lodash'); | ||
|
||
function foo(_) { | ||
console.log(_); | ||
} | ||
|
||
function foo(_1, _2) { | ||
// Allow shadowing of multiple unused parameters | ||
[].map((_1, _2) => undefined); | ||
} |
5 changes: 5 additions & 0 deletions
5
test/rules/no-shadowed-variable/ignore-underscore/tslint.json
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, {"underscore": false}] | ||
} | ||
} |