mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-10 09:58:50 +01:00
Update dependencies: @types/node to 11.12.0, eslint to 5.15.3, js-yaml to 3.13.0, typescript to 3.3.4000, uglify-js to 3.5.2.
This commit is contained in:
parent
9b9532e163
commit
ec35833751
6 changed files with 87 additions and 307 deletions
|
|
@ -74,7 +74,7 @@ function validateRuleList(ruleList) {
|
|||
// Class for results with toString for pretty display
|
||||
function newResults(ruleList) {
|
||||
function Results() {}
|
||||
Results.prototype.toString = function resultsToString(useAlias) {
|
||||
Results.prototype.toString = function toString(useAlias) {
|
||||
const that = this;
|
||||
let ruleNameToRule = null;
|
||||
const results = [];
|
||||
|
|
@ -415,7 +415,7 @@ function lintContent(
|
|||
return callback(ex);
|
||||
}
|
||||
shared.makeTokenCache(null);
|
||||
callback(null, result);
|
||||
return callback(null, result);
|
||||
}
|
||||
|
||||
// Lints a single file
|
||||
|
|
@ -433,7 +433,7 @@ function lintFile(
|
|||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
lintContent(ruleList, file, content, md, config, frontMatter,
|
||||
return lintContent(ruleList, file, content, md, config, frontMatter,
|
||||
noInlineConfig, resultVersion, callback);
|
||||
}
|
||||
// Make a/synchronous call to read file
|
||||
|
|
@ -476,6 +476,7 @@ function lintInput(options, synchronous, callback) {
|
|||
});
|
||||
const results = newResults(ruleList);
|
||||
// Helper to lint the next string or file
|
||||
/* eslint-disable consistent-return */
|
||||
function lintNextItem() {
|
||||
let iterating = true;
|
||||
let item = null;
|
||||
|
|
@ -485,9 +486,7 @@ function lintInput(options, synchronous, callback) {
|
|||
return callback(err);
|
||||
}
|
||||
results[item] = result;
|
||||
if (!iterating) {
|
||||
lintNextItem();
|
||||
}
|
||||
return iterating || lintNextItem();
|
||||
}
|
||||
while (iterating) {
|
||||
if ((item = stringsKeys.shift())) {
|
||||
|
|
@ -518,7 +517,7 @@ function lintInput(options, synchronous, callback) {
|
|||
}
|
||||
}
|
||||
}
|
||||
lintNextItem();
|
||||
return lintNextItem();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -603,15 +602,14 @@ function readConfig(file, parsers, callback) {
|
|||
if (configExtends) {
|
||||
delete config.extends;
|
||||
const extendsFile = path.resolve(path.dirname(file), configExtends);
|
||||
readConfig(extendsFile, parsers, (errr, extendsConfig) => {
|
||||
return readConfig(extendsFile, parsers, (errr, extendsConfig) => {
|
||||
if (errr) {
|
||||
return callback(errr);
|
||||
}
|
||||
callback(null, shared.assign(extendsConfig, config));
|
||||
return callback(null, shared.assign(extendsConfig, config));
|
||||
});
|
||||
} else {
|
||||
callback(null, config);
|
||||
}
|
||||
return callback(null, config);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ module.exports.includesSorted = function includesSorted(array, element) {
|
|||
let left = 0;
|
||||
let right = array.length - 1;
|
||||
while (left <= right) {
|
||||
/* eslint-disable no-bitwise */
|
||||
const mid = (left + right) >> 1;
|
||||
if (array[mid] < element) {
|
||||
left = mid + 1;
|
||||
|
|
@ -144,10 +145,10 @@ module.exports.headingStyleFor = function headingStyleFor(token) {
|
|||
};
|
||||
|
||||
// Calls the provided function for each matching token
|
||||
function filterTokens(params, type, callback) {
|
||||
function filterTokens(params, type, handler) {
|
||||
params.tokens.forEach(function forToken(token) {
|
||||
if (token.type === type) {
|
||||
callback(token);
|
||||
handler(token);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -234,24 +235,24 @@ module.exports.makeTokenCache = makeTokenCache;
|
|||
module.exports.forEachLine = function forEachLine(callback) {
|
||||
tokenCache.lineMetadata.forEach(function forMetadata(metadata) {
|
||||
// Parameters: line, lineIndex, inCode, onFence, inTable
|
||||
callback.apply(this, metadata);
|
||||
callback(...metadata);
|
||||
});
|
||||
};
|
||||
|
||||
// Calls the provided function for each specified inline child token
|
||||
module.exports.forEachInlineChild =
|
||||
function forEachInlineChild(params, type, callback) {
|
||||
function forEachInlineChild(params, type, handler) {
|
||||
filterTokens(params, "inline", function forToken(token) {
|
||||
token.children.forEach(function forChild(child) {
|
||||
if (child.type === type) {
|
||||
callback(child, token);
|
||||
handler(child, token);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Calls the provided function for each heading's content
|
||||
module.exports.forEachHeading = function forEachHeading(params, callback) {
|
||||
module.exports.forEachHeading = function forEachHeading(params, handler) {
|
||||
let heading = null;
|
||||
params.tokens.forEach(function forToken(token) {
|
||||
if (token.type === "heading_open") {
|
||||
|
|
@ -259,14 +260,14 @@ module.exports.forEachHeading = function forEachHeading(params, callback) {
|
|||
} else if (token.type === "heading_close") {
|
||||
heading = null;
|
||||
} else if ((token.type === "inline") && heading) {
|
||||
callback(heading, token.content);
|
||||
handler(heading, token.content);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Calls the provided function for each inline code span's content
|
||||
module.exports.forEachInlineCodeSpan =
|
||||
function forEachInlineCodeSpan(input, callback) {
|
||||
function forEachInlineCodeSpan(input, handler) {
|
||||
let currentLine = 0;
|
||||
let currentColumn = 0;
|
||||
let index = 0;
|
||||
|
|
@ -290,7 +291,7 @@ module.exports.forEachInlineCodeSpan =
|
|||
(startColumn >= 0) &&
|
||||
(tickCount === currentTicks)) {
|
||||
// Found end backticks; invoke callback for code span
|
||||
callback(
|
||||
handler(
|
||||
input.substring(startIndex, index - currentTicks),
|
||||
startLine, startColumn, tickCount);
|
||||
startIndex = -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue