mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-31 04:58:49 +01:00
Update dependencies: eslint-plugin-jsdoc to 31.6.0, eslint-plugin-unicorn to 27.0.0.
This commit is contained in:
parent
ec907567e2
commit
c87d7f5b8c
13 changed files with 95 additions and 74 deletions
|
|
@ -51,10 +51,12 @@ function validateRuleList(ruleList) {
|
|||
result = newError(property);
|
||||
}
|
||||
});
|
||||
if (!result && rule.information) {
|
||||
if (Object.getPrototypeOf(rule.information) !== URL.prototype) {
|
||||
result = newError("information");
|
||||
}
|
||||
if (
|
||||
!result &&
|
||||
rule.information &&
|
||||
(Object.getPrototypeOf(rule.information) !== URL.prototype)
|
||||
) {
|
||||
result = newError("information");
|
||||
}
|
||||
if (!result) {
|
||||
rule.names.forEach(function forName(name) {
|
||||
|
|
@ -721,6 +723,7 @@ function lintInput(options, synchronous, callback) {
|
|||
// Normalize inputs
|
||||
options = options || {};
|
||||
callback = callback || function noop() {};
|
||||
// eslint-disable-next-line unicorn/prefer-spread
|
||||
const ruleList = rules.concat(options.customRules || []);
|
||||
const ruleErr = validateRuleList(ruleList);
|
||||
if (ruleErr) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module.exports = {
|
|||
null,
|
||||
rangeFromRegExp(line, listItemMarkerRe),
|
||||
{
|
||||
"deleteCount": line.length - line.trimLeft().length
|
||||
"deleteCount": line.length - line.trimStart().length
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
44
lib/md009.js
44
lib/md009.js
|
|
@ -49,26 +49,30 @@ module.exports = {
|
|||
const expected = (brSpaces < 2) ? 0 : brSpaces;
|
||||
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
|
||||
const lineNumber = lineIndex + 1;
|
||||
const trailingSpaces = line.length - line.trimRight().length;
|
||||
if (trailingSpaces && !inCode &&
|
||||
!includesSorted(listItemLineNumbers, lineNumber)) {
|
||||
if ((expected !== trailingSpaces) ||
|
||||
(strict &&
|
||||
(!includesSorted(paragraphLineNumbers, lineNumber) ||
|
||||
includesSorted(codeInlineLineNumbers, lineNumber)))) {
|
||||
const column = line.length - trailingSpaces + 1;
|
||||
addError(
|
||||
onError,
|
||||
lineNumber,
|
||||
"Expected: " + (expected === 0 ? "" : "0 or ") +
|
||||
expected + "; Actual: " + trailingSpaces,
|
||||
null,
|
||||
[ column, trailingSpaces ],
|
||||
{
|
||||
"editColumn": column,
|
||||
"deleteCount": trailingSpaces
|
||||
});
|
||||
}
|
||||
const trailingSpaces = line.length - line.trimEnd().length;
|
||||
if (
|
||||
trailingSpaces &&
|
||||
!inCode &&
|
||||
!includesSorted(listItemLineNumbers, lineNumber) &&
|
||||
(
|
||||
(expected !== trailingSpaces) ||
|
||||
(strict &&
|
||||
(!includesSorted(paragraphLineNumbers, lineNumber) ||
|
||||
includesSorted(codeInlineLineNumbers, lineNumber)))
|
||||
)
|
||||
) {
|
||||
const column = line.length - trailingSpaces + 1;
|
||||
addError(
|
||||
onError,
|
||||
lineNumber,
|
||||
"Expected: " + (expected === 0 ? "" : "0 or ") +
|
||||
expected + "; Actual: " + trailingSpaces,
|
||||
null,
|
||||
[ column, trailingSpaces ],
|
||||
{
|
||||
"editColumn": column,
|
||||
"deleteCount": trailingSpaces
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ module.exports = {
|
|||
if (match) {
|
||||
const [ prefixAndFirstChar, prefix ] = match;
|
||||
let deleteCount = prefix.length;
|
||||
const prefixLengthNoSpace = prefix.trimRight().length;
|
||||
const prefixLengthNoSpace = prefix.trimEnd().length;
|
||||
if (prefixLengthNoSpace) {
|
||||
deleteCount -= prefixLengthNoSpace - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ module.exports = {
|
|||
const firstIndex = list.open.map[0];
|
||||
if (!isBlankLine(lines[firstIndex - 1])) {
|
||||
const line = lines[firstIndex];
|
||||
const quotePrefix = line.match(quotePrefixRe)[0].trimRight();
|
||||
const quotePrefix = line.match(quotePrefixRe)[0].trimEnd();
|
||||
addErrorContext(
|
||||
onError,
|
||||
firstIndex + 1,
|
||||
|
|
@ -32,7 +32,7 @@ module.exports = {
|
|||
const lastIndex = list.lastLineIndex - 1;
|
||||
if (!isBlankLine(lines[lastIndex + 1])) {
|
||||
const line = lines[lastIndex];
|
||||
const quotePrefix = line.match(quotePrefixRe)[0].trimRight();
|
||||
const quotePrefix = line.match(quotePrefixRe)[0].trimEnd();
|
||||
addErrorContext(
|
||||
onError,
|
||||
lastIndex + 1,
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ module.exports = {
|
|||
// Close current run
|
||||
let content = line.substring(emphasisIndex, matchIndex);
|
||||
if (!emphasisLength) {
|
||||
content = content.trimLeft();
|
||||
content = content.trimStart();
|
||||
}
|
||||
if (!match) {
|
||||
content = content.trimRight();
|
||||
content = content.trimEnd();
|
||||
}
|
||||
const leftSpace = leftSpaceRe.test(content);
|
||||
const rightSpace = rightSpaceRe.test(content);
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ module.exports = {
|
|||
linkText = "";
|
||||
} else if (type === "link_close") {
|
||||
inLink = false;
|
||||
const left = linkText.trimLeft().length !== linkText.length;
|
||||
const right = linkText.trimRight().length !== linkText.length;
|
||||
const left = linkText.trimStart().length !== linkText.length;
|
||||
const right = linkText.trimEnd().length !== linkText.length;
|
||||
if (left || right) {
|
||||
const line = params.lines[lineNumber - 1];
|
||||
let range = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue