Skip to content

Commit

Permalink
fix(informative-docs): trim description text
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg authored and brettz9 committed Apr 24, 2023
1 parent 597e255 commit f3faa25
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7649,6 +7649,13 @@ function takesOne(param) {}
* takes abc param
*/
function takesOne(param) {}

/**
* @class
*
* @param {number} value - Some useful text
*/
function MyAmazingThing(value) {}
````


Expand Down
3 changes: 2 additions & 1 deletion src/rules/informativeDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export default iterateJsdoc(({
const nodeNames = getNamesFromNode(node);

const descriptionIsRedundant = (text, extraName = '') => {
return Boolean(text) && !areDocsInformative(text, [
const textTrimmed = text.trim();
return Boolean(textTrimmed) && !areDocsInformative(textTrimmed, [
extraName, nodeNames,
].filter(Boolean).join(' '), {
aliases,
Expand Down
10 changes: 10 additions & 0 deletions test/rules/assertions/informativeDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -749,5 +749,15 @@ export default {
function takesOne(param) {}
`,
},
{
code: `
/**
* @class
*
* @param {number} value - Some useful text
*/
function MyAmazingThing(value) {}
`,
},
],
};

0 comments on commit f3faa25

Please sign in to comment.