enhance require-jsdoc to recognize function expressions
See original GitHub issueESLint-version: 1.10.3, default parser
configuration:
"require-jsdoc":
[
2,
{
"require":
{
"FunctionDeclaration": true,
"MethodDefinition": false,
"ClassDeclaration": false
}
}
],
Running eslint (from a grunt task), I would expect this to cause an error:
module.exports.foo = function foo() {
return 'bar';
}
Instead, it passes through fine.
So that’s why I would propose an enhancement to the require-jsdoc rule to also recognise missing JSDoc blocks in functional expressions such as the above.
All of the below should pass through fine:
/**
* some description
*
* @returns {string}
*/
module.exports.foo = function foo() {
return 'bar';
}
/**
* some description
*
* @returns {string}
*/
foo: function() {
return 'bar';
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:11
- Comments:23 (18 by maintainers)
Top Results From Across the Web
require-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 for reused Function interface - javascript - Stack Overflow
This is the solution I like best thus far as it allows you to use the appropriate variable declaration keyword. The only downside...
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 >Downport "Replace deprecated `require-jsdoc`, `valid-jsdoc ...
"jsdoc/check-param-names": 0, ... "jsdoc/require-description-complete-sentence": 0, ... Convert parent indexes from patch range expressions to numbers.
Read more >JSDoc typings: all the benefits of TypeScript, with none of the ...
Better than before, because we know that the first parameter needs to be an object, and the second one a mapping function. But...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Pinging this so people know there is still interest. This would bring my documentation to 90+%.
All I care about is: A) var myfunc = function() {}
B) var object = { myfunc: function() {} }
The code I would like this to work for looks like this:
Similar to what everyone else is presenting except instead of
register: function(name) {
I’m usingregister(name) {
which is allowed in ES6.