Consider keeping `@type` comments single-line if possible
See original GitHub issueCurrently 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:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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