File tree Expand file tree Collapse file tree 2 files changed +52
-2
lines changed Expand file tree Collapse file tree 2 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export default iterateJsdoc(({
30
30
if ( ! descriptionEndsWithANewline ) {
31
31
const sourceLines = sourceCode . getText ( jsdocNode ) . split ( '\n' ) ;
32
32
const lastDescriptionLine = _ . findLastIndex ( sourceLines , ( line ) => {
33
- return line . includes ( _ . last ( jsdoc . description . split ( '\n' ) ) ) ;
33
+ return line . replace ( / ^ \s * \* \s * / , '' ) === _ . last ( jsdoc . description . split ( '\n' ) ) ;
34
34
} ) ;
35
35
report ( 'There must be a newline after the description of the JSDoc block.' , ( fixer ) => {
36
36
// Add the new line
@@ -44,7 +44,7 @@ export default iterateJsdoc(({
44
44
} else if ( descriptionEndsWithANewline ) {
45
45
const sourceLines = sourceCode . getText ( jsdocNode ) . split ( '\n' ) ;
46
46
const lastDescriptionLine = _ . findLastIndex ( sourceLines , ( line ) => {
47
- return line . includes ( _ . last ( jsdoc . description . split ( '\n' ) ) ) ;
47
+ return line . replace ( / ^ \s * \* \s * / , '' ) === _ . last ( jsdoc . description . split ( '\n' ) ) ;
48
48
} ) ;
49
49
report ( 'There must be no newline after the description of the JSDoc block.' , ( fixer ) => {
50
50
// Remove the extra line
Original file line number Diff line number Diff line change @@ -98,6 +98,56 @@ export default {
98
98
99
99
}
100
100
`
101
+ } ,
102
+ {
103
+ code : `
104
+ /**
105
+ * A.
106
+ *
107
+ * @typedef {Object} A
108
+ * @prop {boolean} a A.
109
+ */
110
+ ` ,
111
+ errors : [
112
+ {
113
+ message : 'There must be no newline after the description of the JSDoc block.'
114
+ }
115
+ ] ,
116
+ options : [
117
+ 'never'
118
+ ] ,
119
+ output : `
120
+ /**
121
+ * A.
122
+ * @typedef {Object} A
123
+ * @prop {boolean} a A.
124
+ */
125
+ `
126
+ } ,
127
+ {
128
+ code : `
129
+ /**
130
+ * A.
131
+ * @typedef {Object} A
132
+ * @prop {boolean} a A.
133
+ */
134
+ ` ,
135
+ errors : [
136
+ {
137
+ message : 'There must be a newline after the description of the JSDoc block.'
138
+ }
139
+ ] ,
140
+ options : [
141
+ 'always'
142
+ ] ,
143
+ output : `
144
+ /**
145
+ * A.
146
+ *
147
+ * @typedef {Object} A
148
+ * @prop {boolean} a A.
149
+ */
150
+ `
101
151
}
102
152
] ,
103
153
valid : [
You can’t perform that action at this time.
0 commit comments