Skip to content

Commit

Permalink
Merge branch 'main' into update-node-engine
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus authored Apr 20, 2023
2 parents 217264f + ef02d5b commit 57acf66
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12329,6 +12329,9 @@ export default (foo) => {
/** @file To learn more,
* see: https://github.com/d3/d3-ease. */

/** To learn more,
* see: https://github.com/d3/d3-ease. */

/**
* This is a complete sentence...
*/
Expand Down Expand Up @@ -23488,6 +23491,15 @@ function processSass (input) {
function updateIconButton () {
}
// "jsdoc/tag-lines": ["error"|"warn", "never",{"startLines":1}]

/** A class. */
class _Foo {
/** @param arg Argument. */
conststructor(arg: string) {
console.log(arg);
}
}
// "jsdoc/tag-lines": ["error"|"warn", "any",{"startLines":1}]
````


Expand Down
9 changes: 7 additions & 2 deletions src/iterateJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,23 +229,28 @@ const getUtils = (
utils.getDescription = () => {
const descriptions = [];
let lastDescriptionLine = 0;
let tagsBegun = false;
jsdoc.source.some(({
tokens: {
description,
tag,
end,
},
}, idx) => {
if (tag) {
tagsBegun = true;
}

if (idx && (tag || end)) {
lastDescriptionLine = idx - 1;
if (!tag && description) {
if (!tagsBegun && description) {
descriptions.push(description);
}

return true;
}

if (idx || description) {
if (!tagsBegun && (idx || description)) {
descriptions.push(description || (descriptions.length ? '' : '\n'));
}

Expand Down
6 changes: 6 additions & 0 deletions test/rules/assertions/requireDescriptionCompleteSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,12 @@ export default {
* see: https://github.com/d3/d3-ease. */
`,
},
{
code: `
/** To learn more,
* see: https://github.com/d3/d3-ease. */
`,
},
{
code: `
/**
Expand Down
18 changes: 18 additions & 0 deletions test/rules/assertions/tagLines.js
Original file line number Diff line number Diff line change
Expand Up @@ -1139,5 +1139,23 @@ export default {
},
],
},
{
code: `
/** A class. */
class _Foo {
/** @param arg Argument. */
conststructor(arg: string) {
console.log(arg);
}
}
`,
options: [
'any',
{
startLines: 1,
},
],
parser: require.resolve('@typescript-eslint/parser'),
},
],
};

0 comments on commit 57acf66

Please sign in to comment.