Skip to content

Commit

Permalink
fix(require-description-complete-sentence): allow all inline tags a…
Browse files Browse the repository at this point in the history
…t beginning of sentence; fixes #1150
  • Loading branch information
brettz9 committed Sep 15, 2023
1 parent 8dbcb6f commit e8b1475
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion docs/rules/require-description-complete-sentence.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function quux (foo) {
function quux (foo) {

}
// Message: Sentences should start with an uppercase character.
// Message: Sentences must end with a period.

/**
* Foo.
Expand Down Expand Up @@ -816,5 +816,7 @@ function quux () {}
function quux () {

}

/** @param options {@link RequestOptions} specifying path parameters and query parameters. */
````

2 changes: 1 addition & 1 deletion src/rules/requireDescriptionCompleteSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const extractParagraphs = (text) => {
const extractSentences = (text, abbreviationsRegex) => {
const txt = text
// Remove all {} tags.
.replaceAll(/\{[\s\S]*?\}\s*/gu, '')
.replaceAll(/(?<!^)\{[\s\S]*?\}\s*/gu, '')

// Remove custom abbreviations
.replace(abbreviationsRegex, '');
Expand Down
11 changes: 6 additions & 5 deletions test/rules/assertions/requireDescriptionCompleteSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,18 +316,14 @@ export default {
}
`,
errors: [
{
line: 3,
message: 'Sentences should start with an uppercase character.',
},
{
line: 3,
message: 'Sentences must end with a period.',
},
],
output: `
/**
* {@see Foo.bar} Buz.
* {@see Foo.bar} buz.
*/
function quux (foo) {
Expand Down Expand Up @@ -1576,5 +1572,10 @@ export default {
}
`,
},
{
code: `
/** @param options {@link RequestOptions} specifying path parameters and query parameters. */
`,
},
],
};

0 comments on commit e8b1475

Please sign in to comment.