Skip to content

Commit 3d61126

Browse files
committed
fix(newline-after-description): only treat comments with whitespace after two asterisks only as jsdoc
Per jsdoc spec at https://jsdoc.app/about-getting-started.html : > Each comment must start with a /** sequence in order to be recognized by the JSDoc parser. Comments beginning with /*, /***, or more than 3 stars will be ignored.
1 parent e453b2d commit 3d61126

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ report a padding issue:
11111111
The following patterns are considered problems:
11121112

11131113
````js
1114-
/*** foo */
1114+
/** foo */
11151115
function quux () {
11161116

11171117
}
@@ -4446,6 +4446,14 @@ function quux () {
44464446
* abc 
44474447
* @bar 
44484448
*/
4449+
4450+
/***
4451+
*
4452+
*/
4453+
function quux () {
4454+
4455+
}
4456+
// Options: ["always"]
44494457
````
44504458
44514459

src/iterateJsdoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ const iterateAllJsdocs = (iterator, ruleConfig) => {
431431
const comments = sourceCode.getAllComments();
432432

433433
comments.forEach((comment) => {
434-
if (!sourceCode.getText(comment).startsWith('/**')) {
434+
if (!(/\/\*\*\s/).test(sourceCode.getText(comment))) {
435435
return;
436436
}
437437

test/rules/assertions/checkIndentation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default {
22
invalid: [
33
{
44
code: `
5-
/*** foo */
5+
/** foo */
66
function quux () {
77
88
}

test/rules/assertions/newlineAfterDescription.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,5 +287,17 @@ export default {
287287
*/\r
288288
`,
289289
},
290+
{
291+
code: `
292+
/***
293+
*
294+
*/
295+
function quux () {
296+
297+
}`,
298+
options: [
299+
'always',
300+
],
301+
},
290302
],
291303
};

0 commit comments

Comments
 (0)