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
Update: Allow testing Suggestions with data in RuleTester (fixes #12606) #12635
Conversation
Sounds good to me. There was even talk about removing ints from errors at some point.
👍
I guess that's fine. Not sure why we need to check for that.
Good question. I think we should not allow suggestions without fixes. The whole point of suggestions is to provide multiple ways of working around a problem. Providing them without code changes doesn't make sense to me. |
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
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!
…nt#12606) (eslint#12635) * Update: Allow testing Suggestions with data in RuleTester (fixes eslint#12606) * Add data to suggestionObjectParameters
What is the purpose of this pull request? (put an "X" next to item)
[X] Add something to the core
fixes #12606
What changes did you make? (Give an overview)
RuleTester now allows testing Suggestions with
data
.Example:
Also, RuleTester documentation was missing
messageId
anddata
for errors.Is there anything you'd like reviewers to focus on?
To avoid breaking change, as noted in #12606 (comment), it's still allowed to specify both
desc
andmessageId
for the same suggestion. This combination is now removed from the example in the docs, but it still works and both values would be tested.Also, there are still some differences when compared to what can be used in error tests. This would probably require additional discussion and it seems better to make separate PRs (if needed):
suggestions
cannot be a number, e.g.,suggestions: 2
to just test that there are 2 suggestions and nothing more. A workaround issuggestions: [{}, {}]
.suggestions
array can't be just a string that would be treated asdesc
.desc
can't be a regex.