File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ function lintComments(comment) {
34
34
}
35
35
}
36
36
37
+ function checkEmptyExample ( tag ) {
38
+ if ( ! tag . description ) {
39
+ comment . errors . push ( {
40
+ message : 'empty example is found' ,
41
+ commentLineNumber : tag . lineNumber
42
+ } ) ;
43
+ }
44
+ }
45
+
37
46
function checkCanonical ( type ) {
38
47
if ( type . type === 'NameExpression' ) {
39
48
nameInvariant ( type . name ) ;
@@ -51,6 +60,10 @@ function lintComments(comment) {
51
60
if ( tag . title === 'param' && tag . type ) {
52
61
checkCanonical ( tag . type ) ;
53
62
}
63
+
64
+ if ( tag . title === 'example' ) {
65
+ checkEmptyExample ( tag ) ;
66
+ }
54
67
} ) ;
55
68
return comment ;
56
69
}
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ var walk = require('../walk'),
14
14
function highlightString ( auto ) {
15
15
return function ( example ) {
16
16
if ( auto ) {
17
- return hljs . highlightAuto ( example ) . value ;
17
+ return hljs . highlightAuto ( example || '' ) . value ;
18
18
}
19
- return hljs . highlight ( 'js' , example ) . value ;
19
+ return hljs . highlight ( 'js' , example || '' ) . value ;
20
20
} ;
21
21
}
22
22
You can’t perform that action at this time.
0 commit comments