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.

Use a loose set of rules for consistent JSDoc comments

See original GitHub issue

While using JSDoc should not be mandatory, I think that its users should aim for more consistency, which may be achieved by the following set of loose ESLint rules:

"valid-jsdoc": ["error", {
  "prefer": {
    "arg": "param",
    "argument": "param",
    "class": "constructor",
    "return": "returns",
    "virtual": "abstract"
  },
  "preferType": {
    "Boolean": "boolean",
    "Number": "number",
    "object": "Object",
    "String": "string"
  },
  "requireReturn": false
}]

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ljharbcommented, Feb 25, 2018

@bryankennedy Sure!

  1. code comments should never explain “what”, only “why” and history/motivation. Good code is clean and self-documenting.
  2. without a tool that prevents it, these sorts of comments rapidly go out of sync with the code, rendering them worse than nothing (misinformation is worse than no information)
  3. regarding docs generation, if your API is too complex to hand-write, then it’s too complex 😃 using tools that make it easier for you to do bad things (making your API overly complex, for example) aren’t good tools.
2reactions
bryankennedycommented, Feb 25, 2018

@ljharb Could you expand your thoughts, or point me to some reading behind your (Airbnb’s) dislike of JSDoc? Seen this referenced in a couple issues, and I’m just trying to understand.

Edit - Nevermind, sorry…saw that you did just what I was asking about here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I configure ESLint to check for TypeScript class ...
Firstly, I should note that eslint-plugin-jsdoc 's rules are incremental. If you don't have any jsdoc block at all, you first need to...
Read more >
Use JSDoc: @constant
The @constant tag is used to mark the documentation as belonging to a symbol that is a constant. Examples. In this example we...
Read more >
Rules - ESLint - Pluggable JavaScript Linter
Rules in ESLint are grouped by type to help you understand their purpose. ... Enforce the consistent use of either `function` declarations or...
Read more >
Joshua's Docs - JSDoc Cheatsheet and Type Safety Tricks
Cheatsheet on using JSDoc, especially with VSCode, and some tips on type ... I found the right syntax thanks to this Github issue...
Read more >
A JSDoc in TypeScript's Clothing - DEV Community ‍ ‍
Similarly, we strive to ensure a consistent output from our functions. With both TS and JSDoc, it's at least possible to annotate the...
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