diff --git a/README.md b/README.md index bf4c3d9f9..0f8c271b3 100644 --- a/README.md +++ b/README.md @@ -11296,14 +11296,6 @@ function quux (foo) { } // "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["template"]}] // Message: Sentence should start with an uppercase character. - -/** - * Just a component. - * @param {Object} props Свойства. - * @return {ReactElement}. - */ -function quux () {} -// Message: Sentence must be more than punctuation. ```` The following patterns are not considered problems: @@ -11363,7 +11355,7 @@ function quux () { } /** - * Foo {@see Math.sin}. + * Foo. {@see Math.sin}. */ function quux () { @@ -11635,13 +11627,6 @@ export default (foo) => { /** @file To learn more, * see: https://github.com/d3/d3-ease. */ - -/** - * This is a complete sentence... - */ -function quux () { - -} ```` diff --git a/src/rules/requireDescriptionCompleteSentence.js b/src/rules/requireDescriptionCompleteSentence.js index 8b000e2bb..1888d4e1b 100644 --- a/src/rules/requireDescriptionCompleteSentence.js +++ b/src/rules/requireDescriptionCompleteSentence.js @@ -24,11 +24,7 @@ const extractSentences = (text, abbreviationsRegex) => { const sentenceEndGrouping = /([.?!])(?:\s+|$)/ug; - const puncts = [ - ...txt.matchAll(sentenceEndGrouping), - ].map((sentEnd) => { - return sentEnd[0]; - }); + const puncts = txt.matchAll(sentenceEndGrouping); return txt @@ -36,7 +32,7 @@ const extractSentences = (text, abbreviationsRegex) => { // Re-add the dot. .map((sentence, idx) => { - return !puncts[idx] && /^\s*$/u.test(sentence) ? sentence : `${sentence}${puncts[idx] || ''}`; + return /^\s*$/u.test(sentence) ? sentence : `${sentence}${puncts[idx] || ''}`; }); }; @@ -122,12 +118,6 @@ const validateDescription = ( reportOrig(msg, fixer, tagObj); }; - if (sentences.some((sentence) => { - return (/^[.?!]$/u).test(sentence); - })) { - report('Sentence must be more than punctuation.', null, tag); - } - if (sentences.some((sentence) => { return !(/^\s*$/u).test(sentence) && !isCapitalized(sentence) && !isTable(sentence); })) { diff --git a/test/rules/assertions/requireDescriptionCompleteSentence.js b/test/rules/assertions/requireDescriptionCompleteSentence.js index ad5c29596..dce073c5f 100644 --- a/test/rules/assertions/requireDescriptionCompleteSentence.js +++ b/test/rules/assertions/requireDescriptionCompleteSentence.js @@ -951,22 +951,6 @@ export default { } `, }, - { - code: ` - /** - * Just a component. - * @param {Object} props Свойства. - * @return {ReactElement}. - */ - function quux () {} - `, - errors: [ - { - line: 5, - message: 'Sentence must be more than punctuation.', - }, - ], - }, ], valid: [ { @@ -1047,7 +1031,7 @@ export default { { code: ` /** - * Foo {@see Math.sin}. + * Foo. {@see Math.sin}. */ function quux () { @@ -1504,15 +1488,5 @@ export default { `, ignoreReadme: true, }, - { - code: ` - /** - * This is a complete sentence... - */ - function quux () { - - } - `, - }, ], };