Closed G-Rath closed 11 months ago
jsdocSingleLineComment: true will make it multiline only if it has more than one tag, or if it exceeds the max line length.
set jsdocSingleLineComment to true will solve your issue
@hosseinmd that won't solve my issue:
Personally, I like having multi-line jsdoc comments for "documentation" comments aka generally anytime it has more than a sole @ tag;
That's why I have it set to false
, because of #93.
Give me a solotion for your request.
Would it be possible for this plugin to only force a jsdoc comment to be multiline if it had anything except a single @ tag?
That's the high-level solution, maybe with an exclude for @description
since that'd include what #93 was about.
So it'd look like:
// single-line because it's only got one @ tag
/** @internal */
export const myProperty1 = 1;
// multi-line because it's got multiple @ tags
/**
* @type {number}
* @internal
*/
export const myProperty2 = 1;
// multi-line because it exceeds the line length
/**
* @type {import('@organisation/my-organisations-package').DeeplyNested.Type.Lives.here}
*/
export const myProperty3 = 1;
function receiveStructsSet(aSetObject){
// single-line because it only has one @ tag
const mySet = /** @type {goog.structs.Set} */ (aSetObject);
}
class MyClass {
// multi-line because it doesn't have an @ tag
/**
* This describes my method, it is awesome
*/
myMethod1() {
// ...
}
// multi-line because it has a @description tag
/**
* @description This describes my method, it is awesome
*/
myMethod2() {
// ...
}
// single-line because it's just got one @ tag
/** @private */
myMethod3() {
// ...
}
// single-line because it's just got one @ tag
/** @private */
myMethod4() {
// ...
}
// multi-line because it's got multiple @ tag
/**
* @private
* @internal
*/
myMethod5() {
// ...
}
// single-line because it's just got one @ tag
/** @private */
myMethod6() {
// ...
}
// multi-line because it's got multiple @ tags
/**
* @private
* @internal
*/
myMethod7() {
// ...
}
}
I'm wondering if it might be worth supporting this as an option that takes an array that represents the tags to allow being single-line, with the default being @type
🤔
I'm happy to have a go at making a PR implementing this either as it's own new option, or as the default behaviour for jsdocSingleLineComment
:)
PR is welcome
I think jsdocSingleLineComment option should be a enum type, and provide:
Weather should be one line is diffrent in diffrent case. So there should be one option to keep they are
This is the only reasone forbid me to using this plugin
@G-Rath maybe this issue can be closed?
@tjx666 why do you say that?
Sorry for that message, lone time no see this issue, but see there is a option jsdocSingleLineComment...
jsdocSingleLineComment
does not address this issue - please read the original body and my follow-on comments for why.
I think jsdocSingleLineComment option should be a enum type, and provide:
- singleLine
- multipleLine
- keep
Weather should be one line is diffrent in diffrent case. So there should be one option to keep they are
This is the only reasone forbid me to using this plugin
This is much better. But we should discuss options.
implemented
jsdocCommentLineStrategy ("singleLine","multiline","keep")
deprecated
jsdocSingleLineComment
has backward compatibility
v1.1.0
Currently with
jsdocSingleLineComment
set tofalse
, this:Becomes
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):
Would it be possible for this plugin to only force a jsdoc comment to be multiline if it had anything except a single
@
tag?