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

valid-jsdoc must not require @returns when @member block #3744

Closed
gajus opened this issue Sep 11, 2015 · 8 comments
Closed

valid-jsdoc must not require @returns when @member block #3744

gajus opened this issue Sep 11, 2015 · 8 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 bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@gajus
Copy link
Contributor

gajus commented Sep 11, 2015

/**
 * A promise that is resolved when window.onYouTubeIframeAPIReady is called.
 * The promise is resolved with a reference to global.YT object.
 *
 * @member {Object} iframeAPIReady
 */
iframeAPIReady = null;
/**
 * A promise that is resolved when window.onYouTubeIframeAPIReady is called.
 * The promise is resolved with a reference to global.YT object.
 *
 * @var {Object} iframeAPIReady
 */
iframeAPIReady = null;

These produce an error:

Missing JSDoc @returns for function (valid-jsdoc)
@eslintbot
Copy link

Thanks for the issue! We get a lot of issues, so this message is automatically posted to each one to help you check that you've included all of the information we need to help you.

Reporting a bug? Please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. The source code that caused the problem
  3. The configuration you're using (for the rule or your entire config file)
  4. The actual ESLint output complete with line numbers

Requesting a new rule? Please be sure to include:

  1. The use case for the rule - what is it trying to prevent or flag?
  2. Whether the rule is trying to prevent an error or is purely stylistic
  3. Why you believe this rule is generic enough to be included

Requesting a feature? Please be sure to include:

  1. The problem you want to solve (don't mention the solution)
  2. Your take on the correct solution to problem

Including this information in your issue helps us to triage it and get you a response as quickly as possible.

Thanks!

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Sep 11, 2015
@gyandeeps
Copy link
Member

Can you share the config for the rule?
Version of eslint?

@gajus
Copy link
Contributor Author

gajus commented Sep 11, 2015

"valid-jsdoc": [
    1,
    {
        "requireParamDescription": false,
        "requireReturnDescription": false
    }
],

ESLint version v1.3.1.

@gyandeeps
Copy link
Member

With that info I cant reproduce the error using the online demo. Also based on the code we only require return if the function has a return statement.

@gajus
Copy link
Contributor Author

gajus commented Sep 11, 2015

@gyandeeps Sorry. Try:

/**
 * A promise that is resolved when window.onYouTubeIframeAPIReady is called.
 * The promise is resolved with a reference to global.YT object.
 *
 * @member {Object} iframeAPIReady
 */
iframeAPIReady = new Bluebird(function (resolve) {});

@gyandeeps
Copy link
Member

I think regardless whether you have @member or not, this code should not throw a return error.
@eslint/eslint-team

@mysticatea
Copy link
Member

If new is removed, this becomes the expected behavior.

I guess here https://github.com/eslint/eslint/blob/master/lib/util/source-code.js#L223 should includes NewExpression.

@ilyavolodin ilyavolodin added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Sep 11, 2015
@nzakas
Copy link
Member

nzakas commented Sep 11, 2015

Working on this.

@nzakas nzakas closed this as completed in 0f25d84 Sep 11, 2015
ilyavolodin added a commit that referenced this issue Sep 11, 2015
Fix: Skip JSDoc from NewExpression (fixes #3744)
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
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 bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

6 participants