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

callback-return does not work with object methods #4711

Closed
fakewaffle opened this issue Dec 15, 2015 · 7 comments
Closed

callback-return does not work with object methods #4711

fakewaffle opened this issue Dec 15, 2015 · 7 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint good first issue Good for people who haven't worked on ESLint before help wanted The team would welcome a contribution from the community for this issue rule Relates to ESLint's core rules

Comments

@fakewaffle
Copy link
Contributor

I've read the documentation for the rule, but did not see anything related to this; nor could I find an issue.

.eslintrc

{
    "env" : {
        "node" : true
    },

    "rules" : {
        "callback-return" : [ 2, [ "callback", "cb", "done", "next", "send.error", "send.success", "send.fail", "reply" ] ]
    }
}

callback-return.js

'use strict'

( function ( item, send, callback ) {
    if ( item ) {
        send.fail();
    }

    send.success();

    if ( item ) {
        callback( item );
    }

    callback();
} );

console

~/Source/temp
> eslint -c .eslintrc callback-return.js

~/Source/temp/callback-return.js
  11:3  error  Expected return with your callback function  callback-return

✖ 1 problem (1 error, 0 warnings)

Given the options I supplied to the rule, I would expect ESLint to give an error for send.fail();.

Thoughts?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@gyandeeps
Copy link
Member

Based on the code it only works for callee as Identifier and not for callee as MemberExpression.
Reference: https://github.com/eslint/eslint/blob/master/lib/rules/callback-return.js#L41-L43

@fakewaffle what is the eslint version you are using?
@eslint/eslint-team Thoughts?

@gyandeeps gyandeeps added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Dec 15, 2015
@nzakas
Copy link
Member

nzakas commented Dec 15, 2015

I'm open to this enhancement.

@fakewaffle do you want to submit a pull request?

@nzakas nzakas added accepted There is consensus among the team that this change meets the criteria for inclusion help wanted The team would welcome a contribution from the community for this issue and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Dec 15, 2015
@fakewaffle
Copy link
Contributor Author

@gyandeeps v1.10.3.

@nzakas Yes!

fakewaffle added a commit to fakewaffle/eslint that referenced this issue Dec 15, 2015
@gyandeeps
Copy link
Member

@fakewaffle I can see u have done implementation but you havent opened a pull request. I dont know if you forgot to that or is deliberate. Just a reminder. 😄

@nzakas nzakas added the good first issue Good for people who haven't worked on ESLint before label Dec 27, 2015
@fakewaffle
Copy link
Contributor Author

@gyandeeps #4716?

@ghost
Copy link

ghost commented Apr 5, 2016

If no one is currently working on this, I'd love to give it a shot and pickup where @fakewaffle left off.

@ilyavolodin
Copy link
Member

@josectello Go for it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint good first issue Good for people who haven't worked on ESLint before help wanted The team would welcome a contribution from the community for this issue rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

4 participants