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 optional requireThisBinding in named-functions-in-promises rule #69

Closed
michalsnik opened this issue May 24, 2017 · 0 comments
Closed

Comments

@michalsnik
Copy link
Member

michalsnik commented May 24, 2017

As discussed in #64 we agreed that it might have a sense to add new optional setting, called for example requireThisBinding which would require using current module's methods instead of custom ones.

Example with requireThisBinding = true:

// Good
user.save().then(this._reloadPage.bind(this));

// Good
user.save().then(() => this._reloadPage());

// Bad
user.save().then(reloadPage.bind(this));

// Bad
user.save().then(() => reloadPage());

Default setting would be false so all of the above examples will work fine and we'll keep it backwards compatible.

I don't have any better name for the setting in my mind at this moment, so feel free to add your propositions in comments.

@michalsnik michalsnik changed the title Add optional requireThisBinding in named-functions-in-promises Add optional requireThisBinding in named-functions-in-promises rule May 24, 2017
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

No branches or pull requests

1 participant