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 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added options for classes to no-floating-promises
Users can now specify rules that are considered to be promises, such as `"JQueryPromise"`.
- Loading branch information
Josh Goldberg
committed
Oct 19, 2016
1 parent
e509f3f
commit 6f932dd
Showing
5 changed files
with
50 additions
and
5 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
17 changes: 17 additions & 0 deletions
17
test/rules/no-floating-promises/jquerypromise/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,17 @@ | ||
class Promise { } | ||
class JQueryPromise { } | ||
class NotAPromise { } | ||
|
||
const returnsPromise = () => new Promise(); | ||
const returnsJQueryPromise = () => new JQueryPromise(); | ||
const returnsNotAPromise = () => new NotAPromise(); | ||
|
||
returnsPromise(); | ||
~~~~~~~~~~~~~~~~ [0] | ||
|
||
returnsJQueryPromise(); | ||
~~~~~~~~~~~~~~~~~~~~~~ [0] | ||
|
||
returnsNotAPromise(); | ||
|
||
[0]: Promises must be handled appropriately |
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,8 @@ | ||
{ | ||
"linterOptions": { | ||
"typeCheck": true | ||
}, | ||
"rules": { | ||
"no-floating-promises": [true, "JQueryPromise"] | ||
} | ||
} |
File renamed without changes.
File renamed without changes.