-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: improve token types and add missing type guards #1497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: improve token types and add missing type guards #1497
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few questions/comments, otherwise lgtm
@@ -113,67 +113,67 @@ declare module 'eslint-utils' { | |||
|
|||
export function isArrowToken( | |||
token: TSESTree.Token | TSESTree.Comment, | |||
): boolean; | |||
): token is TSESTree.PunctuatorToken & { value: '=>' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question:
did we want to make this generic on the value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did that at begging but typescript was behaving in unexpected way and type-guard was not working as it should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops forgot to rc
after merge i fixed up types used in recently added |
Codecov Report
@@ Coverage Diff @@
## master #1497 +/- ##
=========================================
+ Coverage 95.58% 95.6% +0.01%
=========================================
Files 147 148 +1
Lines 6617 6664 +47
Branches 1891 1909 +18
=========================================
+ Hits 6325 6371 +46
Misses 111 111
- Partials 181 182 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything you've got so far LGTM.
one final request while you're at it - there's a few functions in eslint-plugin/src/utils
, could you give them the same treatment too please?
After that, happy to merge.
ok, done we are still missing type-guards for negated versions of those functions |
i did small digging into negated version of those functions and it seems really hard to make them actually work, microsoft/TypeScript#29317 could help with that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for the cleanup.
I'm not worried about the negated functions. We can deal with them at a later point
#1495 (comment)