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

Add vue/require-emit-validator rule #1487

Merged
merged 5 commits into from May 29, 2021
Merged

Add vue/require-emit-validator rule #1487

merged 5 commits into from May 29, 2021

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.

lib/rules/require-emit-types.js Outdated Show resolved Hide resolved
docs/rules/require-emit-types.md Outdated Show resolved Hide resolved
tests/lib/rules/require-emit-types.js Outdated Show resolved Hide resolved
@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