Skip to content

Commit f3faa25

Browse files
JoshuaKGoldbergbrettz9
authored andcommitted
fix(informative-docs): trim description text
1 parent 597e255 commit f3faa25

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7649,6 +7649,13 @@ function takesOne(param) {}
76497649
* takes abc param
76507650
*/
76517651
function takesOne(param) {}
7652+
7653+
/**
7654+
* @class
7655+
*
7656+
* @param {number} value - Some useful text
7657+
*/
7658+
function MyAmazingThing(value) {}
76527659
````
76537660

76547661

src/rules/informativeDocs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export default iterateJsdoc(({
7070
const nodeNames = getNamesFromNode(node);
7171

7272
const descriptionIsRedundant = (text, extraName = '') => {
73-
return Boolean(text) && !areDocsInformative(text, [
73+
const textTrimmed = text.trim();
74+
return Boolean(textTrimmed) && !areDocsInformative(textTrimmed, [
7475
extraName, nodeNames,
7576
].filter(Boolean).join(' '), {
7677
aliases,

test/rules/assertions/informativeDocs.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,5 +749,15 @@ export default {
749749
function takesOne(param) {}
750750
`,
751751
},
752+
{
753+
code: `
754+
/**
755+
* @class
756+
*
757+
* @param {number} value - Some useful text
758+
*/
759+
function MyAmazingThing(value) {}
760+
`,
761+
},
752762
],
753763
};

0 commit comments

Comments
 (0)