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 misses issues in function expression docs #4964

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

Comments

Projects
None yet
3 participants
@tschaub
Copy link
Contributor

commented Jan 15, 2016

With ESLint @ 86d64ca, it looks like the valid-jsdoc rule misses issues in documentation for function expressions.

The script.js below provides two invalid test cases (both the function declaration and the function expression have a typo in the @param name).

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

// valid-jsdoc catches the typo below

/**
 * Check the param name.
 * @param {string} typoInTheName The param description.
 * @return {string} The return description.
 */
function foo(bar) {
  return bar;
}

// valid-jsdoc does not catch the typo below

check(
  /**
   * Check the param name.
   * @param {string} typoInTheName The param description.
   * @return {string} The return description.
   */
  function(bar) {
    return bar;
  });

Here's what I get running this through ESLint:

$ node bin/eslint.js --no-eslintrc script.js 

/Users/tschaub/projects/eslint/script.js
  5:1  error  Expected JSDoc for 'bar' but found 'typoInTheName'  valid-jsdoc

✖ 1 problem (1 error, 0 warnings)

Instead of 1 problem, I would expect two. The valid-jsdoc rule correctly catches the typo in the @param name for the function declaration, but misses the same for the function expression.

@tschaub

This comment has been minimized.

Copy link
Contributor Author

commented Jan 15, 2016

It looks like this is specific to a function expression in a call (or new) expression. See #4965 for a proposed fix.

@nzakas

This comment has been minimized.

Copy link
Member

commented Jan 15, 2016

@gyandeeps

This comment has been minimized.

Copy link
Member

commented Jan 15, 2016

Sounds good to me. Not very common case I guess but I am fine with this recommendation.

@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.