mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-15 21:40:13 +01:00
Refactor to remove flattenedLists, indentFor, listItemMarkerRe, orderedListItemMarkerRe, rangeFromRegExp, and unorderedListStyleFor helpers, reimplement MD004/MD029 using micromark tokens.
This commit is contained in:
parent
55729cfcf7
commit
7aac5b0553
9 changed files with 318 additions and 482 deletions
|
|
@ -30,10 +30,6 @@ const inlineCommentStartRe =
|
|||
/(<!--\s*markdownlint-(disable|enable|capture|restore|disable-file|enable-file|disable-line|disable-next-line|configure-file))(?:\s|-->)/gi;
|
||||
module.exports.inlineCommentStartRe = inlineCommentStartRe;
|
||||
|
||||
// Regular expressions for range matching
|
||||
module.exports.listItemMarkerRe = /^([\s>]*)(?:[*+-]|\d+[.)])\s+/;
|
||||
module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/;
|
||||
|
||||
// Regular expression for blockquote prefixes
|
||||
const blockquotePrefixRe = /^[>\s]*/;
|
||||
module.exports.blockquotePrefixRe = blockquotePrefixRe;
|
||||
|
|
@ -271,93 +267,6 @@ module.exports.emphasisOrStrongStyleFor =
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the number of characters of indent for a token.
|
||||
*
|
||||
* @param {Object} token MarkdownItToken instance.
|
||||
* @returns {number} Characters of indent.
|
||||
*/
|
||||
function indentFor(token) {
|
||||
const line = token.line.replace(/^[\s>]*(> |>)/, "");
|
||||
return line.length - line.trimStart().length;
|
||||
}
|
||||
module.exports.indentFor = indentFor;
|
||||
|
||||
/**
|
||||
* Return the string representation of an unordered list marker.
|
||||
*
|
||||
* @param {Object} token MarkdownItToken instance.
|
||||
* @returns {"asterisk" | "dash" | "plus"} String representation.
|
||||
*/
|
||||
module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
|
||||
switch (token.markup) {
|
||||
case "-":
|
||||
return "dash";
|
||||
case "+":
|
||||
return "plus";
|
||||
// case "*":
|
||||
default:
|
||||
return "asterisk";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @callback TokenCallback
|
||||
* @param {MarkdownItToken} token Current token.
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
// Returns (nested) lists as a flat array (in order)
|
||||
module.exports.flattenLists = function flattenLists(tokens) {
|
||||
const flattenedLists = [];
|
||||
const stack = [];
|
||||
let current = null;
|
||||
let nesting = 0;
|
||||
const nestingStack = [];
|
||||
let lastWithMap = { "map": [ 0, 1 ] };
|
||||
for (const token of tokens) {
|
||||
if ((token.type === "bullet_list_open") ||
|
||||
(token.type === "ordered_list_open")) {
|
||||
// Save current context and start a new one
|
||||
stack.push(current);
|
||||
current = {
|
||||
"unordered": (token.type === "bullet_list_open"),
|
||||
"parentsUnordered": !current ||
|
||||
(current.unordered && current.parentsUnordered),
|
||||
"open": token,
|
||||
"indent": indentFor(token),
|
||||
"parentIndent": (current && current.indent) || 0,
|
||||
"items": [],
|
||||
"nesting": nesting,
|
||||
"lastLineIndex": -1,
|
||||
"insert": flattenedLists.length
|
||||
};
|
||||
nesting++;
|
||||
} else if ((token.type === "bullet_list_close") ||
|
||||
(token.type === "ordered_list_close")) {
|
||||
// Finalize current context and restore previous
|
||||
current.lastLineIndex = lastWithMap.map[1];
|
||||
flattenedLists.splice(current.insert, 0, current);
|
||||
delete current.insert;
|
||||
current = stack.pop();
|
||||
nesting--;
|
||||
} else if (token.type === "list_item_open") {
|
||||
// Add list item
|
||||
current.items.push(token);
|
||||
} else if (token.type === "blockquote_open") {
|
||||
nestingStack.push(nesting);
|
||||
nesting = 0;
|
||||
} else if (token.type === "blockquote_close") {
|
||||
nesting = nestingStack.pop() || 0;
|
||||
}
|
||||
if (token.map) {
|
||||
// Track last token with map
|
||||
lastWithMap = token;
|
||||
}
|
||||
}
|
||||
return flattenedLists;
|
||||
};
|
||||
|
||||
/**
|
||||
* @callback InlineCodeSpanCallback
|
||||
* @param {string} code Code content.
|
||||
|
|
@ -556,18 +465,6 @@ const withinAnyRange = (ranges, lineIndex, index, length) => (
|
|||
);
|
||||
module.exports.withinAnyRange = withinAnyRange;
|
||||
|
||||
// Returns a range object for a line by applying a RegExp
|
||||
module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) {
|
||||
let range = null;
|
||||
const match = line.match(regexp);
|
||||
if (match) {
|
||||
const column = match.index + 1;
|
||||
const length = match[0].length;
|
||||
range = [ column, length ];
|
||||
}
|
||||
return range;
|
||||
};
|
||||
|
||||
// Determines if the front matter includes a title
|
||||
module.exports.frontMatterHasTitle =
|
||||
function frontMatterHasTitle(frontMatterLines, frontMatterTitlePattern) {
|
||||
|
|
@ -1615,8 +1512,6 @@ module.exports.set = (keyValuePairs) => {
|
|||
};
|
||||
module.exports.clear = () => map.clear();
|
||||
|
||||
module.exports.flattenedLists =
|
||||
() => map.get("flattenedLists");
|
||||
module.exports.referenceLinkImageData =
|
||||
() => map.get("referenceLinkImageData");
|
||||
|
||||
|
|
@ -2252,12 +2147,9 @@ function lintContent(
|
|||
"lines": Object.freeze(lines),
|
||||
"frontMatterLines": Object.freeze(frontMatterLines)
|
||||
};
|
||||
const flattenedLists =
|
||||
helpers.flattenLists(markdownitTokens);
|
||||
const referenceLinkImageData =
|
||||
helpers.getReferenceLinkImageData(micromarkTokens);
|
||||
cache.set({
|
||||
flattenedLists,
|
||||
referenceLinkImageData
|
||||
});
|
||||
// Function to run for each rule
|
||||
|
|
@ -3325,11 +3217,15 @@ module.exports = {
|
|||
|
||||
|
||||
|
||||
const { addErrorDetailIf, listItemMarkerRe, unorderedListStyleFor } =
|
||||
__webpack_require__(/*! ../helpers */ "../helpers/helpers.js");
|
||||
const { flattenedLists } = __webpack_require__(/*! ./cache */ "../lib/cache.js");
|
||||
const { addErrorDetailIf } = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js");
|
||||
const { filterByTypes, getDescendantsByType, getTokenParentOfType } = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs");
|
||||
|
||||
const expectedStyleToMarker = {
|
||||
const markerToStyle = {
|
||||
"-": "dash",
|
||||
"+": "plus",
|
||||
"*": "asterisk"
|
||||
};
|
||||
const styleToMarker = {
|
||||
"dash": "-",
|
||||
"plus": "+",
|
||||
"asterisk": "*"
|
||||
|
|
@ -3339,7 +3235,13 @@ const differentItemStyle = {
|
|||
"plus": "asterisk",
|
||||
"asterisk": "dash"
|
||||
};
|
||||
const validStyles = Object.keys(expectedStyleToMarker);
|
||||
const validStyles = new Set([
|
||||
"asterisk",
|
||||
"consistent",
|
||||
"dash",
|
||||
"plus",
|
||||
"sublist"
|
||||
]);
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
|
|
@ -3347,55 +3249,50 @@ module.exports = {
|
|||
"names": [ "MD004", "ul-style" ],
|
||||
"description": "Unordered list style",
|
||||
"tags": [ "bullet", "ul" ],
|
||||
"parser": "none",
|
||||
"parser": "micromark",
|
||||
"function": function MD004(params, onError) {
|
||||
const style = String(params.config.style || "consistent");
|
||||
let expectedStyle = style;
|
||||
let expectedStyle = validStyles.has(style) ? style : "dash";
|
||||
const nestingStyles = [];
|
||||
for (const list of flattenedLists()) {
|
||||
if (list.unordered) {
|
||||
if (expectedStyle === "consistent") {
|
||||
expectedStyle = unorderedListStyleFor(list.items[0]);
|
||||
for (const listUnordered of filterByTypes(params.parsers.micromark.tokens, [ "listUnordered" ])) {
|
||||
let nesting = 0;
|
||||
if (style === "sublist") {
|
||||
/** @type {import("../helpers/micromark.cjs").Token | null} */
|
||||
let parent = listUnordered;
|
||||
while ((parent = getTokenParentOfType(parent, [ "listOrdered", "listUnordered" ]))) {
|
||||
nesting++;
|
||||
}
|
||||
for (const item of list.items) {
|
||||
const itemStyle = unorderedListStyleFor(item);
|
||||
if (style === "sublist") {
|
||||
const nesting = list.nesting;
|
||||
if (!nestingStyles[nesting]) {
|
||||
nestingStyles[nesting] =
|
||||
(itemStyle === nestingStyles[nesting - 1]) ?
|
||||
differentItemStyle[itemStyle] :
|
||||
itemStyle;
|
||||
}
|
||||
expectedStyle = nestingStyles[nesting];
|
||||
}
|
||||
const listItemMarkers = getDescendantsByType(listUnordered, [ "listItemPrefix", "listItemMarker" ]);
|
||||
for (const listItemMarker of listItemMarkers) {
|
||||
const itemStyle = markerToStyle[listItemMarker.text];
|
||||
if (style === "sublist") {
|
||||
if (!nestingStyles[nesting]) {
|
||||
nestingStyles[nesting] =
|
||||
(itemStyle === nestingStyles[nesting - 1]) ?
|
||||
differentItemStyle[itemStyle] :
|
||||
itemStyle;
|
||||
}
|
||||
if (!validStyles.includes(expectedStyle)) {
|
||||
expectedStyle = validStyles[0];
|
||||
}
|
||||
let range = null;
|
||||
let fixInfo = null;
|
||||
const match = item.line.match(listItemMarkerRe);
|
||||
if (match) {
|
||||
const column = match.index + 1;
|
||||
const length = match[0].length;
|
||||
range = [ column, length ];
|
||||
fixInfo = {
|
||||
"editColumn": match[1].length + 1,
|
||||
"deleteCount": 1,
|
||||
"insertText": expectedStyleToMarker[expectedStyle]
|
||||
};
|
||||
}
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
item.lineNumber,
|
||||
expectedStyle,
|
||||
itemStyle,
|
||||
null,
|
||||
null,
|
||||
range,
|
||||
fixInfo
|
||||
);
|
||||
expectedStyle = nestingStyles[nesting];
|
||||
} else if (expectedStyle === "consistent") {
|
||||
expectedStyle = itemStyle;
|
||||
}
|
||||
const column = listItemMarker.startColumn;
|
||||
const length = listItemMarker.endColumn - listItemMarker.startColumn;
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
listItemMarker.startLine,
|
||||
expectedStyle,
|
||||
itemStyle,
|
||||
undefined,
|
||||
undefined,
|
||||
[ column, length ],
|
||||
{
|
||||
"editColumn": column,
|
||||
"deleteCount": length,
|
||||
"insertText": styleToMarker[expectedStyle]
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4793,9 +4690,8 @@ module.exports = {
|
|||
|
||||
|
||||
|
||||
const { addErrorDetailIf, listItemMarkerRe, orderedListItemMarkerRe,
|
||||
rangeFromRegExp } = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js");
|
||||
const { flattenedLists } = __webpack_require__(/*! ./cache */ "../lib/cache.js");
|
||||
const { addErrorDetailIf } = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js");
|
||||
const { filterByTypes, getDescendantsByType, getTokenTextByType } = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs");
|
||||
|
||||
const listStyleExamples = {
|
||||
"one": "1/1/1",
|
||||
|
|
@ -4803,32 +4699,37 @@ const listStyleExamples = {
|
|||
"zero": "0/0/0"
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the value of an ordered list item prefix token.
|
||||
*
|
||||
* @param {import("../helpers/micromark.cjs").Token} listItemPrefix List item prefix token.
|
||||
* @returns {number} List item value.
|
||||
*/
|
||||
function getOrderedListItemValue(listItemPrefix) {
|
||||
return Number(getTokenTextByType(listItemPrefix.children, "listItemValue"));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
module.exports = {
|
||||
"names": [ "MD029", "ol-prefix" ],
|
||||
"description": "Ordered list item prefix",
|
||||
"tags": [ "ol" ],
|
||||
"parser": "none",
|
||||
"parser": "micromark",
|
||||
"function": function MD029(params, onError) {
|
||||
const style = String(params.config.style || "one_or_ordered");
|
||||
const filteredLists = flattenedLists().filter((list) => !list.unordered);
|
||||
for (const list of filteredLists) {
|
||||
const { items } = list;
|
||||
let current = 1;
|
||||
for (const listOrdered of filterByTypes(params.parsers.micromark.tokens, [ "listOrdered" ])) {
|
||||
const listItemPrefixes = getDescendantsByType(listOrdered, [ "listItemPrefix" ]);
|
||||
let expected = 1;
|
||||
let incrementing = false;
|
||||
// Check for incrementing number pattern 1/2/3 or 0/1/2
|
||||
if (items.length >= 2) {
|
||||
const first = orderedListItemMarkerRe.exec(items[0].line);
|
||||
const second = orderedListItemMarkerRe.exec(items[1].line);
|
||||
if (first && second) {
|
||||
const [ , firstNumber ] = first;
|
||||
const [ , secondNumber ] = second;
|
||||
if ((secondNumber !== "1") || (firstNumber === "0")) {
|
||||
incrementing = true;
|
||||
if (firstNumber === "0") {
|
||||
current = 0;
|
||||
}
|
||||
if (listItemPrefixes.length >= 2) {
|
||||
const firstValue = getOrderedListItemValue(listItemPrefixes[0]);
|
||||
const secondValue = getOrderedListItemValue(listItemPrefixes[1]);
|
||||
if ((secondValue !== 1) || (firstValue === 0)) {
|
||||
incrementing = true;
|
||||
if (firstValue === 0) {
|
||||
expected = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4836,24 +4737,25 @@ module.exports = {
|
|||
let listStyle = style;
|
||||
if (listStyle === "one_or_ordered") {
|
||||
listStyle = incrementing ? "ordered" : "one";
|
||||
}
|
||||
// Force expected value for 0/0/0 and 1/1/1 patterns
|
||||
if (listStyle === "zero") {
|
||||
current = 0;
|
||||
} else if (listStyle === "zero") {
|
||||
expected = 0;
|
||||
} else if (listStyle === "one") {
|
||||
current = 1;
|
||||
expected = 1;
|
||||
}
|
||||
// Validate each list item marker
|
||||
for (const item of items) {
|
||||
const match = orderedListItemMarkerRe.exec(item.line);
|
||||
if (match) {
|
||||
addErrorDetailIf(onError, item.lineNumber,
|
||||
String(current), match[1],
|
||||
"Style: " + listStyleExamples[listStyle], null,
|
||||
rangeFromRegExp(item.line, listItemMarkerRe));
|
||||
if (listStyle === "ordered") {
|
||||
current++;
|
||||
}
|
||||
for (const listItemPrefix of listItemPrefixes) {
|
||||
const actual = getOrderedListItemValue(listItemPrefix);
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
listItemPrefix.startLine,
|
||||
expected,
|
||||
actual,
|
||||
"Style: " + listStyleExamples[listStyle],
|
||||
undefined,
|
||||
[ listItemPrefix.startColumn, listItemPrefix.endColumn - listItemPrefix.startColumn ]
|
||||
);
|
||||
if (listStyle === "ordered") {
|
||||
expected++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@ const inlineCommentStartRe =
|
|||
/(<!--\s*markdownlint-(disable|enable|capture|restore|disable-file|enable-file|disable-line|disable-next-line|configure-file))(?:\s|-->)/gi;
|
||||
module.exports.inlineCommentStartRe = inlineCommentStartRe;
|
||||
|
||||
// Regular expressions for range matching
|
||||
module.exports.listItemMarkerRe = /^([\s>]*)(?:[*+-]|\d+[.)])\s+/;
|
||||
module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/;
|
||||
|
||||
// Regular expression for blockquote prefixes
|
||||
const blockquotePrefixRe = /^[>\s]*/;
|
||||
module.exports.blockquotePrefixRe = blockquotePrefixRe;
|
||||
|
|
@ -259,93 +255,6 @@ module.exports.emphasisOrStrongStyleFor =
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the number of characters of indent for a token.
|
||||
*
|
||||
* @param {Object} token MarkdownItToken instance.
|
||||
* @returns {number} Characters of indent.
|
||||
*/
|
||||
function indentFor(token) {
|
||||
const line = token.line.replace(/^[\s>]*(> |>)/, "");
|
||||
return line.length - line.trimStart().length;
|
||||
}
|
||||
module.exports.indentFor = indentFor;
|
||||
|
||||
/**
|
||||
* Return the string representation of an unordered list marker.
|
||||
*
|
||||
* @param {Object} token MarkdownItToken instance.
|
||||
* @returns {"asterisk" | "dash" | "plus"} String representation.
|
||||
*/
|
||||
module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
|
||||
switch (token.markup) {
|
||||
case "-":
|
||||
return "dash";
|
||||
case "+":
|
||||
return "plus";
|
||||
// case "*":
|
||||
default:
|
||||
return "asterisk";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @callback TokenCallback
|
||||
* @param {MarkdownItToken} token Current token.
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
// Returns (nested) lists as a flat array (in order)
|
||||
module.exports.flattenLists = function flattenLists(tokens) {
|
||||
const flattenedLists = [];
|
||||
const stack = [];
|
||||
let current = null;
|
||||
let nesting = 0;
|
||||
const nestingStack = [];
|
||||
let lastWithMap = { "map": [ 0, 1 ] };
|
||||
for (const token of tokens) {
|
||||
if ((token.type === "bullet_list_open") ||
|
||||
(token.type === "ordered_list_open")) {
|
||||
// Save current context and start a new one
|
||||
stack.push(current);
|
||||
current = {
|
||||
"unordered": (token.type === "bullet_list_open"),
|
||||
"parentsUnordered": !current ||
|
||||
(current.unordered && current.parentsUnordered),
|
||||
"open": token,
|
||||
"indent": indentFor(token),
|
||||
"parentIndent": (current && current.indent) || 0,
|
||||
"items": [],
|
||||
"nesting": nesting,
|
||||
"lastLineIndex": -1,
|
||||
"insert": flattenedLists.length
|
||||
};
|
||||
nesting++;
|
||||
} else if ((token.type === "bullet_list_close") ||
|
||||
(token.type === "ordered_list_close")) {
|
||||
// Finalize current context and restore previous
|
||||
current.lastLineIndex = lastWithMap.map[1];
|
||||
flattenedLists.splice(current.insert, 0, current);
|
||||
delete current.insert;
|
||||
current = stack.pop();
|
||||
nesting--;
|
||||
} else if (token.type === "list_item_open") {
|
||||
// Add list item
|
||||
current.items.push(token);
|
||||
} else if (token.type === "blockquote_open") {
|
||||
nestingStack.push(nesting);
|
||||
nesting = 0;
|
||||
} else if (token.type === "blockquote_close") {
|
||||
nesting = nestingStack.pop() || 0;
|
||||
}
|
||||
if (token.map) {
|
||||
// Track last token with map
|
||||
lastWithMap = token;
|
||||
}
|
||||
}
|
||||
return flattenedLists;
|
||||
};
|
||||
|
||||
/**
|
||||
* @callback InlineCodeSpanCallback
|
||||
* @param {string} code Code content.
|
||||
|
|
@ -544,18 +453,6 @@ const withinAnyRange = (ranges, lineIndex, index, length) => (
|
|||
);
|
||||
module.exports.withinAnyRange = withinAnyRange;
|
||||
|
||||
// Returns a range object for a line by applying a RegExp
|
||||
module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) {
|
||||
let range = null;
|
||||
const match = line.match(regexp);
|
||||
if (match) {
|
||||
const column = match.index + 1;
|
||||
const length = match[0].length;
|
||||
range = [ column, length ];
|
||||
}
|
||||
return range;
|
||||
};
|
||||
|
||||
// Determines if the front matter includes a title
|
||||
module.exports.frontMatterHasTitle =
|
||||
function frontMatterHasTitle(frontMatterLines, frontMatterTitlePattern) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,5 @@ module.exports.set = (keyValuePairs) => {
|
|||
};
|
||||
module.exports.clear = () => map.clear();
|
||||
|
||||
module.exports.flattenedLists =
|
||||
() => map.get("flattenedLists");
|
||||
module.exports.referenceLinkImageData =
|
||||
() => map.get("referenceLinkImageData");
|
||||
|
|
|
|||
|
|
@ -594,12 +594,9 @@ function lintContent(
|
|||
"lines": Object.freeze(lines),
|
||||
"frontMatterLines": Object.freeze(frontMatterLines)
|
||||
};
|
||||
const flattenedLists =
|
||||
helpers.flattenLists(markdownitTokens);
|
||||
const referenceLinkImageData =
|
||||
helpers.getReferenceLinkImageData(micromarkTokens);
|
||||
cache.set({
|
||||
flattenedLists,
|
||||
referenceLinkImageData
|
||||
});
|
||||
// Function to run for each rule
|
||||
|
|
|
|||
101
lib/md004.js
101
lib/md004.js
|
|
@ -2,11 +2,15 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { addErrorDetailIf, listItemMarkerRe, unorderedListStyleFor } =
|
||||
require("../helpers");
|
||||
const { flattenedLists } = require("./cache");
|
||||
const { addErrorDetailIf } = require("../helpers");
|
||||
const { filterByTypes, getDescendantsByType, getTokenParentOfType } = require("../helpers/micromark.cjs");
|
||||
|
||||
const expectedStyleToMarker = {
|
||||
const markerToStyle = {
|
||||
"-": "dash",
|
||||
"+": "plus",
|
||||
"*": "asterisk"
|
||||
};
|
||||
const styleToMarker = {
|
||||
"dash": "-",
|
||||
"plus": "+",
|
||||
"asterisk": "*"
|
||||
|
|
@ -16,7 +20,13 @@ const differentItemStyle = {
|
|||
"plus": "asterisk",
|
||||
"asterisk": "dash"
|
||||
};
|
||||
const validStyles = Object.keys(expectedStyleToMarker);
|
||||
const validStyles = new Set([
|
||||
"asterisk",
|
||||
"consistent",
|
||||
"dash",
|
||||
"plus",
|
||||
"sublist"
|
||||
]);
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
|
|
@ -24,55 +34,50 @@ module.exports = {
|
|||
"names": [ "MD004", "ul-style" ],
|
||||
"description": "Unordered list style",
|
||||
"tags": [ "bullet", "ul" ],
|
||||
"parser": "none",
|
||||
"parser": "micromark",
|
||||
"function": function MD004(params, onError) {
|
||||
const style = String(params.config.style || "consistent");
|
||||
let expectedStyle = style;
|
||||
let expectedStyle = validStyles.has(style) ? style : "dash";
|
||||
const nestingStyles = [];
|
||||
for (const list of flattenedLists()) {
|
||||
if (list.unordered) {
|
||||
if (expectedStyle === "consistent") {
|
||||
expectedStyle = unorderedListStyleFor(list.items[0]);
|
||||
for (const listUnordered of filterByTypes(params.parsers.micromark.tokens, [ "listUnordered" ])) {
|
||||
let nesting = 0;
|
||||
if (style === "sublist") {
|
||||
/** @type {import("../helpers/micromark.cjs").Token | null} */
|
||||
let parent = listUnordered;
|
||||
while ((parent = getTokenParentOfType(parent, [ "listOrdered", "listUnordered" ]))) {
|
||||
nesting++;
|
||||
}
|
||||
for (const item of list.items) {
|
||||
const itemStyle = unorderedListStyleFor(item);
|
||||
if (style === "sublist") {
|
||||
const nesting = list.nesting;
|
||||
if (!nestingStyles[nesting]) {
|
||||
nestingStyles[nesting] =
|
||||
(itemStyle === nestingStyles[nesting - 1]) ?
|
||||
differentItemStyle[itemStyle] :
|
||||
itemStyle;
|
||||
}
|
||||
expectedStyle = nestingStyles[nesting];
|
||||
}
|
||||
const listItemMarkers = getDescendantsByType(listUnordered, [ "listItemPrefix", "listItemMarker" ]);
|
||||
for (const listItemMarker of listItemMarkers) {
|
||||
const itemStyle = markerToStyle[listItemMarker.text];
|
||||
if (style === "sublist") {
|
||||
if (!nestingStyles[nesting]) {
|
||||
nestingStyles[nesting] =
|
||||
(itemStyle === nestingStyles[nesting - 1]) ?
|
||||
differentItemStyle[itemStyle] :
|
||||
itemStyle;
|
||||
}
|
||||
if (!validStyles.includes(expectedStyle)) {
|
||||
expectedStyle = validStyles[0];
|
||||
}
|
||||
let range = null;
|
||||
let fixInfo = null;
|
||||
const match = item.line.match(listItemMarkerRe);
|
||||
if (match) {
|
||||
const column = match.index + 1;
|
||||
const length = match[0].length;
|
||||
range = [ column, length ];
|
||||
fixInfo = {
|
||||
"editColumn": match[1].length + 1,
|
||||
"deleteCount": 1,
|
||||
"insertText": expectedStyleToMarker[expectedStyle]
|
||||
};
|
||||
}
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
item.lineNumber,
|
||||
expectedStyle,
|
||||
itemStyle,
|
||||
null,
|
||||
null,
|
||||
range,
|
||||
fixInfo
|
||||
);
|
||||
expectedStyle = nestingStyles[nesting];
|
||||
} else if (expectedStyle === "consistent") {
|
||||
expectedStyle = itemStyle;
|
||||
}
|
||||
const column = listItemMarker.startColumn;
|
||||
const length = listItemMarker.endColumn - listItemMarker.startColumn;
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
listItemMarker.startLine,
|
||||
expectedStyle,
|
||||
itemStyle,
|
||||
undefined,
|
||||
undefined,
|
||||
[ column, length ],
|
||||
{
|
||||
"editColumn": column,
|
||||
"deleteCount": length,
|
||||
"insertText": styleToMarker[expectedStyle]
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
73
lib/md029.js
73
lib/md029.js
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { addErrorDetailIf, listItemMarkerRe, orderedListItemMarkerRe,
|
||||
rangeFromRegExp } = require("../helpers");
|
||||
const { flattenedLists } = require("./cache");
|
||||
const { addErrorDetailIf } = require("../helpers");
|
||||
const { filterByTypes, getDescendantsByType, getTokenTextByType } = require("../helpers/micromark.cjs");
|
||||
|
||||
const listStyleExamples = {
|
||||
"one": "1/1/1",
|
||||
|
|
@ -12,32 +11,37 @@ const listStyleExamples = {
|
|||
"zero": "0/0/0"
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the value of an ordered list item prefix token.
|
||||
*
|
||||
* @param {import("../helpers/micromark.cjs").Token} listItemPrefix List item prefix token.
|
||||
* @returns {number} List item value.
|
||||
*/
|
||||
function getOrderedListItemValue(listItemPrefix) {
|
||||
return Number(getTokenTextByType(listItemPrefix.children, "listItemValue"));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
module.exports = {
|
||||
"names": [ "MD029", "ol-prefix" ],
|
||||
"description": "Ordered list item prefix",
|
||||
"tags": [ "ol" ],
|
||||
"parser": "none",
|
||||
"parser": "micromark",
|
||||
"function": function MD029(params, onError) {
|
||||
const style = String(params.config.style || "one_or_ordered");
|
||||
const filteredLists = flattenedLists().filter((list) => !list.unordered);
|
||||
for (const list of filteredLists) {
|
||||
const { items } = list;
|
||||
let current = 1;
|
||||
for (const listOrdered of filterByTypes(params.parsers.micromark.tokens, [ "listOrdered" ])) {
|
||||
const listItemPrefixes = getDescendantsByType(listOrdered, [ "listItemPrefix" ]);
|
||||
let expected = 1;
|
||||
let incrementing = false;
|
||||
// Check for incrementing number pattern 1/2/3 or 0/1/2
|
||||
if (items.length >= 2) {
|
||||
const first = orderedListItemMarkerRe.exec(items[0].line);
|
||||
const second = orderedListItemMarkerRe.exec(items[1].line);
|
||||
if (first && second) {
|
||||
const [ , firstNumber ] = first;
|
||||
const [ , secondNumber ] = second;
|
||||
if ((secondNumber !== "1") || (firstNumber === "0")) {
|
||||
incrementing = true;
|
||||
if (firstNumber === "0") {
|
||||
current = 0;
|
||||
}
|
||||
if (listItemPrefixes.length >= 2) {
|
||||
const firstValue = getOrderedListItemValue(listItemPrefixes[0]);
|
||||
const secondValue = getOrderedListItemValue(listItemPrefixes[1]);
|
||||
if ((secondValue !== 1) || (firstValue === 0)) {
|
||||
incrementing = true;
|
||||
if (firstValue === 0) {
|
||||
expected = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -45,24 +49,25 @@ module.exports = {
|
|||
let listStyle = style;
|
||||
if (listStyle === "one_or_ordered") {
|
||||
listStyle = incrementing ? "ordered" : "one";
|
||||
}
|
||||
// Force expected value for 0/0/0 and 1/1/1 patterns
|
||||
if (listStyle === "zero") {
|
||||
current = 0;
|
||||
} else if (listStyle === "zero") {
|
||||
expected = 0;
|
||||
} else if (listStyle === "one") {
|
||||
current = 1;
|
||||
expected = 1;
|
||||
}
|
||||
// Validate each list item marker
|
||||
for (const item of items) {
|
||||
const match = orderedListItemMarkerRe.exec(item.line);
|
||||
if (match) {
|
||||
addErrorDetailIf(onError, item.lineNumber,
|
||||
String(current), match[1],
|
||||
"Style: " + listStyleExamples[listStyle], null,
|
||||
rangeFromRegExp(item.line, listItemMarkerRe));
|
||||
if (listStyle === "ordered") {
|
||||
current++;
|
||||
}
|
||||
for (const listItemPrefix of listItemPrefixes) {
|
||||
const actual = getOrderedListItemValue(listItemPrefix);
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
listItemPrefix.startLine,
|
||||
expected,
|
||||
actual,
|
||||
"Style: " + listStyleExamples[listStyle],
|
||||
undefined,
|
||||
[ listItemPrefix.startColumn, listItemPrefix.endColumn - listItemPrefix.startColumn ]
|
||||
);
|
||||
if (listStyle === "ordered") {
|
||||
expected++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,5 +95,5 @@
|
|||
- eight
|
||||
|
||||
* 1. Item {MD004} {MD007}
|
||||
* 2. Item {MD004} {MD007}
|
||||
* 3. Item {MD004} {MD007}
|
||||
* 2. Item {MD004} {MD007} {MD029}
|
||||
* 3. Item {MD004} {MD007} {MD029}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: asterisk; Actual: dash',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -6877,8 +6877,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: plus',
|
||||
errorRange: [
|
||||
2,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -19835,8 +19835,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: plus',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -19855,8 +19855,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: dash',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -19875,8 +19875,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: plus',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -19895,8 +19895,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: dash',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -19936,8 +19936,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -19956,8 +19956,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -19976,8 +19976,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -19996,8 +19996,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20037,8 +20037,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20057,8 +20057,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20077,8 +20077,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20097,8 +20097,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20138,8 +20138,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: dash',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20158,8 +20158,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: plus',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20200,7 +20200,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20219,8 +20219,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20261,7 +20261,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -20280,8 +20280,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -24121,7 +24121,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -24140,8 +24140,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -24161,7 +24161,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -24180,8 +24180,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -32969,7 +32969,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33293,8 +33293,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33313,8 +33313,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33333,8 +33333,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
6,
|
||||
1,
|
||||
7,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33353,8 +33353,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
8,
|
||||
1,
|
||||
9,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33373,8 +33373,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
8,
|
||||
1,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33393,8 +33393,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
9,
|
||||
1,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33413,8 +33413,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
7,
|
||||
1,
|
||||
8,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33433,8 +33433,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
6,
|
||||
1,
|
||||
7,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33453,8 +33453,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
8,
|
||||
1,
|
||||
9,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33473,8 +33473,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
10,
|
||||
1,
|
||||
11,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33493,8 +33493,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
11,
|
||||
1,
|
||||
12,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33513,8 +33513,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
7,
|
||||
1,
|
||||
8,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33533,8 +33533,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
9,
|
||||
1,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33553,8 +33553,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
9,
|
||||
1,
|
||||
11,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33573,8 +33573,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
10,
|
||||
1,
|
||||
11,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33593,8 +33593,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
7,
|
||||
1,
|
||||
8,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33613,8 +33613,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
8,
|
||||
1,
|
||||
9,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33633,8 +33633,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
8,
|
||||
1,
|
||||
9,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33653,8 +33653,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
9,
|
||||
1,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33673,8 +33673,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
10,
|
||||
1,
|
||||
11,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33693,8 +33693,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
10,
|
||||
1,
|
||||
11,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33713,8 +33713,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
7,
|
||||
1,
|
||||
8,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33733,8 +33733,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
8,
|
||||
1,
|
||||
9,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33753,8 +33753,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
8,
|
||||
1,
|
||||
9,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33773,8 +33773,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
9,
|
||||
1,
|
||||
10,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33793,8 +33793,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
10,
|
||||
1,
|
||||
11,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33813,8 +33813,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
10,
|
||||
1,
|
||||
11,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33833,8 +33833,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33853,8 +33853,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33873,8 +33873,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -33893,8 +33893,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -35838,8 +35838,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
2,
|
||||
1,
|
||||
3,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -35858,8 +35858,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
2,
|
||||
1,
|
||||
3,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -35878,8 +35878,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
2,
|
||||
1,
|
||||
3,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -35974,6 +35974,38 @@ Generated by [AVA](https://avajs.dev).
|
|||
'ul-indent',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: 1; Actual: 2; Style: 1/1/1',
|
||||
errorRange: [
|
||||
4,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 98,
|
||||
ruleDescription: 'Ordered list item prefix',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md029.md',
|
||||
ruleNames: [
|
||||
'MD029',
|
||||
'ol-prefix',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: 1; Actual: 3; Style: 1/1/1',
|
||||
errorRange: [
|
||||
4,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 99,
|
||||
ruleDescription: 'Ordered list item prefix',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md029.md',
|
||||
ruleNames: [
|
||||
'MD029',
|
||||
'ol-prefix',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '- one {MD032}',
|
||||
errorDetail: null,
|
||||
|
|
@ -36208,8 +36240,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
- eight␊
|
||||
␊
|
||||
- 1. Item {MD004} {MD007}␊
|
||||
- 2. Item {MD004} {MD007}␊
|
||||
- 3. Item {MD004} {MD007}␊
|
||||
- 2. Item {MD004} {MD007} {MD029}␊
|
||||
- 3. Item {MD004} {MD007} {MD029}␊
|
||||
`,
|
||||
}
|
||||
|
||||
|
|
@ -38275,8 +38307,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
2,
|
||||
1,
|
||||
3,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -38296,7 +38328,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -40741,8 +40773,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 1; Actual: 2; Style: 1/1/1',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 56,
|
||||
|
|
@ -40757,8 +40789,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 1; Actual: 3; Style: 1/1/1',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 57,
|
||||
|
|
@ -40773,8 +40805,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 1; Actual: 2; Style: 1/1/1',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 60,
|
||||
|
|
@ -40789,8 +40821,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 1; Actual: 4; Style: 1/1/1',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 61,
|
||||
|
|
@ -41039,8 +41071,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 3; Actual: 4; Style: 1/2/3',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 61,
|
||||
|
|
@ -41283,8 +41315,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 2; Actual: 1; Style: 1/2/3',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 52,
|
||||
|
|
@ -41299,8 +41331,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 3; Actual: 1; Style: 1/2/3',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 53,
|
||||
|
|
@ -41315,8 +41347,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 3; Actual: 4; Style: 1/2/3',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 61,
|
||||
|
|
@ -41789,8 +41821,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 0; Actual: 1; Style: 0/0/0',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 55,
|
||||
|
|
@ -41805,8 +41837,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 0; Actual: 2; Style: 0/0/0',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 56,
|
||||
|
|
@ -41821,8 +41853,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 0; Actual: 3; Style: 0/0/0',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 57,
|
||||
|
|
@ -41837,8 +41869,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 0; Actual: 1; Style: 0/0/0',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 60,
|
||||
|
|
@ -41853,8 +41885,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: 0; Actual: 2; Style: 0/0/0',
|
||||
errorRange: [
|
||||
1,
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 61,
|
||||
|
|
@ -53042,8 +53074,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: dash',
|
||||
errorRange: [
|
||||
7,
|
||||
1,
|
||||
8,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53063,7 +53095,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53082,8 +53114,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: plus',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53102,8 +53134,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
7,
|
||||
1,
|
||||
8,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53122,8 +53154,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53143,7 +53175,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53162,8 +53194,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: asterisk; Actual: dash',
|
||||
errorRange: [
|
||||
3,
|
||||
1,
|
||||
4,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53182,8 +53214,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: plus; Actual: asterisk',
|
||||
errorRange: [
|
||||
5,
|
||||
1,
|
||||
6,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53202,8 +53234,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: asterisk',
|
||||
errorRange: [
|
||||
11,
|
||||
1,
|
||||
12,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53222,8 +53254,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
11,
|
||||
1,
|
||||
12,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
@ -53242,8 +53274,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
errorContext: null,
|
||||
errorDetail: 'Expected: dash; Actual: plus',
|
||||
errorRange: [
|
||||
11,
|
||||
1,
|
||||
12,
|
||||
],
|
||||
fixInfo: {
|
||||
deleteCount: 1,
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue