File tree Expand file tree Collapse file tree 3 files changed +46
-4
lines changed Expand file tree Collapse file tree 3 files changed +46
-4
lines changed Original file line number Diff line number Diff line change @@ -9853,6 +9853,18 @@ class Foo {
9853
9853
}
9854
9854
}
9855
9855
9856
+ /**
9857
+ * @record
9858
+ */
9859
+ class Foo {
9860
+ /**
9861
+ * @returns {string}
9862
+ */
9863
+ bar () {
9864
+ }
9865
+ }
9866
+ // Settings: {"jsdoc":{"mode":"closure"}}
9867
+
9856
9868
/**
9857
9869
* @returns {undefined} Foo.
9858
9870
*/
Original file line number Diff line number Diff line change 1
1
import iterateJsdoc from '../iterateJsdoc' ;
2
2
3
- const canSkip = ( utils ) => {
4
- return utils . hasATag ( [
3
+ const canSkip = ( utils , settings ) => {
4
+ const voidingTags = [
5
5
// An abstract function is by definition incomplete
6
6
// so it is perfectly fine if a return is documented but
7
7
// not present within the function.
@@ -15,14 +15,25 @@ const canSkip = (utils) => {
15
15
'class' ,
16
16
'constructor' ,
17
17
'interface' ,
18
- ] ) || utils . isConstructor ( ) || utils . classHasTag ( 'interface' ) ;
18
+ ] ;
19
+
20
+ if ( settings . mode === 'closure' ) {
21
+ // Structural Interface in GCC terms, equivalent to @interface tag as far as this rule is concerned
22
+ voidingTags . push ( 'record' ) ;
23
+ }
24
+
25
+ return utils . hasATag ( voidingTags ) ||
26
+ utils . isConstructor ( ) ||
27
+ utils . classHasTag ( 'interface' ) ||
28
+ settings . mode === 'closure' && utils . classHasTag ( 'record' ) ;
19
29
} ;
20
30
21
31
export default iterateJsdoc ( ( {
22
32
report,
33
+ settings,
23
34
utils,
24
35
} ) => {
25
- if ( canSkip ( utils ) ) {
36
+ if ( canSkip ( utils , settings ) ) {
26
37
return ;
27
38
}
28
39
Original file line number Diff line number Diff line change @@ -298,6 +298,25 @@ export default {
298
298
}
299
299
` ,
300
300
} ,
301
+ {
302
+ code : `
303
+ /**
304
+ * @record
305
+ */
306
+ class Foo {
307
+ /**
308
+ * @returns {string}
309
+ */
310
+ bar () {
311
+ }
312
+ }
313
+ ` ,
314
+ settings : {
315
+ jsdoc : {
316
+ mode : 'closure' ,
317
+ } ,
318
+ } ,
319
+ } ,
301
320
{
302
321
code : `
303
322
/**
You can’t perform that action at this time.
0 commit comments