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 request] valid-jsdoc's matchDescription should support multiple regular expressions and different error messages for each.

See original GitHub issue

currently matchDescription accepts a regexp and throws an error message of “JSDoc description does not satisfy the regex pattern.”

Instead, I suggest it will accept a few regexpes, and will allow for different error messages. For example:

"valid-jsdoc": [
    "error",
    {
        "matchDescription": {
            ".+": "Missing JSDoc  description.",
            "^\\s*[A-Z]": "JSDoc description should start with an uppercase letter.",
            "\\.\\s*$": "JSDoc description must end with a period.",
            "^(?![\\s\\S]*?\\.\\s*[a-z]).*$": "Sentence in JSDoc description must start with an uppercase letter."
        }
    }
]

This will allow for a greater usability of the matchDescription option.

If it’s not a priority for the team, I can open a pull request myself, as my project needs it. If this would not get accepted, I will write a rule with the same behavior for my project anyway.

Edit: forgot to mention, it would also be nice to have an option to apply these to param descriptions. Such that we can check they start with an hyphen, end with a period, etc.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
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.

0reactions
platinumazurecommented, Jul 9, 2018

Removing myself as champion due to lack of general interest in this issue from the team and the community.

Read more comments on GitHub >

github_iconTop Results From Across the Web

REGEX - How to match and search any pattern or validate ...
You can download InterBase here: https://bit.ly/InterBase_DownloadI'll teach you the most important regex concepts, so after watching the ...
Read more >
Regular expression syntax cheatsheet - JavaScript | MDN
This page provides an overall cheat sheet of all the capabilities of RegExp syntax by aggregating the content of the articles in the...
Read more >
Everything you need to know about Regular Expressions
After reading this article you will have a solid understanding of what regular expressions are, what they can do, and what they can't...
Read more >
Quantifiers in Regular Expressions - Microsoft Learn
Learn about regular expression quantifiers, which specify how many instances of a character, group, or character class must be present in ...
Read more >
Regular Expressions
Okay, in many programming languages, a regular expression is a pattern that ... some internal form that can be used for super fast...
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