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
Update: callback-return allows for object methods (fixes #4711) #6277
Conversation
LGTM |
By analyzing the blame information on this pull request, we identified @vitorbal, @nzakas and @gyandeeps to be potential reviewers |
@@ -73,7 +74,7 @@ ruleTester.run("callback-return", rule, { | |||
|
|||
// options (only warns with the correct callback name) | |||
{ | |||
code: "if (err) { callback(err) }", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually allowing anything to pass because it wasn't wrapped in a function
Can you update the docs to show methods will work? |
5c1d49b
to
b699c1e
Compare
|
||
Examples of **incorrect** code for this rule with the default `["callback", "cb", "next"]` option: | ||
|
||
```js | ||
/*eslint callback-return: "error"*/ | ||
|
||
function foo() { | ||
function foo(err, callback) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with the example at the beginning. I think it makes the examples a little more concrete - please let me know if you disagree.
Updated |
LGTM |
Lgtm |
The one caveat about solving this problem this way is that it must match exactly - i.e.Updated, no longer relevant.object().method
is not the same thing asobject.method
. This seems to me like a reasonable tradeoff to solve this issue right now, though maybe it could be made much smarter in the future.