eslint-plugin-jsdoc
Advanced tools
Comparing version
@@ -22,3 +22,3 @@ 'use strict'; | ||
var extractSentences = function extractSentences(text) { | ||
return text.split(/\.\s*/).filter(function (sentence) { | ||
return text.split(/\.\s+|\.$/).filter(function (sentence) { | ||
// Ignore sentences with only whitespaces. | ||
@@ -66,49 +66,52 @@ return !/^\s*$/.test(sentence); | ||
if (_lodash2.default.some(sentences, function (sentence) { | ||
return !isCapitalized(sentence); | ||
})) { | ||
report('Sentence should start with an uppercase character.', function (fixer) { | ||
var text = sourceCode.getText(jsdocNode); | ||
var fix = function fix(fixer) { | ||
var text = sourceCode.getText(jsdocNode); | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
if (!_lodash2.default.endsWith(paragraph, '.')) { | ||
var line = _lodash2.default.last(paragraph.split('\n')); | ||
try { | ||
for (var _iterator = sentences.filter(function (sentence_) { | ||
return !isCapitalized(sentence_); | ||
})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var sentence = _step.value; | ||
text = text.replace(line, line + '.'); | ||
} | ||
var beginning = sentence.split(/\n/)[0]; | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
text = text.replace(beginning, capitalize(beginning)); | ||
try { | ||
for (var _iterator = sentences.filter(function (sentence_) { | ||
return !isCapitalized(sentence_); | ||
})[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var sentence = _step.value; | ||
var beginning = sentence.split('\n')[0]; | ||
text = text.replace(beginning, capitalize(beginning)); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
return fixer.replaceText(jsdocNode, text); | ||
}); | ||
return fixer.replaceText(jsdocNode, text); | ||
}; | ||
if (_lodash2.default.some(sentences, function (sentence) { | ||
return !isCapitalized(sentence); | ||
})) { | ||
report('Sentence should start with an uppercase character.', fix); | ||
} | ||
if (!/\.$/.test(paragraph)) { | ||
report('Sentence must end with a period.', function (fixer) { | ||
var line = _lodash2.default.last(paragraph.split('\n')); | ||
var replacement = sourceCode.getText(jsdocNode).replace(line, line + '.'); | ||
report('Sentence must end with a period.', fix); | ||
return fixer.replaceText(jsdocNode, replacement); | ||
}); | ||
return true; | ||
@@ -115,0 +118,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"author":{"email":"gajus@gajus.com","name":"Gajus Kuizinas","url":"http://gajus.com"},"dependencies":{"comment-parser":"^0.4.2","lodash":"^4.17.4"},"description":"JSDoc linting rules for ESLint.","devDependencies":{"babel-cli":"^6.26.0","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-flow-strip-types":"^6.22.0","babel-preset-env":"^1.6.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.1.2","eslint":"^4.7.2","eslint-config-canonical":"^9.3.1","gitdown":"^2.5.1","globby":"^6.1.0","mocha":"^3.5.3","semantic-release":"^8.0.3"},"engines":{"node":">=4"},"keywords":["eslint","plugin","jsdoc"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"eslint-plugin-jsdoc","peerDependencies":{"eslint":">=0.8.0"},"repository":{"type":"git","url":"https://github.com/gajus/eslint-plugin-jsdoc"},"scripts":{"add-assertions":"babel-node --presets es2015 ./bin/readme-assertions","build":"NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps","generate-readme":"gitdown ./.README/README.md --output-file ./README.md && npm run add-assertions","lint":"eslint ./src ./test","test":"mocha --recursive --compilers js:babel-register"},"version":"3.3.0"} | ||
{"author":{"email":"gajus@gajus.com","name":"Gajus Kuizinas","url":"http://gajus.com"},"dependencies":{"comment-parser":"^0.4.2","lodash":"^4.17.4"},"description":"JSDoc linting rules for ESLint.","devDependencies":{"babel-cli":"^6.26.0","babel-plugin-add-module-exports":"^0.2.1","babel-plugin-transform-flow-strip-types":"^6.22.0","babel-preset-env":"^1.6.0","babel-preset-es2015":"^6.24.1","babel-register":"^6.26.0","chai":"^4.1.2","eslint":"^4.7.2","eslint-config-canonical":"^9.3.1","gitdown":"^2.5.1","globby":"^6.1.0","mocha":"^3.5.3","semantic-release":"^8.0.3"},"engines":{"node":">=4"},"keywords":["eslint","plugin","jsdoc"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"eslint-plugin-jsdoc","peerDependencies":{"eslint":">=0.8.0"},"repository":{"type":"git","url":"https://github.com/gajus/eslint-plugin-jsdoc"},"scripts":{"add-assertions":"babel-node --presets es2015 ./bin/readme-assertions","build":"NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps","generate-readme":"gitdown ./.README/README.md --output-file ./README.md && npm run add-assertions","lint":"eslint ./src ./test","test":"mocha --recursive --compilers js:babel-register"},"version":"3.3.1"} |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
848
0.12%109998
-0.12%