eslint-plugin-markdown-preferences 0.36.0 → 0.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -7
- package/lib/index.js +35 -20
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -373,7 +373,6 @@ type MarkdownPreferencesLinkBracketSpacing = [] | [{
|
|
|
373
373
|
type MarkdownPreferencesLinkDestinationStyle = [] | [{
|
|
374
374
|
style?: ("bare" | "pointy-brackets");
|
|
375
375
|
avoidEscape?: boolean;
|
|
376
|
-
[k: string]: unknown | undefined;
|
|
377
376
|
}];
|
|
378
377
|
type MarkdownPreferencesLinkParenNewline = [] | [{
|
|
379
378
|
newline?: ("always" | "never" | "consistent");
|
|
@@ -385,7 +384,6 @@ type MarkdownPreferencesLinkParenSpacing = [] | [{
|
|
|
385
384
|
type MarkdownPreferencesLinkTitleStyle = [] | [{
|
|
386
385
|
style?: ("double" | "single" | "parentheses");
|
|
387
386
|
avoidEscape?: boolean;
|
|
388
|
-
[k: string]: unknown | undefined;
|
|
389
387
|
}];
|
|
390
388
|
type MarkdownPreferencesListMarkerAlignment = [] | [{
|
|
391
389
|
align?: ("left" | "right");
|
|
@@ -438,9 +436,7 @@ type MarkdownPreferencesPreferInlineCodeWords = [] | [{
|
|
|
438
436
|
node?: {
|
|
439
437
|
[k: string]: unknown | undefined;
|
|
440
438
|
};
|
|
441
|
-
[k: string]: unknown | undefined;
|
|
442
439
|
}[];
|
|
443
|
-
[k: string]: unknown | undefined;
|
|
444
440
|
}];
|
|
445
441
|
type MarkdownPreferencesPreferLinkReferenceDefinitions = [] | [{
|
|
446
442
|
minLinks?: number;
|
|
@@ -454,9 +450,7 @@ type MarkdownPreferencesPreferLinkedWords = [] | [{
|
|
|
454
450
|
node?: {
|
|
455
451
|
[k: string]: unknown | undefined;
|
|
456
452
|
};
|
|
457
|
-
[k: string]: unknown | undefined;
|
|
458
453
|
}[];
|
|
459
|
-
[k: string]: unknown | undefined;
|
|
460
454
|
}];
|
|
461
455
|
type MarkdownPreferencesSetextHeadingUnderlineLength = [] | [{
|
|
462
456
|
mode?: ("exact" | "minimum" | "consistent" | "consistent-line-length");
|
|
@@ -545,7 +539,7 @@ declare namespace meta_d_exports {
|
|
|
545
539
|
export { name, version };
|
|
546
540
|
}
|
|
547
541
|
declare const name: "eslint-plugin-markdown-preferences";
|
|
548
|
-
declare const version: "0.36.
|
|
542
|
+
declare const version: "0.36.2";
|
|
549
543
|
//#endregion
|
|
550
544
|
//#region src/language/ast-types.d.ts
|
|
551
545
|
type Node = mdast.Node;
|
package/lib/index.js
CHANGED
|
@@ -40,7 +40,7 @@ function createRule(ruleName, rule) {
|
|
|
40
40
|
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/utils/ast.ts
|
|
43
|
-
const RE_HTML_COMMENT = /<!--(.*?)-->/
|
|
43
|
+
const RE_HTML_COMMENT = /<!--(.*?)-->/gu;
|
|
44
44
|
/**
|
|
45
45
|
* Get the parent of a node.
|
|
46
46
|
*/
|
|
@@ -138,17 +138,25 @@ function getThematicBreakMarker(sourceCode, node) {
|
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
|
-
*
|
|
141
|
+
* Get all HTML comments in a node.
|
|
142
142
|
*/
|
|
143
|
-
function
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
|
|
143
|
+
function getHTMLComments(sourceCode, node) {
|
|
144
|
+
const [startIndex] = sourceCode.getRange(node);
|
|
145
|
+
return [...iterate()];
|
|
146
|
+
/**
|
|
147
|
+
* An iterator which iterates HTML comments.
|
|
148
|
+
*/
|
|
149
|
+
function* iterate() {
|
|
150
|
+
let match;
|
|
151
|
+
while (match = RE_HTML_COMMENT.exec(node.value)) {
|
|
152
|
+
const start = startIndex + match.index;
|
|
153
|
+
const end = start + match[0].length;
|
|
154
|
+
yield {
|
|
155
|
+
value: match[1],
|
|
156
|
+
range: [start, end]
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
152
160
|
}
|
|
153
161
|
|
|
154
162
|
//#endregion
|
|
@@ -7075,7 +7083,8 @@ var link_destination_style_default = createRule("link-destination-style", {
|
|
|
7075
7083
|
properties: {
|
|
7076
7084
|
style: { enum: ["bare", "pointy-brackets"] },
|
|
7077
7085
|
avoidEscape: { type: "boolean" }
|
|
7078
|
-
}
|
|
7086
|
+
},
|
|
7087
|
+
additionalProperties: false
|
|
7079
7088
|
}],
|
|
7080
7089
|
messages: {
|
|
7081
7090
|
expectedBare: "Link destination should not be enclosed in pointy brackets.",
|
|
@@ -7509,7 +7518,8 @@ var link_title_style_default = createRule("link-title-style", {
|
|
|
7509
7518
|
"parentheses"
|
|
7510
7519
|
] },
|
|
7511
7520
|
avoidEscape: { type: "boolean" }
|
|
7512
|
-
}
|
|
7521
|
+
},
|
|
7522
|
+
additionalProperties: false
|
|
7513
7523
|
}],
|
|
7514
7524
|
messages: {
|
|
7515
7525
|
expectedDouble: "Expected link title to be double quoted.",
|
|
@@ -9503,9 +9513,14 @@ var padding_line_between_blocks_default = createRule("padding-line-between-block
|
|
|
9503
9513
|
* Check if the previous block is ignored
|
|
9504
9514
|
*/
|
|
9505
9515
|
function isIgnore(prevBlock) {
|
|
9506
|
-
if (
|
|
9507
|
-
const
|
|
9508
|
-
|
|
9516
|
+
if (prevBlock.type === "html") {
|
|
9517
|
+
const comments = getHTMLComments(sourceCode, prevBlock);
|
|
9518
|
+
const loc = sourceCode.getLoc(prevBlock);
|
|
9519
|
+
for (const comment of comments) {
|
|
9520
|
+
const value = comment.value;
|
|
9521
|
+
if (!/^\s*(?:eslint|markdownlint)-disable-next-line\b/u.test(value)) continue;
|
|
9522
|
+
if (sourceCode.getLocFromIndex(comment.range[1]).line === loc.end.line) return true;
|
|
9523
|
+
}
|
|
9509
9524
|
}
|
|
9510
9525
|
return false;
|
|
9511
9526
|
}
|
|
@@ -9674,7 +9689,7 @@ const IGNORES_SCHEMA = {
|
|
|
9674
9689
|
}] },
|
|
9675
9690
|
node: { type: "object" }
|
|
9676
9691
|
},
|
|
9677
|
-
additionalProperties:
|
|
9692
|
+
additionalProperties: false
|
|
9678
9693
|
}
|
|
9679
9694
|
};
|
|
9680
9695
|
/**
|
|
@@ -9737,7 +9752,7 @@ var prefer_inline_code_words_default = createRule("prefer-inline-code-words", {
|
|
|
9737
9752
|
ignores: IGNORES_SCHEMA
|
|
9738
9753
|
},
|
|
9739
9754
|
required: ["words"],
|
|
9740
|
-
additionalProperties:
|
|
9755
|
+
additionalProperties: false
|
|
9741
9756
|
}],
|
|
9742
9757
|
messages: { requireInlineCode: "The word \"{{name}}\" should be in inline code." }
|
|
9743
9758
|
},
|
|
@@ -9980,7 +9995,7 @@ var prefer_linked_words_default = createRule("prefer-linked-words", {
|
|
|
9980
9995
|
ignores: IGNORES_SCHEMA
|
|
9981
9996
|
},
|
|
9982
9997
|
required: ["words"],
|
|
9983
|
-
additionalProperties:
|
|
9998
|
+
additionalProperties: false
|
|
9984
9999
|
}],
|
|
9985
10000
|
messages: { requireLink: "The word \"{{name}}\" should be a link." }
|
|
9986
10001
|
},
|
|
@@ -12213,7 +12228,7 @@ var meta_exports = /* @__PURE__ */ __export({
|
|
|
12213
12228
|
version: () => version
|
|
12214
12229
|
});
|
|
12215
12230
|
const name = "eslint-plugin-markdown-preferences";
|
|
12216
|
-
const version = "0.36.
|
|
12231
|
+
const version = "0.36.2";
|
|
12217
12232
|
|
|
12218
12233
|
//#endregion
|
|
12219
12234
|
//#region src/language/extensions/micromark-custom-container.ts
|