Update new rule MD059/descriptive-link-text for project-level consistency.

This commit is contained in:
David Anson 2025-02-13 22:07:27 -08:00
parent b8374ec5d2
commit 571c2353ea
23 changed files with 466 additions and 383 deletions

View file

@ -1,6 +1,6 @@
// @ts-check
import { addErrorContext, newLineRe } from "../helpers/helpers.cjs";
import { addErrorContext } from "../helpers/helpers.cjs";
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
@ -32,7 +32,7 @@ export default {
const endSpaces = endCount > 0;
// Check if safe to remove 1-space padding
const removePadding = startSpaces && endSpaces && startPadding && endPadding && !startBacktick && !endBacktick;
const context = codeText.text.replace(newLineRe, "\n");
const context = codeText.text;
// If extra space at start, report violation
if (startSpaces) {
const startColumn = (removePadding ? startPadding : startData).startColumn;