Skip to content

Commit 23b4bfa

Browse files
committed
fix(empty-tags): allow for JSDoc-block final asterisks; fixes #670
1 parent 60d4d4b commit 23b4bfa

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

docs/rules/empty-tags.md

+5
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,10 @@ function quux () {
216216
* @returns {string[]} The array of nodes.
217217
*/
218218
function quux () {}
219+
220+
/** Application boot function.
221+
@async
222+
@private **/
223+
function quux () {}
219224
````
220225

src/rules/emptyTags.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ export default iterateJsdoc(({
4242
settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);
4343
});
4444

45-
for (const tag of emptyTags) {
45+
for (const [key, tag] of emptyTags.entries()) {
4646
const content = tag.name || tag.description || tag.type;
47-
if (content.trim()) {
47+
if (content.trim() && (
48+
// Allow for JSDoc-block final asterisks
49+
key !== emptyTags.length - 1 || !(/^\s*\*+$/u).test(content)
50+
)) {
4851
const fix = () => {
4952
// By time of call in fixer, `tag` will have `line` added
5053
utils.setTag(

test/rules/assertions/emptyTags.js

+8
Original file line numberDiff line numberDiff line change
@@ -308,5 +308,13 @@ export default /** @type {import('../index.js').TestCases} */ ({
308308
function quux () {}
309309
`,
310310
},
311+
{
312+
code: `
313+
/** Application boot function.
314+
@async
315+
@private **/
316+
function quux () {}
317+
`,
318+
},
311319
],
312320
});

0 commit comments

Comments
 (0)