Remove unnecessary params parameter to shared.flattenLists/forEachLine.

This commit is contained in:
David Anson 2018-03-04 23:06:31 -08:00
parent 942cc9af08
commit 748c8cac17
15 changed files with 15 additions and 15 deletions

View file

@ -25,7 +25,7 @@ module.exports = {
var style = params.config.style || "consistent";
var expectedStyle = style;
var nestingStyles = [];
shared.flattenLists(params).forEach(function forList(list) {
shared.flattenLists().forEach(function forList(list) {
if (list.unordered) {
if (expectedStyle === "consistent") {
expectedStyle = unorderedListStyleFor(list.items[0]);

View file

@ -9,7 +9,7 @@ module.exports = {
"description": "Inconsistent indentation for list items at the same level",
"tags": [ "bullet", "ul", "indentation" ],
"function": function MD005(params, onError) {
shared.flattenLists(params).forEach(function forList(list) {
shared.flattenLists().forEach(function forList(list) {
var indent = shared.indentFor(list.items[0]);
list.items.forEach(function forItem(item) {
shared.addErrorDetailIf(onError, item.lineNumber, indent,

View file

@ -10,7 +10,7 @@ module.exports = {
"Consider starting bulleted lists at the beginning of the line",
"tags": [ "bullet", "ul", "indentation" ],
"function": function MD006(params, onError) {
shared.flattenLists(params).forEach(function forList(list) {
shared.flattenLists().forEach(function forList(list) {
if (list.unordered && !list.nesting) {
shared.addErrorDetailIf(onError, list.open.lineNumber,
0, shared.indentFor(list.open), null,

View file

@ -11,7 +11,7 @@ module.exports = {
"function": function MD007(params, onError) {
var optionsIndent = params.config.indent || 2;
var prevIndent = 0;
shared.flattenLists(params).forEach(function forList(list) {
shared.flattenLists().forEach(function forList(list) {
if (list.unordered && list.parentsUnordered) {
var indent = shared.indentFor(list.open);
if (indent > prevIndent) {

View file

@ -23,7 +23,7 @@ module.exports = {
}
});
}
shared.forEachLine(params, function forLine(line, lineIndex) {
shared.forEachLine(function forLine(line, lineIndex) {
var lineNumber = lineIndex + 1;
if (trailingSpaceRe.test(line) &&
(listItemLineNumbers.indexOf(lineNumber) === -1)) {

View file

@ -13,7 +13,7 @@ module.exports = {
"function": function MD010(params, onError) {
var codeBlocks = params.config.code_blocks;
var includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
shared.forEachLine(params, function forLine(line, lineIndex, inCode) {
shared.forEachLine(function forLine(line, lineIndex, inCode) {
if (tabRe.test(line) && (!inCode || includeCodeBlocks)) {
shared.addError(onError, lineIndex + 1,
"Column: " + (line.indexOf("\t") + 1), null,

View file

@ -11,7 +11,7 @@ module.exports = {
"function": function MD012(params, onError) {
var maximum = params.config.maximum || 1;
var count = 0;
shared.forEachLine(params, function forLine(line, lineIndex, inCode) {
shared.forEachLine(function forLine(line, lineIndex, inCode) {
count = (inCode || line.trim().length) ? 0 : count + 1;
if (maximum < count) {
shared.addErrorDetailIf(onError, lineIndex + 1, maximum, count);

View file

@ -46,7 +46,7 @@ module.exports = {
}
});
var longLineRe = new RegExp("^(.{" + lineLength + "})(.*\\s.*)$");
shared.forEachLine(params,
shared.forEachLine(
function forLine(line, lineIndex, inCode, onFence, inTable) {
var lineNumber = lineIndex + 1;
if ((includeCodeBlocks || !inCode) &&

View file

@ -9,7 +9,7 @@ module.exports = {
"description": "No space after hash on atx style header",
"tags": [ "headers", "atx", "spaces" ],
"function": function MD018(params, onError) {
shared.forEachLine(params, function forLine(line, lineIndex, inCode) {
shared.forEachLine(function forLine(line, lineIndex, inCode) {
if (!inCode && /^#+[^#\s]/.test(line) && !/#$/.test(line)) {
shared.addErrorContext(onError, lineIndex + 1, line.trim(), null,
null, shared.rangeFromRegExp(line, shared.atxHeaderSpaceRe));

View file

@ -11,7 +11,7 @@ module.exports = {
"description": "No space inside hashes on closed atx style header",
"tags": [ "headers", "atx_closed", "spaces" ],
"function": function MD020(params, onError) {
shared.forEachLine(params, function forLine(line, lineIndex, inCode) {
shared.forEachLine(function forLine(line, lineIndex, inCode) {
if (!inCode && /^#+[^#]*[^\\]#+$/.test(line)) {
var left = /^#+[^#\s]/.test(line);
var right = /[^#\s]#+$/.test(line);

View file

@ -12,7 +12,7 @@ module.exports = {
"tags": [ "ol" ],
"function": function MD029(params, onError) {
var style = params.config.style || "one_or_ordered";
shared.flattenLists(params).forEach(function forList(list) {
shared.flattenLists().forEach(function forList(list) {
if (!list.unordered) {
var listStyle = style;
if (listStyle === "one_or_ordered") {

View file

@ -13,7 +13,7 @@ module.exports = {
var olSingle = params.config.ol_single || 1;
var ulMulti = params.config.ul_multi || 1;
var olMulti = params.config.ol_multi || 1;
shared.flattenLists(params).forEach(function forList(list) {
shared.flattenLists().forEach(function forList(list) {
var lineCount = list.lastLineIndex - list.open.map[0];
var allSingle = lineCount === list.items.length;
var expectedSpaces = list.unordered ?

View file

@ -10,7 +10,7 @@ module.exports = {
"tags": [ "code", "blank_lines" ],
"function": function MD031(params, onError) {
var lines = params.lines;
shared.forEachLine(params, function forLine(line, i, inCode, onFence) {
shared.forEachLine(function forLine(line, i, inCode, onFence) {
if (((onFence > 0) && (i - 1 >= 0) && lines[i - 1].length) ||
((onFence < 0) && (i + 1 < lines.length) && lines[i + 1].length)) {
shared.addErrorContext(onError, i + 1, lines[i].trim());

View file

@ -14,7 +14,7 @@ module.exports = {
"function": function MD032(params, onError) {
var inList = false;
var prevLine = "";
shared.forEachLine(params,
shared.forEachLine(
function forLine(line, lineIndex, inCode, onFence) {
if (!inCode || onFence) {
var lineTrim = line.trim();

View file

@ -211,7 +211,7 @@ function makeTokenCache(params) {
module.exports.makeTokenCache = makeTokenCache;
// Calls the provided function for each line (with context)
module.exports.forEachLine = function forEachLine(params, callback) {
module.exports.forEachLine = function forEachLine(callback) {
// Invoke callback
tokenCache.params.lines.forEach(function forLine(line, lineIndex) {
var metadata = tokenCache.lineMetadata[lineIndex];