File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9942,6 +9942,12 @@ Defaults to `true`.
99429942The following patterns are considered problems:
99439943
99449944````js
9945+ requestAnimationFrame(draw)
9946+
9947+ function bench() {
9948+ }
9949+ // Message: Missing JSDoc comment.
9950+
99459951function quux (foo) {
99469952
99479953}
Original file line number Diff line number Diff line change @@ -32,8 +32,7 @@ const getDecorator = (token, sourceCode) => {
3232 if ( tokenBefore && tokenBefore . type === 'Punctuator' ) {
3333 if ( tokenBefore . value === tokenClose ) {
3434 nested ++ ;
35- }
36- if ( tokenBefore . value === tokenOpen ) {
35+ } else if ( tokenBefore . value === tokenOpen ) {
3736 if ( nested ) {
3837 nested -- ;
3938 } else {
@@ -43,18 +42,16 @@ const getDecorator = (token, sourceCode) => {
4342 }
4443 } while ( tokenBefore ) ;
4544
46- return tokenBefore ;
45+ return getDecorator ( tokenBefore , sourceCode ) ;
4746 }
48- }
49-
50- if ( token . type === 'Identifier' ) {
51- const tokenBefore = sourceCode . getTokenBefore ( token , { includeComments : true } ) ;
52- if ( tokenBefore && tokenBefore . type === 'Punctuator' && tokenBefore . value === '@' ) {
53- return tokenBefore ;
47+ if ( token . value === '@' ) {
48+ return token ;
5449 }
5550 }
5651
57- return false ;
52+ const tokenBfr = sourceCode . getTokenBefore ( token , { includeComments : true } ) ;
53+
54+ return getDecorator ( tokenBfr , sourceCode ) ;
5855} ;
5956
6057/**
Original file line number Diff line number Diff line change @@ -6,6 +6,26 @@ export default {
66 invalid : [
77 {
88 code : `
9+ requestAnimationFrame(draw)
10+
11+ function bench() {
12+ }
13+ ` ,
14+ errors : [ {
15+ message : 'Missing JSDoc comment.' ,
16+ } ] ,
17+ output : `
18+ requestAnimationFrame(draw)
19+
20+ /**
21+ *
22+ */
23+ function bench() {
24+ }
25+ ` ,
26+ } ,
27+ {
28+ code : `
929function quux (foo) {
1030
1131}` ,
You can’t perform that action at this time.
0 commit comments