-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When called as methods on a promise chain, the current regex would mark `catch` and `finally` as keywords. This regex improvement ensures they're only caught as part of a `try / catch` block, and are marked as functions as part of the promise chain.
- Loading branch information
1 parent
9dfec34
commit ebd1b9a
Showing
6 changed files
with
86 additions
and
10 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
fetch('some-resource.json') | ||
.then(response => response.json()) | ||
.catch(console.error); | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["function", "fetch"], | ||
["punctuation", "("], | ||
["string", "'some-resource.json'"], | ||
["punctuation", ")"], | ||
["punctuation", "."], | ||
["function", "then"], | ||
["punctuation", "("], | ||
"response ", | ||
["operator", "=>"], | ||
" response", | ||
["punctuation", "."], | ||
["function", "json"], | ||
["punctuation", "("], | ||
["punctuation", ")"], | ||
["punctuation", ")"], | ||
["punctuation", "."], | ||
["function", "catch"], | ||
["punctuation", "("], | ||
"console", | ||
["punctuation", "."], | ||
"error", | ||
["punctuation", ")"], | ||
["punctuation", ";"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for catch function which is not a keyword. See #1526 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
try { } catch (e) { } finally { } | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "try"], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
["keyword", "catch"], | ||
["punctuation", "("], | ||
"e", | ||
["punctuation", ")"], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
["keyword", "finally"], | ||
["punctuation", "{"], | ||
["punctuation", "}"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for try statements. |