Skip to content

Commit 45b7b50

Browse files
committed
Lint unknown tags
1 parent 11a7758 commit 45b7b50

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/parse.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,13 @@ function parseJSDoc(comment, loc, context) {
296296
for (var j = 0; j < tag.errors.length; j++) {
297297
result.errors.push({message: tag.errors[j]});
298298
}
299+
} else if (flatteners[tag.title]) {
300+
flatteners[tag.title](result, tag, tag.title);
299301
} else {
300-
(flatteners[tag.title] || function () {})(result, tag, tag.title);
302+
result.errors.push({
303+
message: 'unknown tag @' + tag.title,
304+
commentLineNumber: tag.lineNumber
305+
});
301306
}
302307
});
303308

test/lib/parse.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,3 +570,14 @@ test('parse - @version', function (t) {
570570
test('parse - @virtual', function (t) {
571571
t.end();
572572
});
573+
574+
test('parse - unknown tag', function (t) {
575+
t.deepEqual(evaluate(function () {
576+
/** @unknown */
577+
})[0].errors[0], {
578+
message: 'unknown tag @unknown',
579+
commentLineNumber: 0
580+
});
581+
582+
t.end();
583+
});

0 commit comments

Comments
 (0)