Skip to content

Commit 139d9b7

Browse files
committed
Revert "fix(require-description-complete-sentence): report bare punctuation; fixes #573"
This reverts commit b418dbd.
1 parent b418dbd commit 139d9b7

File tree

3 files changed

+5
-55
lines changed

3 files changed

+5
-55
lines changed

README.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11296,14 +11296,6 @@ function quux (foo) {
1129611296
}
1129711297
// "jsdoc/require-description-complete-sentence": ["error"|"warn", {"tags":["template"]}]
1129811298
// Message: Sentence should start with an uppercase character.
11299-
11300-
/**
11301-
* Just a component.
11302-
* @param {Object} props Свойства.
11303-
* @return {ReactElement}.
11304-
*/
11305-
function quux () {}
11306-
// Message: Sentence must be more than punctuation.
1130711299
````
1130811300

1130911301
The following patterns are not considered problems:
@@ -11363,7 +11355,7 @@ function quux () {
1136311355
}
1136411356

1136511357
/**
11366-
* Foo {@see Math.sin}.
11358+
* Foo. {@see Math.sin}.
1136711359
*/
1136811360
function quux () {
1136911361

@@ -11635,13 +11627,6 @@ export default (foo) => {
1163511627

1163611628
/** @file To learn more,
1163711629
* see: https://github.com/d3/d3-ease. */
11638-
11639-
/**
11640-
* This is a complete sentence...
11641-
*/
11642-
function quux () {
11643-
11644-
}
1164511630
````
1164611631

1164711632

src/rules/requireDescriptionCompleteSentence.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,15 @@ const extractSentences = (text, abbreviationsRegex) => {
2424

2525
const sentenceEndGrouping = /([.?!])(?:\s+|$)/ug;
2626

27-
const puncts = [
28-
...txt.matchAll(sentenceEndGrouping),
29-
].map((sentEnd) => {
30-
return sentEnd[0];
31-
});
27+
const puncts = txt.matchAll(sentenceEndGrouping);
3228

3329
return txt
30+
3431
.split(/[.?!](?:\s+|$)/u)
3532

3633
// Re-add the dot.
3734
.map((sentence, idx) => {
38-
return !puncts[idx] && /^\s*$/u.test(sentence) ? sentence : `${sentence}${puncts[idx] || ''}`;
35+
return /^\s*$/u.test(sentence) ? sentence : `${sentence}${puncts[idx] || ''}`;
3936
});
4037
};
4138

@@ -121,12 +118,6 @@ const validateDescription = (
121118
reportOrig(msg, fixer, tagObj);
122119
};
123120

124-
if (sentences.some((sentence) => {
125-
return (/^[.?!]$/u).test(sentence);
126-
})) {
127-
report('Sentence must be more than punctuation.', null, tag);
128-
}
129-
130121
if (sentences.some((sentence) => {
131122
return !(/^\s*$/u).test(sentence) && !isCapitalized(sentence) && !isTable(sentence);
132123
})) {

test/rules/assertions/requireDescriptionCompleteSentence.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -951,22 +951,6 @@ export default {
951951
}
952952
`,
953953
},
954-
{
955-
code: `
956-
/**
957-
* Just a component.
958-
* @param {Object} props Свойства.
959-
* @return {ReactElement}.
960-
*/
961-
function quux () {}
962-
`,
963-
errors: [
964-
{
965-
line: 5,
966-
message: 'Sentence must be more than punctuation.',
967-
},
968-
],
969-
},
970954
],
971955
valid: [
972956
{
@@ -1047,7 +1031,7 @@ export default {
10471031
{
10481032
code: `
10491033
/**
1050-
* Foo {@see Math.sin}.
1034+
* Foo. {@see Math.sin}.
10511035
*/
10521036
function quux () {
10531037
@@ -1504,15 +1488,5 @@ export default {
15041488
`,
15051489
ignoreReadme: true,
15061490
},
1507-
{
1508-
code: `
1509-
/**
1510-
* This is a complete sentence...
1511-
*/
1512-
function quux () {
1513-
1514-
}
1515-
`,
1516-
},
15171491
],
15181492
};

0 commit comments

Comments
 (0)