Skip to content

Commit e9e4440

Browse files
committed
fix(require-description-complete-sentence): avoid triggering punctuation warning after Markdown headings; fixes #1220
1 parent fb3e0e6 commit e9e4440

5 files changed

+45
-1
lines changed

docs/rules/match-name.md

+7
Original file line numberDiff line numberDiff line change
@@ -245,5 +245,12 @@ class A {
245245
* @param {Foo|Bar} opt_b
246246
*/
247247
// "jsdoc/match-name": ["error"|"warn", {"match":[{"comment":"JsdocBlock:has(JsdocTag[tag=\"param\"]:has(JsdocTypeUnion:has(JsdocTypeName[value=\"Bar\"]:nth-child(1))))","disallowName":"/^opt_/i"}]}]
248+
249+
/**
250+
* @template {string} [T=typeof FOO]
251+
* @typedef {object} Test
252+
* @property {T} test
253+
*/
254+
// "jsdoc/match-name": ["error"|"warn", {"match":[{"allowName":"/^[A-Z]{1}$/","message":"The name should be a single capital letter.","tags":["template"]}]}]
248255
````
249256

docs/rules/require-description-complete-sentence.md

+12
Original file line numberDiff line numberDiff line change
@@ -829,5 +829,17 @@ function quux () {
829829
* @param parameter
830830
*/
831831
const code = (parameter) => 123;
832+
833+
/**
834+
* ### Overview
835+
* My class is doing.
836+
*
837+
* ### Example
838+
* ```javascript
839+
* const toto = 'toto';
840+
* ```
841+
*/
842+
export class ClassExemple {
843+
}
832844
````
833845

docs/rules/require-yields.md

+6
Original file line numberDiff line numberDiff line change
@@ -796,5 +796,11 @@ function * quux (foo) {
796796
yield foo;
797797
}
798798
}
799+
800+
/**
801+
*
802+
*/
803+
export { foo } from "bar"
804+
// "jsdoc/require-yields": ["error"|"warn", {"contexts":["ExportNamedDeclaration"]}]
799805
````
800806

src/rules/requireDescriptionCompleteSentence.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ const validateDescription = (
192192

193193
const paragraphNoAbbreviations = paragraph.replace(abbreviationsRegex, '');
194194

195-
if (!/(?:[.?!|]|```)\s*$/u.test(paragraphNoAbbreviations)) {
195+
if (
196+
!/(?:[.?!|]|```)\s*$/u.test(paragraphNoAbbreviations) &&
197+
!paragraphNoAbbreviations.startsWith('#')
198+
) {
196199
report('Sentences must end with a period.', fix, tag);
197200
return true;
198201
}

test/rules/assertions/requireDescriptionCompleteSentence.js

+16
Original file line numberDiff line numberDiff line change
@@ -1591,5 +1591,21 @@ export default {
15911591
const code = (parameter) => 123;
15921592
`,
15931593
},
1594+
{
1595+
code: `
1596+
/**
1597+
* ### Overview
1598+
* My class is doing.
1599+
*
1600+
* ### Example
1601+
* \`\`\`javascript
1602+
* const toto = 'toto';
1603+
* \`\`\`
1604+
*/
1605+
export class ClassExemple {
1606+
}
1607+
1608+
`,
1609+
},
15941610
],
15951611
};

0 commit comments

Comments
 (0)