Closed Ploppy3 closed 4 months ago
You can currently do so as follows:
rules: {
'jsdoc/no-restricted-syntax': ['error', {
contexts: [
{
comment: 'JsdocBlock:has(JsdocTag[tag=typedef] ~ JsdocTag[tag=typedef])',
context: 'any',
message: 'No multiple typedefs within a single block; create a separate block',
},
],
}]
}
Thank you very much, it works, feel free to close it if necessary
Motivation
There should be only 1
@typedef
per comment block.Current behavior
But there is no rule to limit this, therefore it can lead to invalid jsdoc.
Desired behavior
Add a new rules which limits the number of "main" tags (such as
@typedef
) that can be used in a single comment block. This could be autofixed by closing and opening another comment block.Example:
Change:
Into: