Skip to content

Commit

Permalink
changed regex to matchAll
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDryden authored and brettz9 committed Apr 7, 2022
1 parent d36a50b commit c8781d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ os: linux
dist: xenial
language: node_js
node_js:
- "12.22.0"
- "14.17.0"
- "16"
install:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"typescript": "^4.6.3"
},
"engines": {
"node": "^12 || ^14 || ^16 || ^17"
"node": "^14 || ^16 || ^17"
},
"keywords": [
"eslint",
Expand Down
13 changes: 3 additions & 10 deletions src/rules/requireDescriptionCompleteSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,9 @@ const extractSentences = (text, abbreviationsRegex) => {
// Remove custom abbreviations
.replace(abbreviationsRegex, '');

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

const puncts = [];
let matches;
let n0;
let index = 0;
while ((matches = sentenceEndGrouping.exec(txt)) !== null) {
n0 = matches.splice(0, 1);
puncts.push(matches.concat(index++, n0));
}
const sentenceEndGrouping = /([.?!])(?:\s+|$)/ug;

const puncts = txt.matchAll(sentenceEndGrouping);

return txt

Expand Down

0 comments on commit c8781d2

Please sign in to comment.