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

Provide default arguments to axe.cleanup() #709

Merged
merged 1 commit into from
Feb 13, 2018
Merged

Provide default arguments to axe.cleanup() #709

merged 1 commit into from
Feb 13, 2018

Conversation

lsiden
Copy link
Contributor

@lsiden lsiden commented Feb 1, 2018

axe.cleanup() requires two functional arguments, 'resolve' and 'reject' that are not mentioned in the documentation (I will create a separate pull-request for that).

This change will define default arguments with reasonable behavior: default resolve() does nothing and default reject() logs an error message to the console.

This is related to Issue #705 .

@CLAassistant
Copy link

CLAassistant commented Feb 1, 2018

CLA assistant check
All committers have signed the CLA.

@@ -42,4 +42,8 @@ function cleanupPlugins(resolve, reject) {
})
.catch(reject);
}

function cleanupPlugins(resolve=(() => {}), reject=axe.log) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to define a new function for this. Please just put these default params into the original function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to do this because of:

Warning: lib/core/public/cleanup-plugins.js: Non-simple parameter in strict mode (2:24) Use --force to continue.

In order to put default params in the original function signature, I would have to disable strict mode, which I don't think you want to do.

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be a JSHint bug. Just use fallback params instead:

resolve = resolve || () => {};
reject = reject || axe.log;

@marcysutton
Copy link
Contributor

Let's be sure to squash the commits when we merge this to a) get a commit message that adheres to our commit policy, and b) get the merge commit out of there.

@WilcoFiers
Copy link
Contributor

@lsiden You'll have to agree to the license before we can merge in.

@lsiden
Copy link
Contributor Author

lsiden commented Feb 11, 2018

@WilcoFiers I already agreed to the License Agreement as "lsiden". I think "Lawrence Siden" is from a the Github account "lsiden-deque@gmail.com" which I created when I joined Deque Labs several months ago, but just deleted minutes ago since I haven't used it. I don't know why it still show up as a "contributor" to this PR. Maybe it has been cached.

@lsiden
Copy link
Contributor Author

lsiden commented Feb 11, 2018

Will do @marcysutton, once it's ready. Thank you for reminding me.

…uments are provided

Document signature of axe.cleanup()
@lsiden lsiden merged commit fb1d2f7 into dequelabs:develop Feb 13, 2018
mrtnvh pushed a commit to mrtnvh/axe-core that referenced this pull request Nov 24, 2023
Co-authored-by: michael-siek <michael-siek@users.noreply.github.com>
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.

4 participants