Update dependencies: eslint-plugin-jsdoc to 31.6.0, eslint-plugin-unicorn to 27.0.0.

This commit is contained in:
David Anson 2021-02-06 19:55:22 -08:00
parent ec907567e2
commit c87d7f5b8c
13 changed files with 95 additions and 74 deletions

View file

@ -124,8 +124,10 @@
"unicorn/better-regex": "off", "unicorn/better-regex": "off",
"unicorn/catch-error-name": "error", "unicorn/catch-error-name": "error",
"unicorn/consistent-destructuring": "error",
"unicorn/consistent-function-scoping": "off", "unicorn/consistent-function-scoping": "off",
"unicorn/custom-error-definition": "error", "unicorn/custom-error-definition": "error",
"unicorn/empty-brace-spaces": "error",
"unicorn/error-message": "error", "unicorn/error-message": "error",
"unicorn/escape-case": "error", "unicorn/escape-case": "error",
"unicorn/expiring-todo-comments": "error", "unicorn/expiring-todo-comments": "error",
@ -135,18 +137,23 @@
"unicorn/import-style": "error", "unicorn/import-style": "error",
"unicorn/new-for-builtins": "error", "unicorn/new-for-builtins": "error",
"unicorn/no-abusive-eslint-disable": "error", "unicorn/no-abusive-eslint-disable": "error",
"unicorn/no-array-instanceof": "error", "unicorn/no-array-callback-reference": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-push-push": "error",
"unicorn/no-array-reduce": "error",
"unicorn/no-console-spaces": "error", "unicorn/no-console-spaces": "error",
"unicorn/no-fn-reference-in-iterator": "off",
"unicorn/no-for-loop": "error", "unicorn/no-for-loop": "error",
"unicorn/no-hex-escape": "error", "unicorn/no-hex-escape": "error",
"unicorn/no-instanceof-array": "error",
"unicorn/no-keyword-prefix": "off", "unicorn/no-keyword-prefix": "off",
"unicorn/no-lonely-if": "error",
"unicorn/no-nested-ternary": "error", "unicorn/no-nested-ternary": "error",
"unicorn/no-new-array": "off",
"unicorn/no-new-buffer": "error", "unicorn/no-new-buffer": "error",
"unicorn/no-null": "off", "unicorn/no-null": "off",
"unicorn/no-object-as-default-parameter": "error", "unicorn/no-object-as-default-parameter": "error",
"unicorn/no-process-exit": "error", "unicorn/no-process-exit": "error",
"unicorn/no-reduce": "error", "unicorn/no-this-assignment": "error",
"unicorn/no-unreadable-array-destructuring": "error", "unicorn/no-unreadable-array-destructuring": "error",
"unicorn/no-unsafe-regex": "off", "unicorn/no-unsafe-regex": "off",
"unicorn/no-unused-properties": "error", "unicorn/no-unused-properties": "error",
@ -156,27 +163,32 @@
"unicorn/numeric-separators-style": "error", "unicorn/numeric-separators-style": "error",
"unicorn/prefer-add-event-listener": "error", "unicorn/prefer-add-event-listener": "error",
"unicorn/prefer-array-find": "error", "unicorn/prefer-array-find": "error",
"unicorn/prefer-dataset": "error", "unicorn/prefer-array-flat-map": "error",
"unicorn/prefer-event-key": "error", "unicorn/prefer-array-index-of": "error",
"unicorn/prefer-flat-map": "error", "unicorn/prefer-array-some": "error",
"unicorn/prefer-date-now": "error",
"unicorn/prefer-default-parameters": "error",
"unicorn/prefer-dom-node-append": "error",
"unicorn/prefer-dom-node-dataset": "error",
"unicorn/prefer-dom-node-remove": "error",
"unicorn/prefer-dom-node-text-content": "error",
"unicorn/prefer-includes": "error", "unicorn/prefer-includes": "error",
"unicorn/prefer-keyboard-event-key": "error",
"unicorn/prefer-math-trunc": "error", "unicorn/prefer-math-trunc": "error",
"unicorn/prefer-modern-dom-apis": "error", "unicorn/prefer-modern-dom-apis": "error",
"unicorn/prefer-negative-index": "error", "unicorn/prefer-negative-index": "error",
"unicorn/prefer-node-append": "error",
"unicorn/prefer-node-remove": "error",
"unicorn/prefer-number-properties": "error", "unicorn/prefer-number-properties": "error",
"unicorn/prefer-optional-catch-binding": "error", "unicorn/prefer-optional-catch-binding": "error",
"unicorn/prefer-query-selector": "error", "unicorn/prefer-query-selector": "error",
"unicorn/prefer-reflect-apply": "error", "unicorn/prefer-reflect-apply": "error",
"unicorn/prefer-replace-all": "off", "unicorn/prefer-regexp-test": "error",
"unicorn/prefer-set-has": "error", "unicorn/prefer-set-has": "error",
"unicorn/prefer-spread": "error", "unicorn/prefer-spread": "error",
"unicorn/prefer-starts-ends-with": "error", "unicorn/prefer-string-replace-all": "off",
"unicorn/prefer-string-slice": "off", "unicorn/prefer-string-slice": "off",
"unicorn/prefer-string-starts-ends-with": "error",
"unicorn/prefer-string-trim-start-end": "error",
"unicorn/prefer-ternary": "error", "unicorn/prefer-ternary": "error",
"unicorn/prefer-text-content": "error",
"unicorn/prefer-trim-start-end": "off",
"unicorn/prefer-type-error": "error", "unicorn/prefer-type-error": "error",
"unicorn/prevent-abbreviations": "off", "unicorn/prevent-abbreviations": "off",
"unicorn/string-content": "error", "unicorn/string-content": "error",

View file

@ -197,7 +197,7 @@ module.exports.fencedCodeBlockStyleFor =
*/ */
function indentFor(token) { function indentFor(token) {
var line = token.line.replace(/^[\s>]*(> |>)/, ""); var line = token.line.replace(/^[\s>]*(> |>)/, "");
return line.length - line.trimLeft().length; return line.length - line.trimStart().length;
} }
module.exports.indentFor = indentFor; module.exports.indentFor = indentFor;
// Returns the heading style for a heading token // Returns the heading style for a heading token
@ -822,10 +822,10 @@ function validateRuleList(ruleList) {
result = newError(property); result = newError(property);
} }
}); });
if (!result && rule.information) { if (!result &&
if (Object.getPrototypeOf(rule.information) !== URL.prototype) { rule.information &&
result = newError("information"); (Object.getPrototypeOf(rule.information) !== URL.prototype)) {
} result = newError("information");
} }
if (!result) { if (!result) {
rule.names.forEach(function forName(name) { rule.names.forEach(function forName(name) {
@ -1437,6 +1437,7 @@ function lintInput(options, synchronous, callback) {
// Normalize inputs // Normalize inputs
options = options || {}; options = options || {};
callback = callback || function noop() { }; callback = callback || function noop() { };
// eslint-disable-next-line unicorn/prefer-spread
var ruleList = rules.concat(options.customRules || []); var ruleList = rules.concat(options.customRules || []);
var ruleErr = validateRuleList(ruleList); var ruleErr = validateRuleList(ruleList);
if (ruleErr) { if (ruleErr) {
@ -1986,7 +1987,7 @@ module.exports = {
list.items.forEach(function (item) { list.items.forEach(function (item) {
var lineNumber = item.lineNumber, line = item.line; var lineNumber = item.lineNumber, line = item.line;
addErrorDetailIf(onError, lineNumber, 0, list.indent, null, null, rangeFromRegExp(line, listItemMarkerRe), { addErrorDetailIf(onError, lineNumber, 0, list.indent, null, null, rangeFromRegExp(line, listItemMarkerRe), {
"deleteCount": line.length - line.trimLeft().length "deleteCount": line.length - line.trimStart().length
}); });
}); });
} }
@ -2097,20 +2098,20 @@ module.exports = {
var expected = (brSpaces < 2) ? 0 : brSpaces; var expected = (brSpaces < 2) ? 0 : brSpaces;
forEachLine(lineMetadata(), function (line, lineIndex, inCode) { forEachLine(lineMetadata(), function (line, lineIndex, inCode) {
var lineNumber = lineIndex + 1; var lineNumber = lineIndex + 1;
var trailingSpaces = line.length - line.trimRight().length; var trailingSpaces = line.length - line.trimEnd().length;
if (trailingSpaces && !inCode && if (trailingSpaces &&
!includesSorted(listItemLineNumbers, lineNumber)) { !inCode &&
if ((expected !== trailingSpaces) || !includesSorted(listItemLineNumbers, lineNumber) &&
((expected !== trailingSpaces) ||
(strict && (strict &&
(!includesSorted(paragraphLineNumbers, lineNumber) || (!includesSorted(paragraphLineNumbers, lineNumber) ||
includesSorted(codeInlineLineNumbers, lineNumber)))) { includesSorted(codeInlineLineNumbers, lineNumber))))) {
var column = line.length - trailingSpaces + 1; var column = line.length - trailingSpaces + 1;
addError(onError, lineNumber, "Expected: " + (expected === 0 ? "" : "0 or ") + addError(onError, lineNumber, "Expected: " + (expected === 0 ? "" : "0 or ") +
expected + "; Actual: " + trailingSpaces, null, [column, trailingSpaces], { expected + "; Actual: " + trailingSpaces, null, [column, trailingSpaces], {
"editColumn": column, "editColumn": column,
"deleteCount": trailingSpaces "deleteCount": trailingSpaces
}); });
}
} }
}); });
} }
@ -2616,7 +2617,7 @@ module.exports = {
if (match) { if (match) {
var prefixAndFirstChar = match[0], prefix = match[1]; var prefixAndFirstChar = match[0], prefix = match[1];
var deleteCount = prefix.length; var deleteCount = prefix.length;
var prefixLengthNoSpace = prefix.trimRight().length; var prefixLengthNoSpace = prefix.trimEnd().length;
if (prefixLengthNoSpace) { if (prefixLengthNoSpace) {
deleteCount -= prefixLengthNoSpace - 1; deleteCount -= prefixLengthNoSpace - 1;
} }
@ -3023,7 +3024,7 @@ module.exports = {
var firstIndex = list.open.map[0]; var firstIndex = list.open.map[0];
if (!isBlankLine(lines[firstIndex - 1])) { if (!isBlankLine(lines[firstIndex - 1])) {
var line = lines[firstIndex]; var line = lines[firstIndex];
var quotePrefix = line.match(quotePrefixRe)[0].trimRight(); var quotePrefix = line.match(quotePrefixRe)[0].trimEnd();
addErrorContext(onError, firstIndex + 1, line.trim(), null, null, null, { addErrorContext(onError, firstIndex + 1, line.trim(), null, null, null, {
"insertText": quotePrefix + "\n" "insertText": quotePrefix + "\n"
}); });
@ -3031,7 +3032,7 @@ module.exports = {
var lastIndex = list.lastLineIndex - 1; var lastIndex = list.lastLineIndex - 1;
if (!isBlankLine(lines[lastIndex + 1])) { if (!isBlankLine(lines[lastIndex + 1])) {
var line = lines[lastIndex]; var line = lines[lastIndex];
var quotePrefix = line.match(quotePrefixRe)[0].trimRight(); var quotePrefix = line.match(quotePrefixRe)[0].trimEnd();
addErrorContext(onError, lastIndex + 1, line.trim(), null, null, null, { addErrorContext(onError, lastIndex + 1, line.trim(), null, null, null, {
"lineNumber": lastIndex + 2, "lineNumber": lastIndex + 2,
"insertText": quotePrefix + "\n" "insertText": quotePrefix + "\n"
@ -3286,10 +3287,10 @@ module.exports = {
// Close current run // Close current run
var content = line.substring(emphasisIndex, matchIndex); var content = line.substring(emphasisIndex, matchIndex);
if (!emphasisLength) { if (!emphasisLength) {
content = content.trimLeft(); content = content.trimStart();
} }
if (!match) { if (!match) {
content = content.trimRight(); content = content.trimEnd();
} }
var leftSpace = leftSpaceRe.test(content); var leftSpace = leftSpaceRe.test(content);
var rightSpace = rightSpaceRe.test(content); var rightSpace = rightSpaceRe.test(content);
@ -3503,8 +3504,8 @@ module.exports = {
} }
else if (type === "link_close") { else if (type === "link_close") {
inLink = false; inLink = false;
var left = linkText.trimLeft().length !== linkText.length; var left = linkText.trimStart().length !== linkText.length;
var right = linkText.trimRight().length !== linkText.length; var right = linkText.trimEnd().length !== linkText.length;
if (left || right) { if (left || right) {
var line = params.lines[lineNumber - 1]; var line = params.lines[lineNumber - 1];
var range = null; var range = null;
@ -4014,7 +4015,7 @@ module.exports = rules;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = JSON.parse("{\"name\":\"markdownlint\",\"version\":\"0.22.0\",\"description\":\"A Node.js style checker and lint tool for Markdown/CommonMark files.\",\"main\":\"lib/markdownlint.js\",\"types\":\"lib/markdownlint.d.ts\",\"author\":\"David Anson (https://dlaa.me/)\",\"license\":\"MIT\",\"homepage\":\"https://github.com/DavidAnson/markdownlint\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/DavidAnson/markdownlint.git\"},\"bugs\":\"https://github.com/DavidAnson/markdownlint/issues\",\"scripts\":{\"build-config\":\"npm run build-config-schema && npm run build-config-example\",\"build-config-example\":\"node schema/build-config-example.js\",\"build-config-schema\":\"node schema/build-config-schema.js\",\"build-declaration\":\"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'\",\"build-demo\":\"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats\",\"build-example\":\"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2\",\"ci\":\"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code\",\"clean-test-repos\":\"rimraf test-repos\",\"clone-test-repos\":\"mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet\",\"clone-test-repos-large\":\"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet\",\"declaration\":\"npm run build-declaration && npm run test-declaration\",\"example\":\"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint\",\"lint\":\"eslint --max-warnings 0 .\",\"lint-test-repos\":\"ava --timeout=5m test/markdownlint-test-repos.js\",\"test\":\"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js\",\"test-cover\":\"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test\",\"test-declaration\":\"cd example/typescript && tsc && node type-check.js\",\"test-extra\":\"ava --timeout=5m test/markdownlint-test-extra.js\"},\"engines\":{\"node\":\">=10\"},\"dependencies\":{\"markdown-it\":\"12.0.4\"},\"devDependencies\":{\"ava\":\"~3.15.0\",\"c8\":\"~7.5.0\",\"cpy-cli\":\"~3.1.1\",\"eslint\":\"~7.19.0\",\"eslint-plugin-jsdoc\":\"~30.7.8\",\"eslint-plugin-node\":\"~11.1.0\",\"eslint-plugin-unicorn\":\"~23.0.0\",\"globby\":\"~11.0.2\",\"js-yaml\":\"~4.0.0\",\"markdown-it-for-inline\":\"~0.1.1\",\"markdown-it-sub\":\"~1.0.0\",\"markdown-it-sup\":\"~1.0.0\",\"markdown-it-texmath\":\"~0.8.0\",\"markdownlint-rule-helpers\":\"~0.13.0\",\"npm-run-all\":\"~4.1.5\",\"rimraf\":\"~3.0.2\",\"strip-json-comments\":\"~3.1.1\",\"toml\":\"~3.0.0\",\"ts-loader\":\"~8.0.15\",\"tv4\":\"~1.3.0\",\"typescript\":\"~4.1.3\",\"webpack\":\"~5.21.1\",\"webpack-cli\":\"~4.5.0\"},\"keywords\":[\"markdown\",\"lint\",\"md\",\"CommonMark\",\"markdownlint\"]}"); module.exports = JSON.parse("{\"name\":\"markdownlint\",\"version\":\"0.22.0\",\"description\":\"A Node.js style checker and lint tool for Markdown/CommonMark files.\",\"main\":\"lib/markdownlint.js\",\"types\":\"lib/markdownlint.d.ts\",\"author\":\"David Anson (https://dlaa.me/)\",\"license\":\"MIT\",\"homepage\":\"https://github.com/DavidAnson/markdownlint\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/DavidAnson/markdownlint.git\"},\"bugs\":\"https://github.com/DavidAnson/markdownlint/issues\",\"scripts\":{\"build-config\":\"npm run build-config-schema && npm run build-config-example\",\"build-config-example\":\"node schema/build-config-example.js\",\"build-config-schema\":\"node schema/build-config-schema.js\",\"build-declaration\":\"tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'\",\"build-demo\":\"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && webpack --no-stats\",\"build-example\":\"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2\",\"ci\":\"npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code\",\"clean-test-repos\":\"rimraf test-repos\",\"clone-test-repos\":\"mkdir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet\",\"clone-test-repos-large\":\"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet\",\"declaration\":\"npm run build-declaration && npm run test-declaration\",\"example\":\"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint\",\"lint\":\"eslint --max-warnings 0 .\",\"lint-test-repos\":\"ava --timeout=5m test/markdownlint-test-repos.js\",\"test\":\"ava test/markdownlint-test.js test/markdownlint-test-custom-rules.js test/markdownlint-test-helpers.js test/markdownlint-test-result-object.js test/markdownlint-test-scenarios.js\",\"test-cover\":\"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 npm test\",\"test-declaration\":\"cd example/typescript && tsc && node type-check.js\",\"test-extra\":\"ava --timeout=5m test/markdownlint-test-extra.js\"},\"engines\":{\"node\":\">=10\"},\"dependencies\":{\"markdown-it\":\"12.0.4\"},\"devDependencies\":{\"ava\":\"~3.15.0\",\"c8\":\"~7.5.0\",\"cpy-cli\":\"~3.1.1\",\"eslint\":\"~7.19.0\",\"eslint-plugin-jsdoc\":\"~31.6.0\",\"eslint-plugin-node\":\"~11.1.0\",\"eslint-plugin-unicorn\":\"~27.0.0\",\"globby\":\"~11.0.2\",\"js-yaml\":\"~4.0.0\",\"markdown-it-for-inline\":\"~0.1.1\",\"markdown-it-sub\":\"~1.0.0\",\"markdown-it-sup\":\"~1.0.0\",\"markdown-it-texmath\":\"~0.8.0\",\"markdownlint-rule-helpers\":\"~0.13.0\",\"npm-run-all\":\"~4.1.5\",\"rimraf\":\"~3.0.2\",\"strip-json-comments\":\"~3.1.1\",\"toml\":\"~3.0.0\",\"ts-loader\":\"~8.0.15\",\"tv4\":\"~1.3.0\",\"typescript\":\"~4.1.3\",\"webpack\":\"~5.21.1\",\"webpack-cli\":\"~4.5.0\"},\"keywords\":[\"markdown\",\"lint\",\"md\",\"CommonMark\",\"markdownlint\"]}");
/***/ }), /***/ }),

View file

@ -188,7 +188,7 @@ module.exports.fencedCodeBlockStyleFor =
*/ */
function indentFor(token) { function indentFor(token) {
const line = token.line.replace(/^[\s>]*(> |>)/, ""); const line = token.line.replace(/^[\s>]*(> |>)/, "");
return line.length - line.trimLeft().length; return line.length - line.trimStart().length;
} }
module.exports.indentFor = indentFor; module.exports.indentFor = indentFor;

View file

@ -51,10 +51,12 @@ function validateRuleList(ruleList) {
result = newError(property); result = newError(property);
} }
}); });
if (!result && rule.information) { if (
if (Object.getPrototypeOf(rule.information) !== URL.prototype) { !result &&
result = newError("information"); rule.information &&
} (Object.getPrototypeOf(rule.information) !== URL.prototype)
) {
result = newError("information");
} }
if (!result) { if (!result) {
rule.names.forEach(function forName(name) { rule.names.forEach(function forName(name) {
@ -721,6 +723,7 @@ function lintInput(options, synchronous, callback) {
// Normalize inputs // Normalize inputs
options = options || {}; options = options || {};
callback = callback || function noop() {}; callback = callback || function noop() {};
// eslint-disable-next-line unicorn/prefer-spread
const ruleList = rules.concat(options.customRules || []); const ruleList = rules.concat(options.customRules || []);
const ruleErr = validateRuleList(ruleList); const ruleErr = validateRuleList(ruleList);
if (ruleErr) { if (ruleErr) {

View file

@ -25,7 +25,7 @@ module.exports = {
null, null,
rangeFromRegExp(line, listItemMarkerRe), rangeFromRegExp(line, listItemMarkerRe),
{ {
"deleteCount": line.length - line.trimLeft().length "deleteCount": line.length - line.trimStart().length
}); });
}); });
} }

View file

@ -49,26 +49,30 @@ module.exports = {
const expected = (brSpaces < 2) ? 0 : brSpaces; const expected = (brSpaces < 2) ? 0 : brSpaces;
forEachLine(lineMetadata(), (line, lineIndex, inCode) => { forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
const lineNumber = lineIndex + 1; const lineNumber = lineIndex + 1;
const trailingSpaces = line.length - line.trimRight().length; const trailingSpaces = line.length - line.trimEnd().length;
if (trailingSpaces && !inCode && if (
!includesSorted(listItemLineNumbers, lineNumber)) { trailingSpaces &&
if ((expected !== trailingSpaces) || !inCode &&
(strict && !includesSorted(listItemLineNumbers, lineNumber) &&
(!includesSorted(paragraphLineNumbers, lineNumber) || (
includesSorted(codeInlineLineNumbers, lineNumber)))) { (expected !== trailingSpaces) ||
const column = line.length - trailingSpaces + 1; (strict &&
addError( (!includesSorted(paragraphLineNumbers, lineNumber) ||
onError, includesSorted(codeInlineLineNumbers, lineNumber)))
lineNumber, )
"Expected: " + (expected === 0 ? "" : "0 or ") + ) {
expected + "; Actual: " + trailingSpaces, const column = line.length - trailingSpaces + 1;
null, addError(
[ column, trailingSpaces ], onError,
{ lineNumber,
"editColumn": column, "Expected: " + (expected === 0 ? "" : "0 or ") +
"deleteCount": trailingSpaces expected + "; Actual: " + trailingSpaces,
}); null,
} [ column, trailingSpaces ],
{
"editColumn": column,
"deleteCount": trailingSpaces
});
} }
}); });
} }

View file

@ -17,7 +17,7 @@ module.exports = {
if (match) { if (match) {
const [ prefixAndFirstChar, prefix ] = match; const [ prefixAndFirstChar, prefix ] = match;
let deleteCount = prefix.length; let deleteCount = prefix.length;
const prefixLengthNoSpace = prefix.trimRight().length; const prefixLengthNoSpace = prefix.trimEnd().length;
if (prefixLengthNoSpace) { if (prefixLengthNoSpace) {
deleteCount -= prefixLengthNoSpace - 1; deleteCount -= prefixLengthNoSpace - 1;
} }

View file

@ -17,7 +17,7 @@ module.exports = {
const firstIndex = list.open.map[0]; const firstIndex = list.open.map[0];
if (!isBlankLine(lines[firstIndex - 1])) { if (!isBlankLine(lines[firstIndex - 1])) {
const line = lines[firstIndex]; const line = lines[firstIndex];
const quotePrefix = line.match(quotePrefixRe)[0].trimRight(); const quotePrefix = line.match(quotePrefixRe)[0].trimEnd();
addErrorContext( addErrorContext(
onError, onError,
firstIndex + 1, firstIndex + 1,
@ -32,7 +32,7 @@ module.exports = {
const lastIndex = list.lastLineIndex - 1; const lastIndex = list.lastLineIndex - 1;
if (!isBlankLine(lines[lastIndex + 1])) { if (!isBlankLine(lines[lastIndex + 1])) {
const line = lines[lastIndex]; const line = lines[lastIndex];
const quotePrefix = line.match(quotePrefixRe)[0].trimRight(); const quotePrefix = line.match(quotePrefixRe)[0].trimEnd();
addErrorContext( addErrorContext(
onError, onError,
lastIndex + 1, lastIndex + 1,

View file

@ -35,10 +35,10 @@ module.exports = {
// Close current run // Close current run
let content = line.substring(emphasisIndex, matchIndex); let content = line.substring(emphasisIndex, matchIndex);
if (!emphasisLength) { if (!emphasisLength) {
content = content.trimLeft(); content = content.trimStart();
} }
if (!match) { if (!match) {
content = content.trimRight(); content = content.trimEnd();
} }
const leftSpace = leftSpaceRe.test(content); const leftSpace = leftSpaceRe.test(content);
const rightSpace = rightSpaceRe.test(content); const rightSpace = rightSpaceRe.test(content);

View file

@ -24,8 +24,8 @@ module.exports = {
linkText = ""; linkText = "";
} else if (type === "link_close") { } else if (type === "link_close") {
inLink = false; inLink = false;
const left = linkText.trimLeft().length !== linkText.length; const left = linkText.trimStart().length !== linkText.length;
const right = linkText.trimRight().length !== linkText.length; const right = linkText.trimEnd().length !== linkText.length;
if (left || right) { if (left || right) {
const line = params.lines[lineNumber - 1]; const line = params.lines[lineNumber - 1];
let range = null; let range = null;

View file

@ -43,9 +43,9 @@
"c8": "~7.5.0", "c8": "~7.5.0",
"cpy-cli": "~3.1.1", "cpy-cli": "~3.1.1",
"eslint": "~7.19.0", "eslint": "~7.19.0",
"eslint-plugin-jsdoc": "~30.7.8", "eslint-plugin-jsdoc": "~31.6.0",
"eslint-plugin-node": "~11.1.0", "eslint-plugin-node": "~11.1.0",
"eslint-plugin-unicorn": "~23.0.0", "eslint-plugin-unicorn": "~27.0.0",
"globby": "~11.0.2", "globby": "~11.0.2",
"js-yaml": "~4.0.0", "js-yaml": "~4.0.0",
"markdown-it-for-inline": "~0.1.1", "markdown-it-for-inline": "~0.1.1",

View file

@ -60,7 +60,7 @@ function lintTestRepo(t, globPatterns, configPath) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(resultsString); console.log(resultsString);
} }
t.true(!resultsString.length, "Unexpected linting violations"); t.is(resultsString.length, 0, "Unexpected linting violations");
}); });
}); });
} }

View file

@ -887,6 +887,7 @@ test.cb("rules", (t) => {
const tagAliasParameterRe = /, |: | /; const tagAliasParameterRe = /, |: | /;
// eslint-disable-next-line func-style // eslint-disable-next-line func-style
const testTagsAliasesParams = (r) => { const testTagsAliasesParams = (r) => {
// eslint-disable-next-line unicorn/prefer-default-parameters
r = r || "[NO RULE]"; r = r || "[NO RULE]";
t.true(ruleHasTags, t.true(ruleHasTags,
"Missing tags for rule " + r.names + "."); "Missing tags for rule " + r.names + ".");