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.

Change proposal: Allow exceptions for require-jsdoc

See original GitHub issue

Hey 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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kaicataldocommented, Oct 28, 2018

This seems reasonable to me, though I think exceptions might make more sense than exceptMethods since this rule also checks function declarations and expressions.

0reactions
nzakascommented, Nov 28, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >
eslint-plugin-jsdoc | Yarn - Package Manager
settings.jsdoc.ignorePrivate - Disables all rules for the comment block on which a @private tag (or @access private ) occurs. Defaults to false ....
Read more >
eslint-plugin-jsdoc/README.md - UNPKG
The CDN for eslint-plugin-jsdoc. ... 183, (any exceptions to this format are explained within that rule's docs). ... 9277, function request() {.
Read more >
Request not being processed - Stack Overflow
Im currently trying to learn more about Express and Express-Validator but currently facing the following issue: When I'm starting the server ...
Read more >
Integration with ESLint JavaScript Linter - Codacy | Blog
Enable them on your projects and share your feedback with us! ... double or single quotes should be used (fixable); require-jsdoc — Require...
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