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

The valid-jsdoc rule doesn't catch missing param for multi-line assignment expressions #4889

Closed
tschaub opened this Issue Jan 8, 2016 · 3 comments

Comments

Projects
None yet
4 participants
@tschaub
Copy link
Contributor

tschaub commented Jan 8, 2016

With ESLint @ 1972678, if an assignment expression spans multiple lines, valid-jsdoc doesn't catch missing @param or param description. See the following example:

/* eslint valid-jsdoc: [2, {requireReturn: false}] */

var obj = {};

/**
 * Single line assignment.  The valid-jsdoc rule catches the issue with the
 * missing param description.
 * @param {string} arg
 * @return {string} A string.
 */
obj.foo = function(arg) {
  return arg;
};

/**
 * Multi line assignment.  The valid-jsdoc rule misses the issue with the
 * missing param description.
 * @param {string} arg
 * @return {string} A string.
 */
obj.bar =
    function(arg) {
      return arg;
    };

5:1 error Missing JSDoc parameter description for 'arg' valid-jsdoc

The first comment block is correctly linted (it is missing the parameter description). The second comment block is not correctly linted (it is also missing the parameter description).

@eslintbot

This comment has been minimized.

Copy link

eslintbot commented Jan 8, 2016

@tschaub Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

@eslintbot eslintbot added the triage label Jan 8, 2016

@gyandeeps gyandeeps added bug rule core accepted and removed triage labels Jan 8, 2016

gyandeeps added a commit that referenced this issue Jan 8, 2016

@alberto

This comment has been minimized.

Copy link
Member

alberto commented Jan 8, 2016

I guess the other cases will fail too: "ClassExpression" and "FunctionDeclaration". We should probably fix them here too.

@gyandeeps

This comment has been minimized.

Copy link
Member

gyandeeps commented Jan 8, 2016

I have fixed them also. Will add tests for it.

@gyandeeps gyandeeps closed this in e5e06f8 Jan 9, 2016

nzakas added a commit that referenced this issue Jan 9, 2016

Merge pull request #4892 from eslint/issue4889
Fix: Jsdoc comment for multi-line function expressions (fixes #4889)

@eslint eslint bot locked and limited conversation to collaborators Feb 6, 2018

@eslint eslint bot added the archived due to age label Feb 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.