eslint-plugin-markdown-preferences 0.37.0 → 0.39.0
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/README.md +12 -11
- package/lib/index.d.ts +38 -4
- package/lib/index.js +166 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -144,15 +144,16 @@ The rules with the following 💄 are included in the `standard` config.
|
|
|
144
144
|
|
|
145
145
|
<!-- prettier-ignore-start -->
|
|
146
146
|
|
|
147
|
-
| Rule ID
|
|
148
|
-
|
|
|
149
|
-
| [markdown-preferences/canonical-code-block-language](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/canonical-code-block-language.html)
|
|
150
|
-
| [markdown-preferences/emoji-notation](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/emoji-notation.html)
|
|
151
|
-
| [markdown-preferences/heading-casing](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/heading-casing.html)
|
|
152
|
-
| [markdown-preferences/
|
|
153
|
-
| [markdown-preferences/
|
|
154
|
-
| [markdown-preferences/prefer-
|
|
155
|
-
| [markdown-preferences/
|
|
147
|
+
| Rule ID | Description | Fixable | Config |
|
|
148
|
+
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------- | :-----: | :----: |
|
|
149
|
+
| [markdown-preferences/canonical-code-block-language](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/canonical-code-block-language.html) | enforce canonical language names in code blocks | 🔧 | |
|
|
150
|
+
| [markdown-preferences/emoji-notation](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/emoji-notation.html) | enforce consistent emoji notation style in Markdown files. | 🔧 | |
|
|
151
|
+
| [markdown-preferences/heading-casing](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/heading-casing.html) | enforce consistent casing in headings. | 🔧 | |
|
|
152
|
+
| [markdown-preferences/no-heading-trailing-punctuation](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-heading-trailing-punctuation.html) | disallow trailing punctuation in headings. | | |
|
|
153
|
+
| [markdown-preferences/ordered-list-marker-start](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/ordered-list-marker-start.html) | enforce that ordered list markers start with 1 or 0 | 🔧 | 💄 |
|
|
154
|
+
| [markdown-preferences/prefer-inline-code-words](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-inline-code-words.html) | enforce the use of inline code for specific words. | 🔧 | |
|
|
155
|
+
| [markdown-preferences/prefer-linked-words](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-linked-words.html) | enforce the specified word to be a link. | 🔧 | |
|
|
156
|
+
| [markdown-preferences/table-header-casing](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/table-header-casing.html) | enforce consistent casing in table header cells. | 🔧 | |
|
|
156
157
|
|
|
157
158
|
<!-- prettier-ignore-end -->
|
|
158
159
|
|
|
@@ -203,7 +204,7 @@ The rules with the following 💄 are included in the `standard` config.
|
|
|
203
204
|
| [markdown-preferences/list-marker-alignment](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/list-marker-alignment.html) | enforce consistent alignment of list markers | 🔧 | ⭐💄 |
|
|
204
205
|
| [markdown-preferences/no-multi-spaces](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-multi-spaces.html) | disallow multiple spaces | 🔧 | 💄 |
|
|
205
206
|
| [markdown-preferences/no-multiple-empty-lines](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-multiple-empty-lines.html) | disallow multiple empty lines in Markdown files. | 🔧 | 💄 |
|
|
206
|
-
| [markdown-preferences/no-tabs](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-tabs.html) |
|
|
207
|
+
| [markdown-preferences/no-tabs](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-tabs.html) | disallow tab characters in Markdown files. | 🔧 | 💄 |
|
|
207
208
|
| [markdown-preferences/no-trailing-spaces](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-trailing-spaces.html) | disallow trailing whitespace at the end of lines in Markdown files. | 🔧 | 💄 |
|
|
208
209
|
| [markdown-preferences/padded-custom-containers](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/padded-custom-containers.html) | disallow or require padding inside custom containers | 🔧 | 💄 |
|
|
209
210
|
| [markdown-preferences/padding-line-between-blocks](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/padding-line-between-blocks.html) | require or disallow padding lines between blocks | 🔧 | 💄 |
|
|
@@ -223,7 +224,7 @@ The rules with the following 💄 are included in the `standard` config.
|
|
|
223
224
|
| [markdown-preferences/atx-heading-closing-sequence](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/atx-heading-closing-sequence.html) | enforce consistent use of closing sequence in ATX headings. | 🔧 | 💄 |
|
|
224
225
|
| [markdown-preferences/code-fence-length](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/code-fence-length.html) | enforce consistent code fence length in fenced code blocks. | 🔧 | 💄 |
|
|
225
226
|
| [markdown-preferences/no-laziness-blockquotes](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-laziness-blockquotes.html) | disallow laziness in blockquotes | | ⭐💄 |
|
|
226
|
-
| [markdown-preferences/ordered-list-marker-sequence](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/ordered-list-marker-sequence.html) | enforce
|
|
227
|
+
| [markdown-preferences/ordered-list-marker-sequence](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/ordered-list-marker-sequence.html) | enforce consistent ordered list marker numbering (sequential or flat) | 🔧 | 💄 |
|
|
227
228
|
| [markdown-preferences/setext-heading-underline-length](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/setext-heading-underline-length.html) | enforce setext heading underline length | 🔧 | 💄 |
|
|
228
229
|
| [markdown-preferences/sort-definitions](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/sort-definitions.html) | enforce a specific order for link definitions and footnote definitions | 🔧 | 💄 |
|
|
229
230
|
| [markdown-preferences/table-leading-trailing-pipes](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/table-leading-trailing-pipes.html) | enforce consistent use of leading and trailing pipes in tables. | 🔧 | 💄 |
|
package/lib/index.d.ts
CHANGED
|
@@ -140,6 +140,11 @@ interface RuleOptions {
|
|
|
140
140
|
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/list-marker-alignment.html
|
|
141
141
|
*/
|
|
142
142
|
'markdown-preferences/list-marker-alignment'?: Linter.RuleEntry<MarkdownPreferencesListMarkerAlignment>;
|
|
143
|
+
/**
|
|
144
|
+
* disallow trailing punctuation in headings.
|
|
145
|
+
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-heading-trailing-punctuation.html
|
|
146
|
+
*/
|
|
147
|
+
'markdown-preferences/no-heading-trailing-punctuation'?: Linter.RuleEntry<MarkdownPreferencesNoHeadingTrailingPunctuation>;
|
|
143
148
|
/**
|
|
144
149
|
* disallow implicit block closing for fenced code blocks, math blocks, and custom containers
|
|
145
150
|
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-implicit-block-closing.html
|
|
@@ -161,7 +166,7 @@ interface RuleOptions {
|
|
|
161
166
|
*/
|
|
162
167
|
'markdown-preferences/no-multiple-empty-lines'?: Linter.RuleEntry<MarkdownPreferencesNoMultipleEmptyLines>;
|
|
163
168
|
/**
|
|
164
|
-
*
|
|
169
|
+
* disallow tab characters in Markdown files.
|
|
165
170
|
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-tabs.html
|
|
166
171
|
*/
|
|
167
172
|
'markdown-preferences/no-tabs'?: Linter.RuleEntry<MarkdownPreferencesNoTabs>;
|
|
@@ -176,10 +181,10 @@ interface RuleOptions {
|
|
|
176
181
|
*/
|
|
177
182
|
'markdown-preferences/no-trailing-spaces'?: Linter.RuleEntry<MarkdownPreferencesNoTrailingSpaces>;
|
|
178
183
|
/**
|
|
179
|
-
* enforce
|
|
184
|
+
* enforce consistent ordered list marker numbering (sequential or flat)
|
|
180
185
|
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/ordered-list-marker-sequence.html
|
|
181
186
|
*/
|
|
182
|
-
'markdown-preferences/ordered-list-marker-sequence'?: Linter.RuleEntry<
|
|
187
|
+
'markdown-preferences/ordered-list-marker-sequence'?: Linter.RuleEntry<MarkdownPreferencesOrderedListMarkerSequence>;
|
|
183
188
|
/**
|
|
184
189
|
* enforce that ordered list markers start with 1 or 0
|
|
185
190
|
* @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/ordered-list-marker-start.html
|
|
@@ -398,6 +403,32 @@ type MarkdownPreferencesLinkTitleStyle = [] | [{
|
|
|
398
403
|
type MarkdownPreferencesListMarkerAlignment = [] | [{
|
|
399
404
|
align?: ("left" | "right");
|
|
400
405
|
}];
|
|
406
|
+
type MarkdownPreferencesNoHeadingTrailingPunctuation = [] | [{
|
|
407
|
+
punctuation?: (string | {
|
|
408
|
+
"1"?: string;
|
|
409
|
+
"2"?: string;
|
|
410
|
+
"3"?: string;
|
|
411
|
+
"4"?: string;
|
|
412
|
+
"5"?: string;
|
|
413
|
+
"6"?: string;
|
|
414
|
+
default?: string;
|
|
415
|
+
"1-2"?: string;
|
|
416
|
+
"1-3"?: string;
|
|
417
|
+
"1-4"?: string;
|
|
418
|
+
"1-5"?: string;
|
|
419
|
+
"1-6"?: string;
|
|
420
|
+
"2-3"?: string;
|
|
421
|
+
"2-4"?: string;
|
|
422
|
+
"2-5"?: string;
|
|
423
|
+
"2-6"?: string;
|
|
424
|
+
"3-4"?: string;
|
|
425
|
+
"3-5"?: string;
|
|
426
|
+
"3-6"?: string;
|
|
427
|
+
"4-5"?: string;
|
|
428
|
+
"4-6"?: string;
|
|
429
|
+
"5-6"?: string;
|
|
430
|
+
});
|
|
431
|
+
}];
|
|
401
432
|
type MarkdownPreferencesNoMultipleEmptyLines = [] | [{
|
|
402
433
|
max?: number;
|
|
403
434
|
maxEOF?: number;
|
|
@@ -412,6 +443,9 @@ type MarkdownPreferencesNoTrailingSpaces = [] | [{
|
|
|
412
443
|
skipBlankLines?: boolean;
|
|
413
444
|
ignoreComments?: boolean;
|
|
414
445
|
}];
|
|
446
|
+
type MarkdownPreferencesOrderedListMarkerSequence = [] | [{
|
|
447
|
+
increment?: ("always" | "never");
|
|
448
|
+
}];
|
|
415
449
|
type MarkdownPreferencesOrderedListMarkerStart = [] | [{
|
|
416
450
|
start?: (1 | 0);
|
|
417
451
|
}];
|
|
@@ -553,7 +587,7 @@ declare namespace meta_d_exports {
|
|
|
553
587
|
export { name, version };
|
|
554
588
|
}
|
|
555
589
|
declare const name: "eslint-plugin-markdown-preferences";
|
|
556
|
-
declare const version: "0.
|
|
590
|
+
declare const version: "0.39.0";
|
|
557
591
|
//#endregion
|
|
558
592
|
//#region src/language/ast-types.d.ts
|
|
559
593
|
type Node = mdast.Node;
|
package/lib/index.js
CHANGED
|
@@ -7690,6 +7690,153 @@ var list_marker_alignment_default = createRule("list-marker-alignment", {
|
|
|
7690
7690
|
}
|
|
7691
7691
|
});
|
|
7692
7692
|
|
|
7693
|
+
//#endregion
|
|
7694
|
+
//#region src/rules/no-heading-trailing-punctuation.ts
|
|
7695
|
+
const DEFAULT_PUNCTUATION = ".,;:!。、,;:!。、";
|
|
7696
|
+
const LEVEL_RANGE_MAP = {
|
|
7697
|
+
"1": [1, 1],
|
|
7698
|
+
"2": [2, 2],
|
|
7699
|
+
"3": [3, 3],
|
|
7700
|
+
"4": [4, 4],
|
|
7701
|
+
"5": [5, 5],
|
|
7702
|
+
"6": [6, 6],
|
|
7703
|
+
"1-2": [1, 2],
|
|
7704
|
+
"1-3": [1, 3],
|
|
7705
|
+
"1-4": [1, 4],
|
|
7706
|
+
"1-5": [1, 5],
|
|
7707
|
+
"1-6": [1, 6],
|
|
7708
|
+
"2-3": [2, 3],
|
|
7709
|
+
"2-4": [2, 4],
|
|
7710
|
+
"2-5": [2, 5],
|
|
7711
|
+
"2-6": [2, 6],
|
|
7712
|
+
"3-4": [3, 4],
|
|
7713
|
+
"3-5": [3, 5],
|
|
7714
|
+
"3-6": [3, 6],
|
|
7715
|
+
"4-5": [4, 5],
|
|
7716
|
+
"4-6": [4, 6],
|
|
7717
|
+
"5-6": [5, 6]
|
|
7718
|
+
};
|
|
7719
|
+
const HEADING_LEVELS = [
|
|
7720
|
+
1,
|
|
7721
|
+
2,
|
|
7722
|
+
3,
|
|
7723
|
+
4,
|
|
7724
|
+
5,
|
|
7725
|
+
6
|
|
7726
|
+
];
|
|
7727
|
+
/**
|
|
7728
|
+
* Parse heading level ranges and build a map of level -> punctuation string
|
|
7729
|
+
*/
|
|
7730
|
+
function buildPunctuationMap(option, segmenter$1) {
|
|
7731
|
+
if (typeof option === "string" || option === void 0) {
|
|
7732
|
+
const punctuation = option ?? DEFAULT_PUNCTUATION;
|
|
7733
|
+
const chars = new Set([...segmenter$1.segment(punctuation)].map((s) => s.segment));
|
|
7734
|
+
return Object.fromEntries(HEADING_LEVELS.map((level) => [level, chars]));
|
|
7735
|
+
}
|
|
7736
|
+
const defaultPunctuation = option.default ?? DEFAULT_PUNCTUATION;
|
|
7737
|
+
const defaultChars = new Set([...segmenter$1.segment(defaultPunctuation)].map((s) => s.segment));
|
|
7738
|
+
const map = Object.fromEntries(HEADING_LEVELS.map((level) => [level, defaultChars]));
|
|
7739
|
+
for (const [key, value] of Object.entries(option)) {
|
|
7740
|
+
if (key === "default" || value == null) continue;
|
|
7741
|
+
const range = LEVEL_RANGE_MAP[key];
|
|
7742
|
+
if (!range) continue;
|
|
7743
|
+
const chars = new Set([...segmenter$1.segment(value)].map((s) => s.segment));
|
|
7744
|
+
for (let level = range[0]; level <= range[1]; level++) map[level] = chars;
|
|
7745
|
+
}
|
|
7746
|
+
return map;
|
|
7747
|
+
}
|
|
7748
|
+
var no_heading_trailing_punctuation_default = createRule("no-heading-trailing-punctuation", {
|
|
7749
|
+
meta: {
|
|
7750
|
+
type: "suggestion",
|
|
7751
|
+
docs: {
|
|
7752
|
+
description: "disallow trailing punctuation in headings.",
|
|
7753
|
+
categories: [],
|
|
7754
|
+
listCategory: "Preference"
|
|
7755
|
+
},
|
|
7756
|
+
hasSuggestions: true,
|
|
7757
|
+
schema: [{
|
|
7758
|
+
type: "object",
|
|
7759
|
+
properties: { punctuation: { oneOf: [{
|
|
7760
|
+
type: "string",
|
|
7761
|
+
description: "String of punctuation characters to disallow at the end of headings."
|
|
7762
|
+
}, {
|
|
7763
|
+
type: "object",
|
|
7764
|
+
properties: {
|
|
7765
|
+
default: {
|
|
7766
|
+
type: "string",
|
|
7767
|
+
description: "Default punctuation characters for all heading levels."
|
|
7768
|
+
},
|
|
7769
|
+
...Object.fromEntries(Object.entries(LEVEL_RANGE_MAP).map(([key, [start, end]]) => [key, {
|
|
7770
|
+
type: "string",
|
|
7771
|
+
description: start === end ? `Punctuation characters for heading level ${start}.` : `Punctuation characters for heading levels ${start} to ${end}.`
|
|
7772
|
+
}]))
|
|
7773
|
+
},
|
|
7774
|
+
additionalProperties: false
|
|
7775
|
+
}] } },
|
|
7776
|
+
additionalProperties: false
|
|
7777
|
+
}],
|
|
7778
|
+
messages: {
|
|
7779
|
+
trailingPunctuation: "Headings should not end with punctuation '{{char}}'.",
|
|
7780
|
+
removePunctuation: "Remove trailing punctuation '{{char}}'."
|
|
7781
|
+
}
|
|
7782
|
+
},
|
|
7783
|
+
create(context) {
|
|
7784
|
+
const sourceCode = context.sourceCode;
|
|
7785
|
+
const segmenter$1 = new Intl.Segmenter("en", { granularity: "grapheme" });
|
|
7786
|
+
const punctuationMap = buildPunctuationMap(context.options[0]?.punctuation, segmenter$1);
|
|
7787
|
+
return { heading(node) {
|
|
7788
|
+
if (!node.children.length) return;
|
|
7789
|
+
const punctuationChars = punctuationMap[node.depth];
|
|
7790
|
+
if (punctuationChars.size === 0) return;
|
|
7791
|
+
const lastTextNode = findLastTextNode(node.children);
|
|
7792
|
+
if (!lastTextNode) return;
|
|
7793
|
+
const trimmedText = sourceCode.getText(lastTextNode).trimEnd();
|
|
7794
|
+
if (!trimmedText.length) return;
|
|
7795
|
+
const segments = [...segmenter$1.segment(trimmedText)];
|
|
7796
|
+
const lastSegment = segments[segments.length - 1];
|
|
7797
|
+
if (!lastSegment) return;
|
|
7798
|
+
const lastChar = lastSegment.segment;
|
|
7799
|
+
if (!punctuationChars.has(lastChar)) return;
|
|
7800
|
+
const [nodeStart] = sourceCode.getRange(lastTextNode);
|
|
7801
|
+
const punctuationIndex = nodeStart + lastSegment.index;
|
|
7802
|
+
context.report({
|
|
7803
|
+
node: lastTextNode,
|
|
7804
|
+
messageId: "trailingPunctuation",
|
|
7805
|
+
data: { char: lastChar },
|
|
7806
|
+
loc: {
|
|
7807
|
+
start: sourceCode.getLocFromIndex(punctuationIndex),
|
|
7808
|
+
end: sourceCode.getLocFromIndex(punctuationIndex + lastChar.length)
|
|
7809
|
+
},
|
|
7810
|
+
suggest: [{
|
|
7811
|
+
messageId: "removePunctuation",
|
|
7812
|
+
data: { char: lastChar },
|
|
7813
|
+
fix(fixer) {
|
|
7814
|
+
return fixer.removeRange([punctuationIndex, punctuationIndex + lastChar.length]);
|
|
7815
|
+
}
|
|
7816
|
+
}]
|
|
7817
|
+
});
|
|
7818
|
+
} };
|
|
7819
|
+
/**
|
|
7820
|
+
* Find the last text node within a node's children.
|
|
7821
|
+
* Recursively traverses nested structures (emphasis, strong, link, etc.).
|
|
7822
|
+
*/
|
|
7823
|
+
function findLastTextNode(children) {
|
|
7824
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
7825
|
+
const child = children[i];
|
|
7826
|
+
if (child.type === "text") {
|
|
7827
|
+
if (child.value.trim()) return child;
|
|
7828
|
+
continue;
|
|
7829
|
+
}
|
|
7830
|
+
if ("children" in child && Array.isArray(child.children)) {
|
|
7831
|
+
const nestedLast = findLastTextNode(child.children);
|
|
7832
|
+
if (nestedLast) return nestedLast;
|
|
7833
|
+
}
|
|
7834
|
+
}
|
|
7835
|
+
return null;
|
|
7836
|
+
}
|
|
7837
|
+
}
|
|
7838
|
+
});
|
|
7839
|
+
|
|
7693
7840
|
//#endregion
|
|
7694
7841
|
//#region src/rules/no-implicit-block-closing.ts
|
|
7695
7842
|
var no_implicit_block_closing_default = createRule("no-implicit-block-closing", {
|
|
@@ -8504,7 +8651,7 @@ var no_tabs_default = createRule("no-tabs", {
|
|
|
8504
8651
|
meta: {
|
|
8505
8652
|
type: "layout",
|
|
8506
8653
|
docs: {
|
|
8507
|
-
description: "
|
|
8654
|
+
description: "disallow tab characters in Markdown files.",
|
|
8508
8655
|
categories: ["standard"],
|
|
8509
8656
|
listCategory: "Whitespace"
|
|
8510
8657
|
},
|
|
@@ -8824,13 +8971,17 @@ var ordered_list_marker_sequence_default = createRule("ordered-list-marker-seque
|
|
|
8824
8971
|
meta: {
|
|
8825
8972
|
type: "layout",
|
|
8826
8973
|
docs: {
|
|
8827
|
-
description: "enforce
|
|
8974
|
+
description: "enforce consistent ordered list marker numbering (sequential or flat)",
|
|
8828
8975
|
categories: ["standard"],
|
|
8829
8976
|
listCategory: "Decorative"
|
|
8830
8977
|
},
|
|
8831
8978
|
fixable: "code",
|
|
8832
8979
|
hasSuggestions: true,
|
|
8833
|
-
schema: [
|
|
8980
|
+
schema: [{
|
|
8981
|
+
type: "object",
|
|
8982
|
+
properties: { increment: { enum: ["always", "never"] } },
|
|
8983
|
+
additionalProperties: false
|
|
8984
|
+
}],
|
|
8834
8985
|
messages: {
|
|
8835
8986
|
inconsistent: "Ordered list marker should be '{{expected}}' but found '{{actual}}'.",
|
|
8836
8987
|
inconsistentStart: "Ordered list start should be {{expected}} but found '{{actual}}'.",
|
|
@@ -8839,6 +8990,7 @@ var ordered_list_marker_sequence_default = createRule("ordered-list-marker-seque
|
|
|
8839
8990
|
},
|
|
8840
8991
|
create(context) {
|
|
8841
8992
|
const sourceCode = context.sourceCode;
|
|
8993
|
+
const incrementMode = (context.options[0] || {}).increment ?? "always";
|
|
8842
8994
|
let scope = {
|
|
8843
8995
|
node: sourceCode.ast,
|
|
8844
8996
|
upper: null,
|
|
@@ -8849,9 +9001,13 @@ var ordered_list_marker_sequence_default = createRule("ordered-list-marker-seque
|
|
|
8849
9001
|
*/
|
|
8850
9002
|
function verifyStartSequence(node, marker) {
|
|
8851
9003
|
if (node.start == null || node.start <= 1) return true;
|
|
8852
|
-
if (scope.last != null && scope.last.sequence + 1 === node.start && marker.kind === scope.last.kind) return true;
|
|
8853
9004
|
const expected = [0, 1];
|
|
8854
|
-
if (
|
|
9005
|
+
if (incrementMode !== "never") {
|
|
9006
|
+
if (scope.last != null && marker.kind === scope.last.kind) {
|
|
9007
|
+
if (scope.last.sequence + 1 === node.start) return true;
|
|
9008
|
+
if (scope.last.sequence + 1 > 1) expected.push(scope.last.sequence + 1);
|
|
9009
|
+
}
|
|
9010
|
+
}
|
|
8855
9011
|
const suggest = [];
|
|
8856
9012
|
for (const n of [...expected].sort((a, b) => Math.abs(node.start - a) - Math.abs(node.start - b))) suggest.push({
|
|
8857
9013
|
messageId: "suggestStartFromN",
|
|
@@ -8869,7 +9025,7 @@ var ordered_list_marker_sequence_default = createRule("ordered-list-marker-seque
|
|
|
8869
9025
|
expected: new Intl.ListFormat("en-US", { type: "disjunction" }).format(expected.map((n) => `'${n}'`)),
|
|
8870
9026
|
actual: marker.sequence.raw
|
|
8871
9027
|
},
|
|
8872
|
-
fix: scope.last == null ? (fixer) => {
|
|
9028
|
+
fix: scope.last == null || incrementMode === "never" ? (fixer) => {
|
|
8873
9029
|
const expectedMarker = `1${marker.kind}`;
|
|
8874
9030
|
const range = sourceCode.getRange(node);
|
|
8875
9031
|
return fixer.replaceTextRange([range[0], range[0] + marker.raw.length], expectedMarker);
|
|
@@ -8883,11 +9039,11 @@ var ordered_list_marker_sequence_default = createRule("ordered-list-marker-seque
|
|
|
8883
9039
|
*/
|
|
8884
9040
|
function verifyListItems(node) {
|
|
8885
9041
|
if (node.start == null) return;
|
|
8886
|
-
for (let i =
|
|
9042
|
+
for (let i = 1; i < node.children.length; i++) {
|
|
8887
9043
|
const item = node.children[i];
|
|
8888
9044
|
const marker = getListItemMarker(sourceCode, item);
|
|
8889
9045
|
if (marker.kind !== "." && marker.kind !== ")") continue;
|
|
8890
|
-
const expectedSequence = node.start + i;
|
|
9046
|
+
const expectedSequence = incrementMode === "never" ? node.start : node.start + i;
|
|
8891
9047
|
if (marker.sequence.value !== expectedSequence) {
|
|
8892
9048
|
const expectedMarker = `${expectedSequence}${marker.kind}`;
|
|
8893
9049
|
context.report({
|
|
@@ -12260,6 +12416,7 @@ const rules$1 = [
|
|
|
12260
12416
|
link_paren_spacing_default,
|
|
12261
12417
|
link_title_style_default,
|
|
12262
12418
|
list_marker_alignment_default,
|
|
12419
|
+
no_heading_trailing_punctuation_default,
|
|
12263
12420
|
no_implicit_block_closing_default,
|
|
12264
12421
|
no_laziness_blockquotes_default,
|
|
12265
12422
|
no_multi_spaces_default,
|
|
@@ -12393,7 +12550,7 @@ var meta_exports = /* @__PURE__ */ __export({
|
|
|
12393
12550
|
version: () => version
|
|
12394
12551
|
});
|
|
12395
12552
|
const name = "eslint-plugin-markdown-preferences";
|
|
12396
|
-
const version = "0.
|
|
12553
|
+
const version = "0.39.0";
|
|
12397
12554
|
|
|
12398
12555
|
//#endregion
|
|
12399
12556
|
//#region src/language/extensions/micromark-custom-container.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-markdown-preferences",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "ESLint plugin that enforces our markdown preferences",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"eslint-plugin-json-schema-validator": "^5.5.0",
|
|
106
106
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
107
107
|
"eslint-plugin-markdown": "^5.1.0",
|
|
108
|
-
"eslint-plugin-markdown-links": "^0.
|
|
108
|
+
"eslint-plugin-markdown-links": "^0.7.0",
|
|
109
109
|
"eslint-plugin-n": "^17.16.2",
|
|
110
110
|
"eslint-plugin-node-dependencies": "^1.0.0",
|
|
111
111
|
"eslint-plugin-prettier": "^5.2.3",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"stylelint-config-recommended-vue": "^1.6.0",
|
|
127
127
|
"stylelint-config-standard": "^39.0.0",
|
|
128
128
|
"stylelint-config-standard-vue": "^1.0.0",
|
|
129
|
-
"tsdown": "^0.
|
|
129
|
+
"tsdown": "^0.17.0",
|
|
130
130
|
"tsx": "^4.19.3",
|
|
131
131
|
"twoslash-eslint": "^0.3.1",
|
|
132
132
|
"type-fest": "^5.0.0",
|