forked from palantir/tslint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding "allow-declarations" to only-arrow-functions (palantir#1452)
- Loading branch information
Josh Goldberg
authored and
Nina Hartmann
committed
Aug 31, 2016
1 parent
7f5360e
commit c4686d7
Showing
5 changed files
with
45 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
20 changes: 20 additions & 0 deletions
20
test/rules/only-arrow-functions/allow-declarations/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,20 @@ | ||
function foo(a: any) : any { | ||
return; | ||
} | ||
|
||
let a = () => {}; | ||
let b = function () {}; | ||
~~~~~~~~ [0] | ||
|
||
function c() {} | ||
|
||
function () { | ||
// ... | ||
} | ||
|
||
((func) => func())(function e(): void {}); | ||
~~~~~~~~ [0] | ||
|
||
((func) => func())(() => {}); | ||
|
||
[0]: non-arrow functions are forbidden |
5 changes: 5 additions & 0 deletions
5
test/rules/only-arrow-functions/allow-declarations/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": { | ||
"only-arrow-functions": [true, "allow-declarations"] | ||
} | ||
} |
File renamed without changes.
File renamed without changes.