Skip to content

feat: add new rule await-fire-event #18

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

Merged
merged 1 commit into from
Oct 2, 2019

Conversation

Belco90
Copy link
Member

@Belco90 Belco90 commented Oct 1, 2019

Adds new rule await-fire-event for waiting special async fireEvent methods (only for Vue).

@Belco90 Belco90 requested a review from thomaslombart October 1, 2019 21:28
Comment on lines +5 to +20
function isAwaited(node) {
return VALID_PARENTS.includes(node.type);
}

function hasThenProperty(node) {
return node.type === 'MemberExpression' && node.property.name === 'then';
}

function isPromiseResolved(node) {
const parent = node.parent.parent;

// fireEvent.click().then(...)
if (parent.type === 'CallExpression') {
return hasThenProperty(parent.parent);
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

These methods are partly duplicated, but I prefer to leave them like that for now as they are not exactly the same from await-async-query and see in the future how to refactor them.

Copy link
Collaborator

@thomaslombart thomaslombart left a comment

Choose a reason for hiding this comment

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

Didn't run the tests locally, but everything LGTM! 👍

@Belco90 Belco90 merged commit 3883869 into master Oct 2, 2019
@Belco90 Belco90 deleted the feature/rule-await-fire-event branch October 2, 2019 06:56
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.

2 participants