Skip to content

Commit b0d2d3a

Browse files
Included nest module to the lint documentation.
Check on parent element: foo.bar sub-parametr should be documeted with parent. Fixed documentationjs#832 issue
1 parent 15239d1 commit b0d2d3a

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

__tests__/lib/lint.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ test('lintComments', function() {
2828
{ message: 'Missing or invalid tag name' }
2929
]);
3030

31+
expect(
32+
evaluate(function() {
33+
/**
34+
* @param {Object} foo.bar
35+
*/
36+
}).errors
37+
).toEqual([{ message: 'Parent of foo.bar not found' }]);
38+
3139
expect(
3240
evaluate(function() {
3341
/**

src/lint.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var VFile = require('vfile');
44
import { walk } from './walk';
55
import vfileSort from 'vfile-sort';
66
import reporter from 'vfile-reporter';
7+
import nest from './nest';
78

89
var CANONICAL = {
910
String: 'string',
@@ -27,11 +28,8 @@ function lintComments(comment: Comment) {
2728
function nameInvariant(name) {
2829
if (name && typeof CANONICAL[name] === 'string') {
2930
comment.errors.push({
30-
message: 'type ' +
31-
name +
32-
' found, ' +
33-
CANONICAL[name] +
34-
' is standard',
31+
message:
32+
'type ' + name + ' found, ' + CANONICAL[name] + ' is standard',
3533
commentLineNumber: tag.lineNumber
3634
});
3735
}
@@ -60,6 +58,13 @@ function lintComments(comment: Comment) {
6058
checkCanonical(tag.type);
6159
}
6260
});
61+
62+
try {
63+
nest(comment);
64+
} catch (error) {
65+
comment.errors.push({ message: error.message });
66+
}
67+
6368
return comment;
6469
}
6570

0 commit comments

Comments
 (0)