Change proposal: Allow exceptions for require-jsdoc
See original GitHub issueHey guys,
I want to start adopting require-jsdoc for internal use at the company I’m working with. The problem is that it either flags any function or none at all; meaning that even oft-repeated functions need a docblock. To be more specific, we’d like to opt-out of the rule if the function has a certain name, ie. mapStateToProps
or render
. We believe this will enforce a pattern of creating thoughtful comments, without having to create a docblock for recurring pieces of code.
I am perfectly willing to do a pull request for this one, if it all sounds good to you.
What rule do you want to change? require-jsdoc
Does this change cause the rule to produce more or fewer warnings? Fewer
How will the change be implemented? (New option, new default behavior, etc.)? New option
Please provide some example code that this change will affect:
Config
"require-jsdoc": ["error", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": false,
"ClassDeclaration": false,
"ArrowFunctionExpression": false,
"FunctionExpression": false
},
"exceptions": [
"mapDispatchToProps"
]
}]
Code:
function mapDispatchToProps() {
return {};
}
function otherFunctionName () {
return {};
}
What does the rule currently do for this code?
Throws errors for both mapDispatchToProps
and otherFunctionName
.
What will the rule do after it’s changed?
Only throw an error for otherFunctionName
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
Top GitHub Comments
This seems reasonable to me, though I think
exceptions
might make more sense thanexceptMethods
since this rule also checks function declarations and expressions.Thanks for the suggestion. As of yesterday, we have decided to officially end-of-life JSDoc support in ESLint. All JSDoc features are now deprecated and we won’t be fixing bugs or making any further improvements to those features.
We are recommending that people transition over to use the
eslint-plugin-jsdoc
plugin instead of the built-in rules in ESLint.Thanks for understanding and we apologize for any inconvenience.