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
Chore: add JSDoc types for RuleTester test cases #12325
Conversation
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.
Sorry for the delay! This generally LGTM, but I'd love to have others who might have opinions around where the best place for these type definitions is.
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.
Thank you for your contribution and I'm sorry for the late responses.
The adding is good to me. But, as similar to other files, it's better to group the type definitions at the top of the file. And I suggested some right types.
@golopot Friendly ping |
Ready for review. |
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. Thank you!
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.
This generally looks good to me, but I'll ask one question: Is there a way for InvalidTestCase
to require either a message
or messageId
, but preferably disallow both? Thanks!
There is a SO question with a well accepted answer https://stackoverflow.com/questions/37688318/typescript-interface-possible-to-make-one-or-the-other-properties-required. But when I try it I found that the answer actually does not work, due the the limitation of TypeScript, see https://stackoverflow.com/questions/59462318/why-does-typescript-allow-a-1-b-2-to-be-assigned-to-type-a-any-b . So, ...no. |
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 this useful addition!
We can add suggestions
later.
Thanks for contributing to ESLint! |
What is the purpose of this pull request? (put an "X" next to item)
[x] Other, please explain:
Improve JSDoc typings.
What changes did you make? (Give an overview)
Add type for valid and invalid RuleTester test cases. This addition enables editor autocomplete/suggestions.
The typings are copied from
@types/eslint
.Is there anything you'd like reviewers to focus on?
No