Update to version 0.17.1.

This commit is contained in:
David Anson 2019-10-19 17:55:10 -07:00
parent 26267d18bd
commit 61f6df7c83
4 changed files with 27 additions and 16 deletions

View file

@ -806,6 +806,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
* 0.17.0 - Add `resultVersion` 3 to support fix information for default and custom rules, * 0.17.0 - Add `resultVersion` 3 to support fix information for default and custom rules,
add fix information for 24 rules, update newline handling to match latest add fix information for 24 rules, update newline handling to match latest
CommonMark specification, improve MD014/MD037/MD039, update dependencies. CommonMark specification, improve MD014/MD037/MD039, update dependencies.
* 0.17.1 - Fix handling of front matter by fix information.
[npm-image]: https://img.shields.io/npm/v/markdownlint.svg [npm-image]: https://img.shields.io/npm/v/markdownlint.svg
[npm-url]: https://www.npmjs.com/package/markdownlint [npm-url]: https://www.npmjs.com/package/markdownlint

View file

@ -911,42 +911,52 @@ function lintContent(ruleList, name, content, md, config, frontMatter, handleRul
throwError("range"); throwError("range");
} }
var fixInfo = errorInfo.fixInfo; var fixInfo = errorInfo.fixInfo;
var cleanFixInfo = {};
if (fixInfo) { if (fixInfo) {
if (!helpers.isObject(fixInfo)) { if (!helpers.isObject(fixInfo)) {
throwError("fixInfo"); throwError("fixInfo");
} }
if ((fixInfo.lineNumber !== undefined) && if (fixInfo.lineNumber !== undefined) {
(!helpers.isNumber(fixInfo.lineNumber) || if ((!helpers.isNumber(fixInfo.lineNumber) ||
(fixInfo.lineNumber < 1) || (fixInfo.lineNumber < 1) ||
(fixInfo.lineNumber > lines.length))) { (fixInfo.lineNumber > lines.length))) {
throwError("fixInfo.lineNumber"); throwError("fixInfo.lineNumber");
} }
cleanFixInfo.lineNumber =
fixInfo.lineNumber + frontMatterLines.length;
}
var effectiveLineNumber = fixInfo.lineNumber || errorInfo.lineNumber; var effectiveLineNumber = fixInfo.lineNumber || errorInfo.lineNumber;
if ((fixInfo.editColumn !== undefined) && if (fixInfo.editColumn !== undefined) {
(!helpers.isNumber(fixInfo.editColumn) || if ((!helpers.isNumber(fixInfo.editColumn) ||
(fixInfo.editColumn < 1) || (fixInfo.editColumn < 1) ||
(fixInfo.editColumn > (fixInfo.editColumn >
lines[effectiveLineNumber - 1].length + 1))) { lines[effectiveLineNumber - 1].length + 1))) {
throwError("fixInfo.editColumn"); throwError("fixInfo.editColumn");
} }
if ((fixInfo.deleteCount !== undefined) && cleanFixInfo.editColumn = fixInfo.editColumn;
(!helpers.isNumber(fixInfo.deleteCount) || }
if (fixInfo.deleteCount !== undefined) {
if ((!helpers.isNumber(fixInfo.deleteCount) ||
(fixInfo.deleteCount < -1) || (fixInfo.deleteCount < -1) ||
(fixInfo.deleteCount > (fixInfo.deleteCount >
lines[effectiveLineNumber - 1].length))) { lines[effectiveLineNumber - 1].length))) {
throwError("fixInfo.deleteCount"); throwError("fixInfo.deleteCount");
} }
if ((fixInfo.insertText !== undefined) && cleanFixInfo.deleteCount = fixInfo.deleteCount;
!helpers.isString(fixInfo.insertText)) { }
if (fixInfo.insertText !== undefined) {
if (!helpers.isString(fixInfo.insertText)) {
throwError("fixInfo.insertText"); throwError("fixInfo.insertText");
} }
cleanFixInfo.insertText = fixInfo.insertText;
}
} }
errors.push({ errors.push({
"lineNumber": errorInfo.lineNumber + frontMatterLines.length, "lineNumber": errorInfo.lineNumber + frontMatterLines.length,
"detail": errorInfo.detail || null, "detail": errorInfo.detail || null,
"context": errorInfo.context || null, "context": errorInfo.context || null,
"range": errorInfo.range || null, "range": errorInfo.range || null,
"fixInfo": errorInfo.fixInfo || null "fixInfo": fixInfo ? cleanFixInfo : null
}); });
} }
// Call (possibly external) rule function // Call (possibly external) rule function
@ -2786,7 +2796,7 @@ module.exports = rules;
},{"../package.json":49,"./md001":5,"./md002":6,"./md003":7,"./md004":8,"./md005":9,"./md006":10,"./md007":11,"./md009":12,"./md010":13,"./md011":14,"./md012":15,"./md013":16,"./md014":17,"./md018":18,"./md019":19,"./md020":20,"./md021":21,"./md022":22,"./md023":23,"./md024":24,"./md025":25,"./md026":26,"./md027":27,"./md028":28,"./md029":29,"./md030":30,"./md031":31,"./md032":32,"./md033":33,"./md034":34,"./md035":35,"./md036":36,"./md037":37,"./md038":38,"./md039":39,"./md040":40,"./md041":41,"./md042":42,"./md043":43,"./md044":44,"./md045":45,"./md046":46,"./md047":47,"url":58}],49:[function(require,module,exports){ },{"../package.json":49,"./md001":5,"./md002":6,"./md003":7,"./md004":8,"./md005":9,"./md006":10,"./md007":11,"./md009":12,"./md010":13,"./md011":14,"./md012":15,"./md013":16,"./md014":17,"./md018":18,"./md019":19,"./md020":20,"./md021":21,"./md022":22,"./md023":23,"./md024":24,"./md025":25,"./md026":26,"./md027":27,"./md028":28,"./md029":29,"./md030":30,"./md031":31,"./md032":32,"./md033":33,"./md034":34,"./md035":35,"./md036":36,"./md037":37,"./md038":38,"./md039":39,"./md040":40,"./md041":41,"./md042":42,"./md043":43,"./md044":44,"./md045":45,"./md046":46,"./md047":47,"url":58}],49:[function(require,module,exports){
module.exports={ module.exports={
"name": "markdownlint", "name": "markdownlint",
"version": "0.16.0", "version": "0.17.1",
"description": "A Node.js style checker and lint tool for Markdown/CommonMark files.", "description": "A Node.js style checker and lint tool for Markdown/CommonMark files.",
"main": "lib/markdownlint.js", "main": "lib/markdownlint.js",
"author": "David Anson (https://dlaa.me/)", "author": "David Anson (https://dlaa.me/)",

View file

@ -1,5 +1,5 @@
CACHE MANIFEST CACHE MANIFEST
# 2019-10-04 # 2019-10-19
default.css default.css
default.htm default.htm
default.js default.js

View file

@ -1,6 +1,6 @@
{ {
"name": "markdownlint", "name": "markdownlint",
"version": "0.17.0", "version": "0.17.1",
"description": "A Node.js style checker and lint tool for Markdown/CommonMark files.", "description": "A Node.js style checker and lint tool for Markdown/CommonMark files.",
"main": "lib/markdownlint.js", "main": "lib/markdownlint.js",
"author": "David Anson (https://dlaa.me/)", "author": "David Anson (https://dlaa.me/)",