Skip to content
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

Merged
merged 9 commits into from Jan 3, 2020
Merged

Chore: add JSDoc types for RuleTester test cases #12325

merged 9 commits into from Jan 3, 2020

Conversation

golopot
Copy link
Contributor

@golopot golopot commented Sep 27, 2019

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

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Sep 27, 2019
@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion chore This change is not user-facing and removed triage An ESLint team member will look at this issue soon labels Dec 14, 2019
Copy link
Member

@kaicataldo kaicataldo left a 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.

Copy link
Member

@mysticatea mysticatea left a 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.

lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
@kaicataldo
Copy link
Member

@golopot Friendly ping

@golopot
Copy link
Contributor Author

golopot commented Dec 23, 2019

Ready for review.

Copy link
Member

@mysticatea mysticatea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

Copy link
Member

@platinumazure platinumazure left a 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!

lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
@golopot
Copy link
Contributor Author

golopot commented Dec 24, 2019

Is there a way for InvalidTestCase to require either a message or messageId, but preferably disallow both?

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.

lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
lib/rule-tester/rule-tester.js Show resolved Hide resolved
Copy link
Member

@mdjermanovic mdjermanovic left a 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.

@kaicataldo kaicataldo merged commit e4df7df into eslint:master Jan 3, 2020
@kaicataldo
Copy link
Member

Thanks for contributing to ESLint!

@golopot golopot deleted the rule-tester-types branch March 1, 2020 15:53
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 3, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jul 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants