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.

Consider keeping `@type` comments single-line if possible

See original GitHub issue

Currently with jsdocSingleLineComment set to false, this:

/** @type {import('eslint').Linter.Config} */
const config = {
  // ...
};

Becomes

/**
 * @type {import('eslint').Linter.Config}
 */
const config = {
  // ...
};

Personally, I like having multi-line jsdoc comments for “documentation” comments aka generally anytime it has more than a sole @ tag; I’m less fussed about things like @private as they’re typically on methods which should be documented anyway, but @types is very common when working in javascript codebases that are statically checked with TypeScript.

This also leads to casts being multi-lined which doesn’t look quite right (and might even break the cast):

module.exports = (/** @type {string} */ (config));

// becomes

module.exports = /**
 * @type {string}
 */ (config);

Would it be possible for this plugin to only force a jsdoc comment to be multiline if it had anything except a single @ tag?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
hosseinmdcommented, Nov 5, 2021

PR is welcome

2reactions
RedGuy12commented, Nov 4, 2021

jsdocSingleLineComment: true will make it multiline only if it has more than one tag, or if it exceeds the max line length.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clarifying Code with Javascript Comments | Udacity
Developers have different preferences for when to use single line or multiline comments, but maintaining a consistent strategy when commenting ...
Read more >
Best Practices For Using Comments In JavaScript
You can either use inline comments or use a block comment with a brief explanation of its use. let result = getVisibleComponents(); //...
Read more >
Single and Multi-Line Comments in Python - Udemy Blog
Comments in Python: How to Make Single Line and Multi-Line Comments ... You can consider comments as a type of necessary human-readable documentation....
Read more >
Is there a syntax for single-line comments for notebooks?
Is there a way to quickly comment out just one line in Mathematica, without having to type paired comment characters?
Read more >
Single Line Comments ( // ) in CSS - Tab Atkins Jr.
If you're using a decent editor, you will have a quick and easy shortcut to comment out a line or a block (eg...
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