Skip to content

Conversation

@g-plane
Copy link
Contributor

@g-plane g-plane commented May 5, 2021

Fixes #1482 .

Copy link
Member

@ota-meshi ota-meshi 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 this PR! I have some change requests.

@g-plane
Copy link
Contributor Author

g-plane commented May 7, 2021

I have a question about null for skipping validation: some new users may just want to define an event without any payload, and they may choose to use null, but actually they should use () => true which means "no payload". Should we detect for null and provide a suggestion which advises them to use () => true?

@ota-meshi
Copy link
Member

Thank you for the question.
I think we need to suggest () => true instead of null. () => true can type check for no payload.
In addition, if the user wants to check for no payload, the user can also set (...args:[]) => args.length === 0.

@g-plane g-plane changed the title Add vue/require-emit-types rule Add vue/require-emit-validator rule May 7, 2021
@g-plane g-plane requested a review from ota-meshi May 7, 2021 09:57
Copy link
Member

@ota-meshi ota-meshi 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!

@ota-meshi ota-meshi merged commit d03ce92 into vuejs:master May 29, 2021
@g-plane g-plane deleted the issue-1482 branch May 29, 2021 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule proposal: require-emit-validator

2 participants