question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

valid-jsdoc rule doesn't work on @param {String} options.X-My-Header custom header

See original GitHub issue

What version of ESLint are you using? v2.2.0

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

Full config is at https://github.com/watson-developer-cloud/speech-javascript-sdk/blob/51dd4a041c8e74051ebb87b2630f040b6f0f19a9/.eslintrc.js#L205 but here’s the relevant bit.

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

I also tested and confirmed that I get the same issue with just 'valid-jsdoc': 1.

What did you do? Please include the actual source code causing the issue.

This is one example of my (working) JSDoc that’s failing ESLint:

* @param {Number} [options.X-WDC-PL-OPT-OUT=0] set to 1 to opt-out of allowing Watson to use this request to improve it's services

You can see it in context at https://github.com/watson-developer-cloud/speech-javascript-sdk/blob/9b683539218a3f060116aa65cfa709380a3ae98c/text-to-speech/synthesize.js#L34

I also tried writing it as

* @param {Number} [options['X-WDC-PL-OPT-OUT']=0] set to 1 to opt-out of allowing Watson to use this request to improve it's services

That passes ESLint but causes JSDoc to explode. (I filed a bug about that at https://github.com/jsdoc3/jsdoc/issues/1178 - but I still think the first behavior is an ESLint bug: a rule named “valid-jsdoc” really shouldn’t enforce invalid JSDoc.)

What did you expect to happen?

I expect my working JSDoc to pass the valid-jsdoc rule, or for there to at least be some format that works for both ESLint and JSDoc

What actually happened? Please include the actual, raw output from ESLint.

That line gives me

26:1 warning Missing JSDoc parameter type for 'Number' valid-jsdoc

Here’s the full output:

~/watson-speech (master) $ npm run lint

> watson-speech@0.14.0 lint /Users/nfriedly/watson-speech
> eslint .


/Users/nfriedly/watson-speech/speech-to-text/format-stream.js
  113:7  warning  Unexpected 'todo' comment  no-warning-comments

/Users/nfriedly/watson-speech/speech-to-text/media-element-audio-stream.js
  68:7  warning  Unexpected 'todo' comment  no-warning-comments

/Users/nfriedly/watson-speech/speech-to-text/recognize-stream.js
   34:1   warning  Missing JSDoc parameter type for 'String'  valid-jsdoc
   34:1   warning  Missing JSDoc parameter type for 'Number'  valid-jsdoc
  146:13  warning  Unexpected 'todo' comment                  no-warning-comments
  149:9   warning  Unexpected 'todo' comment                  no-warning-comments
  165:3   warning  Unexpected 'todo' comment                  no-warning-comments
  379:1   warning  Unexpected 'todo' comment                  no-warning-comments

/Users/nfriedly/watson-speech/speech-to-text/timing-stream.js
  37:32  warning  Unexpected 'todo' comment  no-warning-comments

/Users/nfriedly/watson-speech/text-to-speech/synthesize.js
  26:1  warning  Missing JSDoc parameter type for 'Number'  valid-jsdoc

✖ 10 problems (0 errors, 10 warnings)

(Ignore the todo’s - I want those to nag me until they’re fixed.)

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:3
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kaicataldocommented, Mar 27, 2016

Opened a PR to doctrine to attempt to fix this. I’ve already tested that branch of doctrine with ESLint locally and can open a PR with tests covering this and bumping the doctrine version if that gets merged.

0reactions
kaicataldocommented, Apr 15, 2016

@nfriedly Thanks for the kind words 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSDoc doesn't display a table of arguments and return value ...
Here is the header for the function I was able to make it work: /** * Converts a time interval into a different...
Read more >
valid-jsdoc - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
JSDoc Reference - TypeScript: Documentation
The list below outlines which constructs are currently supported when using JSDoc annotations to provide type information in JavaScript files.
Read more >
JSDoc: Class: ojAccordion - Oracle Help Center
A JET Accordion can be created from any valid markup as long as the root element has one or ... Collapsible header, Space...
Read more >
Documentation Style Guide - GitLab Docs
With Kramdown, you can add a custom ID to an HTML element, but these IDs don't work in /help , so you should...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found