eslint-markdown 0.13.0 → 0.14.1
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/build/core/constants.d.ts +18 -2
- package/build/core/constants.js +37 -2
- package/build/core/utils/index.d.ts +2 -1
- package/build/core/utils/index.js +2 -1
- package/build/core/utils/normalize-regex-pattern.d.ts +11 -0
- package/build/core/utils/normalize-regex-pattern.js +16 -0
- package/build/index.d.ts +109 -26
- package/build/index.js +3 -3
- package/build/rules/allow-heading.d.ts +87 -15
- package/build/rules/allow-heading.js +19 -13
- package/build/rules/allow-image-url.d.ts +37 -5
- package/build/rules/allow-image-url.js +24 -6
- package/build/rules/allow-link-url.d.ts +37 -5
- package/build/rules/allow-link-url.js +24 -6
- package/build/rules/code-lang-shorthand.d.ts +19 -4
- package/build/rules/consistent-code-style.d.ts +17 -1
- package/build/rules/consistent-code-style.js +2 -1
- package/build/rules/consistent-delete-style.d.ts +14 -3
- package/build/rules/consistent-delete-style.js +5 -1
- package/build/rules/consistent-emphasis-style.d.ts +14 -3
- package/build/rules/consistent-emphasis-style.js +5 -1
- package/build/rules/consistent-strong-style.d.ts +14 -3
- package/build/rules/consistent-strong-style.js +5 -1
- package/build/rules/consistent-thematic-break-style.d.ts +14 -3
- package/build/rules/consistent-unordered-list-style.d.ts +18 -4
- package/build/rules/consistent-unordered-list-style.js +2 -1
- package/build/rules/index.d.ts +109 -26
- package/build/rules/index.js +0 -2
- package/build/rules/no-consecutive-blank-line.d.ts +19 -4
- package/build/rules/no-control-character.d.ts +17 -0
- package/build/rules/no-curly-quote.d.ts +19 -0
- package/build/rules/no-double-punctuation.d.ts +14 -3
- package/build/rules/no-double-space.d.ts +12 -3
- package/build/rules/no-emoji.d.ts +14 -3
- package/build/rules/no-git-conflict-marker.d.ts +12 -3
- package/build/rules/no-irregular-dash.d.ts +17 -0
- package/build/rules/no-irregular-whitespace.d.ts +17 -0
- package/build/rules/no-tab.d.ts +15 -0
- package/build/rules/no-trailing-heading-punctuation.d.ts +12 -3
- package/build/rules/no-trailing-heading-punctuation.js +3 -5
- package/build/rules/require-heading-id.d.ts +21 -0
- package/build/rules/require-image-title.d.ts +14 -3
- package/build/rules/require-link-title.d.ts +14 -3
- package/package.json +1 -1
- package/build/rules/no-bold-paragraph.d.ts +0 -30
- package/build/rules/no-bold-paragraph.js +0 -48
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview This file declares constants used throughout the `eslint-markdown` package.
|
|
3
3
|
*/
|
|
4
|
-
export declare const PKG_NAME: "eslint-markdown";
|
|
5
|
-
export declare const PKG_VERSION: string;
|
|
6
4
|
export declare const URL_RULE_DOCS: (ruleName?: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* This pattern is based on the punctuation list used by `markdownlint` and `remark-lint`.
|
|
7
|
+
* @see https://github.com/DavidAnson/markdownlint/blob/v0.41.1/helpers/helpers.cjs#L41
|
|
8
|
+
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation#parameters
|
|
9
|
+
*/
|
|
10
|
+
export declare const punctuation: readonly [".", ",", ";", ":", "!", "。", ",", ";", ":", "!"];
|
|
11
|
+
/**
|
|
12
|
+
* This pattern is based on the punctuation list used by `markdownlint` and `remark-lint`.
|
|
13
|
+
* @see https://github.com/DavidAnson/markdownlint/blob/v0.41.1/helpers/helpers.cjs#L41
|
|
14
|
+
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation#parameters
|
|
15
|
+
*/
|
|
16
|
+
export declare const punctuationWithQuestionMark: readonly [".", ",", ";", ":", "!", "。", ",", ";", ":", "!", "?", "?"];
|
|
17
|
+
/**
|
|
18
|
+
* Regular expression for identifying a GitHub emoji code.
|
|
19
|
+
* - NOTE: These patterns are based on the `markdownlint`.
|
|
20
|
+
* @see https://github.com/DavidAnson/markdownlint/blob/v0.41.1/helpers/helpers.cjs#L36-L38
|
|
21
|
+
*/
|
|
22
|
+
export declare const gemojiRegex: RegExp;
|
package/build/core/constants.js
CHANGED
|
@@ -8,6 +8,41 @@ import pkg from '../../package.json' with { type: 'json' };
|
|
|
8
8
|
// --------------------------------------------------------------------------------
|
|
9
9
|
// Export
|
|
10
10
|
// --------------------------------------------------------------------------------
|
|
11
|
-
export const PKG_NAME = pkg.name;
|
|
12
|
-
export const PKG_VERSION = pkg.version;
|
|
13
11
|
export const URL_RULE_DOCS = (ruleName = '') => `${pkg.homepage}/docs/rules/${ruleName}`;
|
|
12
|
+
// --------------------------------------------------------------------------------
|
|
13
|
+
// #region array
|
|
14
|
+
/**
|
|
15
|
+
* This pattern is based on the punctuation list used by `markdownlint` and `remark-lint`.
|
|
16
|
+
* @see https://github.com/DavidAnson/markdownlint/blob/v0.41.1/helpers/helpers.cjs#L41
|
|
17
|
+
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation#parameters
|
|
18
|
+
*/
|
|
19
|
+
export const punctuation = [
|
|
20
|
+
'.',
|
|
21
|
+
',',
|
|
22
|
+
';',
|
|
23
|
+
':',
|
|
24
|
+
'!',
|
|
25
|
+
'。',
|
|
26
|
+
',',
|
|
27
|
+
';',
|
|
28
|
+
':',
|
|
29
|
+
'!',
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* This pattern is based on the punctuation list used by `markdownlint` and `remark-lint`.
|
|
33
|
+
* @see https://github.com/DavidAnson/markdownlint/blob/v0.41.1/helpers/helpers.cjs#L41
|
|
34
|
+
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-punctuation#parameters
|
|
35
|
+
*/
|
|
36
|
+
export const punctuationWithQuestionMark = [...punctuation, '?', '?'];
|
|
37
|
+
// #endregion array
|
|
38
|
+
// --------------------------------------------------------------------------------
|
|
39
|
+
// --------------------------------------------------------------------------------
|
|
40
|
+
// #region regex
|
|
41
|
+
/**
|
|
42
|
+
* Regular expression for identifying a GitHub emoji code.
|
|
43
|
+
* - NOTE: These patterns are based on the `markdownlint`.
|
|
44
|
+
* @see https://github.com/DavidAnson/markdownlint/blob/v0.41.1/helpers/helpers.cjs#L36-L38
|
|
45
|
+
*/
|
|
46
|
+
export const gemojiRegex = /:(?:[abmovx]|[-+]1|100|1234|(?:1st|2nd|3rd)_place_medal|8ball|clock\d{1,4}|e-mail|non-potable_water|o2|t-rex|u5272|u5408|u55b6|u6307|u6708|u6709|u6e80|u7121|u7533|u7981|u7a7a|[a-z]{2,15}2?|[a-z]{1,14}(?:_[a-z\d]{1,16})+):/;
|
|
47
|
+
// #endregion regex
|
|
48
|
+
// --------------------------------------------------------------------------------
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import escapeStringRegexp from './escape-string-regexp.js';
|
|
2
2
|
import getElementsByTagName from './html.js';
|
|
3
3
|
import isBlankLine from './is-blank-line.js';
|
|
4
|
+
import normalizeRegexPattern from './normalize-regex-pattern.js';
|
|
4
5
|
import SkipRanges from './skip-ranges.js';
|
|
5
6
|
import testRegexStateless from './test-regex-stateless.js';
|
|
6
|
-
export { escapeStringRegexp, getElementsByTagName, isBlankLine, SkipRanges, testRegexStateless, };
|
|
7
|
+
export { escapeStringRegexp, getElementsByTagName, isBlankLine, normalizeRegexPattern, SkipRanges, testRegexStateless, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import escapeStringRegexp from './escape-string-regexp.js';
|
|
2
2
|
import getElementsByTagName from './html.js';
|
|
3
3
|
import isBlankLine from './is-blank-line.js';
|
|
4
|
+
import normalizeRegexPattern from './normalize-regex-pattern.js';
|
|
4
5
|
import SkipRanges from './skip-ranges.js';
|
|
5
6
|
import testRegexStateless from './test-regex-stateless.js';
|
|
6
|
-
export { escapeStringRegexp, getElementsByTagName, isBlankLine, SkipRanges, testRegexStateless, };
|
|
7
|
+
export { escapeStringRegexp, getElementsByTagName, isBlankLine, normalizeRegexPattern, SkipRanges, testRegexStateless, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Utility to normalize a pattern option into a `RegExp`.
|
|
3
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v73.0.0/rules/filename-case.js#L276-L282
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Normalizes a pattern option into a `RegExp`.
|
|
7
|
+
* String patterns are compiled with the `u` flag.
|
|
8
|
+
* @param pattern `RegExp` or string pattern to normalize.
|
|
9
|
+
* @returns The normalized `RegExp`.
|
|
10
|
+
*/
|
|
11
|
+
export default function normalizeRegexPattern(pattern: RegExp | string): RegExp;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Utility to normalize a pattern option into a `RegExp`.
|
|
3
|
+
* @see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v73.0.0/rules/filename-case.js#L276-L282
|
|
4
|
+
*/
|
|
5
|
+
// --------------------------------------------------------------------------------
|
|
6
|
+
// Export
|
|
7
|
+
// --------------------------------------------------------------------------------
|
|
8
|
+
/**
|
|
9
|
+
* Normalizes a pattern option into a `RegExp`.
|
|
10
|
+
* String patterns are compiled with the `u` flag.
|
|
11
|
+
* @param pattern `RegExp` or string pattern to normalize.
|
|
12
|
+
* @returns The normalized `RegExp`.
|
|
13
|
+
*/
|
|
14
|
+
export default function normalizeRegexPattern(pattern) {
|
|
15
|
+
return typeof pattern === 'string' ? new RegExp(pattern, 'u') : pattern;
|
|
16
|
+
}
|
package/build/index.d.ts
CHANGED
|
@@ -26,14 +26,24 @@ declare const plugin: {
|
|
|
26
26
|
readonly allow: {
|
|
27
27
|
readonly type: "array";
|
|
28
28
|
readonly items: {
|
|
29
|
-
readonly
|
|
29
|
+
readonly oneOf: readonly [{
|
|
30
|
+
readonly type: "object";
|
|
31
|
+
readonly additionalProperties: false;
|
|
32
|
+
}, {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
}];
|
|
30
35
|
};
|
|
31
36
|
readonly uniqueItems: true;
|
|
32
37
|
};
|
|
33
38
|
readonly disallow: {
|
|
34
39
|
readonly type: "array";
|
|
35
40
|
readonly items: {
|
|
36
|
-
readonly
|
|
41
|
+
readonly oneOf: readonly [{
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly additionalProperties: false;
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
}];
|
|
37
47
|
};
|
|
38
48
|
readonly uniqueItems: true;
|
|
39
49
|
};
|
|
@@ -46,14 +56,24 @@ declare const plugin: {
|
|
|
46
56
|
readonly allow: {
|
|
47
57
|
readonly type: "array";
|
|
48
58
|
readonly items: {
|
|
49
|
-
readonly
|
|
59
|
+
readonly oneOf: readonly [{
|
|
60
|
+
readonly type: "object";
|
|
61
|
+
readonly additionalProperties: false;
|
|
62
|
+
}, {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
}];
|
|
50
65
|
};
|
|
51
66
|
readonly uniqueItems: true;
|
|
52
67
|
};
|
|
53
68
|
readonly disallow: {
|
|
54
69
|
readonly type: "array";
|
|
55
70
|
readonly items: {
|
|
56
|
-
readonly
|
|
71
|
+
readonly oneOf: readonly [{
|
|
72
|
+
readonly type: "object";
|
|
73
|
+
readonly additionalProperties: false;
|
|
74
|
+
}, {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
}];
|
|
57
77
|
};
|
|
58
78
|
readonly uniqueItems: true;
|
|
59
79
|
};
|
|
@@ -66,14 +86,24 @@ declare const plugin: {
|
|
|
66
86
|
readonly allow: {
|
|
67
87
|
readonly type: "array";
|
|
68
88
|
readonly items: {
|
|
69
|
-
readonly
|
|
89
|
+
readonly oneOf: readonly [{
|
|
90
|
+
readonly type: "object";
|
|
91
|
+
readonly additionalProperties: false;
|
|
92
|
+
}, {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
}];
|
|
70
95
|
};
|
|
71
96
|
readonly uniqueItems: true;
|
|
72
97
|
};
|
|
73
98
|
readonly disallow: {
|
|
74
99
|
readonly type: "array";
|
|
75
100
|
readonly items: {
|
|
76
|
-
readonly
|
|
101
|
+
readonly oneOf: readonly [{
|
|
102
|
+
readonly type: "object";
|
|
103
|
+
readonly additionalProperties: false;
|
|
104
|
+
}, {
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
}];
|
|
77
107
|
};
|
|
78
108
|
readonly uniqueItems: true;
|
|
79
109
|
};
|
|
@@ -86,14 +116,24 @@ declare const plugin: {
|
|
|
86
116
|
readonly allow: {
|
|
87
117
|
readonly type: "array";
|
|
88
118
|
readonly items: {
|
|
89
|
-
readonly
|
|
119
|
+
readonly oneOf: readonly [{
|
|
120
|
+
readonly type: "object";
|
|
121
|
+
readonly additionalProperties: false;
|
|
122
|
+
}, {
|
|
123
|
+
readonly type: "string";
|
|
124
|
+
}];
|
|
90
125
|
};
|
|
91
126
|
readonly uniqueItems: true;
|
|
92
127
|
};
|
|
93
128
|
readonly disallow: {
|
|
94
129
|
readonly type: "array";
|
|
95
130
|
readonly items: {
|
|
96
|
-
readonly
|
|
131
|
+
readonly oneOf: readonly [{
|
|
132
|
+
readonly type: "object";
|
|
133
|
+
readonly additionalProperties: false;
|
|
134
|
+
}, {
|
|
135
|
+
readonly type: "string";
|
|
136
|
+
}];
|
|
97
137
|
};
|
|
98
138
|
readonly uniqueItems: true;
|
|
99
139
|
};
|
|
@@ -106,14 +146,24 @@ declare const plugin: {
|
|
|
106
146
|
readonly allow: {
|
|
107
147
|
readonly type: "array";
|
|
108
148
|
readonly items: {
|
|
109
|
-
readonly
|
|
149
|
+
readonly oneOf: readonly [{
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly additionalProperties: false;
|
|
152
|
+
}, {
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
}];
|
|
110
155
|
};
|
|
111
156
|
readonly uniqueItems: true;
|
|
112
157
|
};
|
|
113
158
|
readonly disallow: {
|
|
114
159
|
readonly type: "array";
|
|
115
160
|
readonly items: {
|
|
116
|
-
readonly
|
|
161
|
+
readonly oneOf: readonly [{
|
|
162
|
+
readonly type: "object";
|
|
163
|
+
readonly additionalProperties: false;
|
|
164
|
+
}, {
|
|
165
|
+
readonly type: "string";
|
|
166
|
+
}];
|
|
117
167
|
};
|
|
118
168
|
readonly uniqueItems: true;
|
|
119
169
|
};
|
|
@@ -126,14 +176,24 @@ declare const plugin: {
|
|
|
126
176
|
readonly allow: {
|
|
127
177
|
readonly type: "array";
|
|
128
178
|
readonly items: {
|
|
129
|
-
readonly
|
|
179
|
+
readonly oneOf: readonly [{
|
|
180
|
+
readonly type: "object";
|
|
181
|
+
readonly additionalProperties: false;
|
|
182
|
+
}, {
|
|
183
|
+
readonly type: "string";
|
|
184
|
+
}];
|
|
130
185
|
};
|
|
131
186
|
readonly uniqueItems: true;
|
|
132
187
|
};
|
|
133
188
|
readonly disallow: {
|
|
134
189
|
readonly type: "array";
|
|
135
190
|
readonly items: {
|
|
136
|
-
readonly
|
|
191
|
+
readonly oneOf: readonly [{
|
|
192
|
+
readonly type: "object";
|
|
193
|
+
readonly additionalProperties: false;
|
|
194
|
+
}, {
|
|
195
|
+
readonly type: "string";
|
|
196
|
+
}];
|
|
137
197
|
};
|
|
138
198
|
readonly uniqueItems: true;
|
|
139
199
|
};
|
|
@@ -172,6 +232,7 @@ declare const plugin: {
|
|
|
172
232
|
readonly messages: {
|
|
173
233
|
readonly allowHeading: "The level {{ depth }} heading `{{ heading }}` is not in the list of allowed headings. (Allow: {{ allow }}).";
|
|
174
234
|
readonly disallowHeading: "The level {{ depth }} heading `{{ heading }}` is in the list of disallowed headings. (Disallow: {{ disallow }}).";
|
|
235
|
+
readonly emptyAllowHeading: "No level {{ depth }} headings are allowed because the list of allowed headings is empty.";
|
|
175
236
|
};
|
|
176
237
|
readonly language: "markdown";
|
|
177
238
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -181,7 +242,7 @@ declare const plugin: {
|
|
|
181
242
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
182
243
|
RuleOptions: [Record<"h1" | "h2" | "h3" | "h4" | "h5" | "h6", import("./rules/allow-heading.js").HeadingOptions>];
|
|
183
244
|
Node: import("mdast").Node;
|
|
184
|
-
MessageIds: "allowHeading" | "disallowHeading";
|
|
245
|
+
MessageIds: "allowHeading" | "disallowHeading" | "emptyAllowHeading";
|
|
185
246
|
}>) => {
|
|
186
247
|
heading(node: import("mdast").Heading): void;
|
|
187
248
|
};
|
|
@@ -201,14 +262,24 @@ declare const plugin: {
|
|
|
201
262
|
readonly allowUrls: {
|
|
202
263
|
readonly type: "array";
|
|
203
264
|
readonly items: {
|
|
204
|
-
readonly
|
|
265
|
+
readonly oneOf: [{
|
|
266
|
+
readonly type: "object";
|
|
267
|
+
readonly additionalProperties: false;
|
|
268
|
+
}, {
|
|
269
|
+
readonly type: "string";
|
|
270
|
+
}];
|
|
205
271
|
};
|
|
206
272
|
readonly uniqueItems: true;
|
|
207
273
|
};
|
|
208
274
|
readonly disallowUrls: {
|
|
209
275
|
readonly type: "array";
|
|
210
276
|
readonly items: {
|
|
211
|
-
readonly
|
|
277
|
+
readonly oneOf: [{
|
|
278
|
+
readonly type: "object";
|
|
279
|
+
readonly additionalProperties: false;
|
|
280
|
+
}, {
|
|
281
|
+
readonly type: "string";
|
|
282
|
+
}];
|
|
212
283
|
};
|
|
213
284
|
readonly uniqueItems: true;
|
|
214
285
|
};
|
|
@@ -230,6 +301,7 @@ declare const plugin: {
|
|
|
230
301
|
readonly messages: {
|
|
231
302
|
readonly allowImageUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
|
|
232
303
|
readonly disallowImageUrl: "The URL `{{ url }}` is in the list of disallowed URLs. (Disallow: {{ patterns }}).";
|
|
304
|
+
readonly emptyAllowImageUrl: "The URL `{{ url }}` is not allowed because the list of allowed URLs is empty.";
|
|
233
305
|
};
|
|
234
306
|
readonly language: "markdown";
|
|
235
307
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -238,12 +310,12 @@ declare const plugin: {
|
|
|
238
310
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
239
311
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
240
312
|
RuleOptions: [{
|
|
241
|
-
allowUrls: RegExp[];
|
|
242
|
-
disallowUrls: RegExp[];
|
|
313
|
+
allowUrls: (RegExp | string)[];
|
|
314
|
+
disallowUrls: (RegExp | string)[];
|
|
243
315
|
allowDefinitions: string[];
|
|
244
316
|
}];
|
|
245
317
|
Node: import("mdast").Node;
|
|
246
|
-
MessageIds: "allowImageUrl" | "disallowImageUrl";
|
|
318
|
+
MessageIds: "allowImageUrl" | "disallowImageUrl" | "emptyAllowImageUrl";
|
|
247
319
|
}>) => {
|
|
248
320
|
image(node: import("mdast").Image): void;
|
|
249
321
|
html(node: import("mdast").Html): void;
|
|
@@ -267,14 +339,24 @@ declare const plugin: {
|
|
|
267
339
|
readonly allowUrls: {
|
|
268
340
|
readonly type: "array";
|
|
269
341
|
readonly items: {
|
|
270
|
-
readonly
|
|
342
|
+
readonly oneOf: [{
|
|
343
|
+
readonly type: "object";
|
|
344
|
+
readonly additionalProperties: false;
|
|
345
|
+
}, {
|
|
346
|
+
readonly type: "string";
|
|
347
|
+
}];
|
|
271
348
|
};
|
|
272
349
|
readonly uniqueItems: true;
|
|
273
350
|
};
|
|
274
351
|
readonly disallowUrls: {
|
|
275
352
|
readonly type: "array";
|
|
276
353
|
readonly items: {
|
|
277
|
-
readonly
|
|
354
|
+
readonly oneOf: [{
|
|
355
|
+
readonly type: "object";
|
|
356
|
+
readonly additionalProperties: false;
|
|
357
|
+
}, {
|
|
358
|
+
readonly type: "string";
|
|
359
|
+
}];
|
|
278
360
|
};
|
|
279
361
|
readonly uniqueItems: true;
|
|
280
362
|
};
|
|
@@ -296,6 +378,7 @@ declare const plugin: {
|
|
|
296
378
|
readonly messages: {
|
|
297
379
|
readonly allowLinkUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
|
|
298
380
|
readonly disallowLinkUrl: "The URL `{{ url }}` is in the list of disallowed URLs. (Disallow: {{ patterns }}).";
|
|
381
|
+
readonly emptyAllowLinkUrl: "The URL `{{ url }}` is not allowed because the list of allowed URLs is empty.";
|
|
299
382
|
};
|
|
300
383
|
readonly language: "markdown";
|
|
301
384
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -304,12 +387,12 @@ declare const plugin: {
|
|
|
304
387
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
305
388
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
306
389
|
RuleOptions: [{
|
|
307
|
-
allowUrls: RegExp[];
|
|
308
|
-
disallowUrls: RegExp[];
|
|
390
|
+
allowUrls: (RegExp | string)[];
|
|
391
|
+
disallowUrls: (RegExp | string)[];
|
|
309
392
|
allowDefinitions: string[];
|
|
310
393
|
}];
|
|
311
394
|
Node: import("mdast").Node;
|
|
312
|
-
MessageIds: "allowLinkUrl" | "disallowLinkUrl";
|
|
395
|
+
MessageIds: "allowLinkUrl" | "disallowLinkUrl" | "emptyAllowLinkUrl";
|
|
313
396
|
}>) => {
|
|
314
397
|
link(node: import("mdast").Link): void;
|
|
315
398
|
html(node: import("mdast").Html): void;
|
|
@@ -465,7 +548,7 @@ declare const plugin: {
|
|
|
465
548
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
466
549
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
467
550
|
RuleOptions: [{
|
|
468
|
-
style: "consistent" | "~" | "~~";
|
|
551
|
+
style: "consistent" | ("~" | "~~");
|
|
469
552
|
}];
|
|
470
553
|
Node: import("mdast").Node;
|
|
471
554
|
MessageIds: "style";
|
|
@@ -505,7 +588,7 @@ declare const plugin: {
|
|
|
505
588
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
506
589
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
507
590
|
RuleOptions: [{
|
|
508
|
-
style: "consistent" | "*" | "_";
|
|
591
|
+
style: "consistent" | ("*" | "_");
|
|
509
592
|
}];
|
|
510
593
|
Node: import("mdast").Node;
|
|
511
594
|
MessageIds: "style";
|
|
@@ -571,7 +654,7 @@ declare const plugin: {
|
|
|
571
654
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
572
655
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
573
656
|
RuleOptions: [{
|
|
574
|
-
style: "consistent" | "*" | "_";
|
|
657
|
+
style: "consistent" | ("*" | "_");
|
|
575
658
|
}];
|
|
576
659
|
Node: import("mdast").Node;
|
|
577
660
|
MessageIds: "style";
|
package/build/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Entry file for the `eslint-markdown` package.
|
|
3
3
|
*/
|
|
4
|
-
import { PKG_NAME as name, PKG_VERSION as version } from './core/constants.js';
|
|
5
4
|
import { all, base, recommended, stylistic } from './configs/index.js';
|
|
6
5
|
import rules from './rules/index.js';
|
|
6
|
+
import pkg from '../package.json' with { type: 'json' };
|
|
7
7
|
// --------------------------------------------------------------------------------
|
|
8
8
|
// Export
|
|
9
9
|
// --------------------------------------------------------------------------------
|
|
10
10
|
const plugin = {
|
|
11
11
|
meta: {
|
|
12
|
-
name,
|
|
13
|
-
version,
|
|
12
|
+
name: pkg.name,
|
|
13
|
+
version: pkg.version,
|
|
14
14
|
},
|
|
15
15
|
rules,
|
|
16
16
|
configs: {
|
|
@@ -4,11 +4,22 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { Heading } from 'mdast';
|
|
6
6
|
export interface HeadingOptions {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Allowed heading patterns. Only headings matching at least one pattern are allowed.
|
|
9
|
+
* @default [new RegExp('.*', 'u')] // But as a regex literal.
|
|
10
|
+
*/
|
|
11
|
+
allow: (RegExp | string)[];
|
|
12
|
+
/**
|
|
13
|
+
* Disallowed heading patterns. Headings matching any pattern are reported.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
16
|
+
disallow: (RegExp | string)[];
|
|
9
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for the `allow-heading` rule, mapped by heading levels from `h1` to `h6`.
|
|
20
|
+
*/
|
|
10
21
|
type RuleOptions = [Record<`h${Heading['depth']}`, HeadingOptions>];
|
|
11
|
-
type MessageIds = 'allowHeading' | 'disallowHeading';
|
|
22
|
+
type MessageIds = 'allowHeading' | 'disallowHeading' | 'emptyAllowHeading';
|
|
12
23
|
declare const _default: {
|
|
13
24
|
readonly meta: {
|
|
14
25
|
readonly type: "problem";
|
|
@@ -27,14 +38,24 @@ declare const _default: {
|
|
|
27
38
|
readonly allow: {
|
|
28
39
|
readonly type: "array";
|
|
29
40
|
readonly items: {
|
|
30
|
-
readonly
|
|
41
|
+
readonly oneOf: readonly [{
|
|
42
|
+
readonly type: "object";
|
|
43
|
+
readonly additionalProperties: false;
|
|
44
|
+
}, {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
}];
|
|
31
47
|
};
|
|
32
48
|
readonly uniqueItems: true;
|
|
33
49
|
};
|
|
34
50
|
readonly disallow: {
|
|
35
51
|
readonly type: "array";
|
|
36
52
|
readonly items: {
|
|
37
|
-
readonly
|
|
53
|
+
readonly oneOf: readonly [{
|
|
54
|
+
readonly type: "object";
|
|
55
|
+
readonly additionalProperties: false;
|
|
56
|
+
}, {
|
|
57
|
+
readonly type: "string";
|
|
58
|
+
}];
|
|
38
59
|
};
|
|
39
60
|
readonly uniqueItems: true;
|
|
40
61
|
};
|
|
@@ -47,14 +68,24 @@ declare const _default: {
|
|
|
47
68
|
readonly allow: {
|
|
48
69
|
readonly type: "array";
|
|
49
70
|
readonly items: {
|
|
50
|
-
readonly
|
|
71
|
+
readonly oneOf: readonly [{
|
|
72
|
+
readonly type: "object";
|
|
73
|
+
readonly additionalProperties: false;
|
|
74
|
+
}, {
|
|
75
|
+
readonly type: "string";
|
|
76
|
+
}];
|
|
51
77
|
};
|
|
52
78
|
readonly uniqueItems: true;
|
|
53
79
|
};
|
|
54
80
|
readonly disallow: {
|
|
55
81
|
readonly type: "array";
|
|
56
82
|
readonly items: {
|
|
57
|
-
readonly
|
|
83
|
+
readonly oneOf: readonly [{
|
|
84
|
+
readonly type: "object";
|
|
85
|
+
readonly additionalProperties: false;
|
|
86
|
+
}, {
|
|
87
|
+
readonly type: "string";
|
|
88
|
+
}];
|
|
58
89
|
};
|
|
59
90
|
readonly uniqueItems: true;
|
|
60
91
|
};
|
|
@@ -67,14 +98,24 @@ declare const _default: {
|
|
|
67
98
|
readonly allow: {
|
|
68
99
|
readonly type: "array";
|
|
69
100
|
readonly items: {
|
|
70
|
-
readonly
|
|
101
|
+
readonly oneOf: readonly [{
|
|
102
|
+
readonly type: "object";
|
|
103
|
+
readonly additionalProperties: false;
|
|
104
|
+
}, {
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
}];
|
|
71
107
|
};
|
|
72
108
|
readonly uniqueItems: true;
|
|
73
109
|
};
|
|
74
110
|
readonly disallow: {
|
|
75
111
|
readonly type: "array";
|
|
76
112
|
readonly items: {
|
|
77
|
-
readonly
|
|
113
|
+
readonly oneOf: readonly [{
|
|
114
|
+
readonly type: "object";
|
|
115
|
+
readonly additionalProperties: false;
|
|
116
|
+
}, {
|
|
117
|
+
readonly type: "string";
|
|
118
|
+
}];
|
|
78
119
|
};
|
|
79
120
|
readonly uniqueItems: true;
|
|
80
121
|
};
|
|
@@ -87,14 +128,24 @@ declare const _default: {
|
|
|
87
128
|
readonly allow: {
|
|
88
129
|
readonly type: "array";
|
|
89
130
|
readonly items: {
|
|
90
|
-
readonly
|
|
131
|
+
readonly oneOf: readonly [{
|
|
132
|
+
readonly type: "object";
|
|
133
|
+
readonly additionalProperties: false;
|
|
134
|
+
}, {
|
|
135
|
+
readonly type: "string";
|
|
136
|
+
}];
|
|
91
137
|
};
|
|
92
138
|
readonly uniqueItems: true;
|
|
93
139
|
};
|
|
94
140
|
readonly disallow: {
|
|
95
141
|
readonly type: "array";
|
|
96
142
|
readonly items: {
|
|
97
|
-
readonly
|
|
143
|
+
readonly oneOf: readonly [{
|
|
144
|
+
readonly type: "object";
|
|
145
|
+
readonly additionalProperties: false;
|
|
146
|
+
}, {
|
|
147
|
+
readonly type: "string";
|
|
148
|
+
}];
|
|
98
149
|
};
|
|
99
150
|
readonly uniqueItems: true;
|
|
100
151
|
};
|
|
@@ -107,14 +158,24 @@ declare const _default: {
|
|
|
107
158
|
readonly allow: {
|
|
108
159
|
readonly type: "array";
|
|
109
160
|
readonly items: {
|
|
110
|
-
readonly
|
|
161
|
+
readonly oneOf: readonly [{
|
|
162
|
+
readonly type: "object";
|
|
163
|
+
readonly additionalProperties: false;
|
|
164
|
+
}, {
|
|
165
|
+
readonly type: "string";
|
|
166
|
+
}];
|
|
111
167
|
};
|
|
112
168
|
readonly uniqueItems: true;
|
|
113
169
|
};
|
|
114
170
|
readonly disallow: {
|
|
115
171
|
readonly type: "array";
|
|
116
172
|
readonly items: {
|
|
117
|
-
readonly
|
|
173
|
+
readonly oneOf: readonly [{
|
|
174
|
+
readonly type: "object";
|
|
175
|
+
readonly additionalProperties: false;
|
|
176
|
+
}, {
|
|
177
|
+
readonly type: "string";
|
|
178
|
+
}];
|
|
118
179
|
};
|
|
119
180
|
readonly uniqueItems: true;
|
|
120
181
|
};
|
|
@@ -127,14 +188,24 @@ declare const _default: {
|
|
|
127
188
|
readonly allow: {
|
|
128
189
|
readonly type: "array";
|
|
129
190
|
readonly items: {
|
|
130
|
-
readonly
|
|
191
|
+
readonly oneOf: readonly [{
|
|
192
|
+
readonly type: "object";
|
|
193
|
+
readonly additionalProperties: false;
|
|
194
|
+
}, {
|
|
195
|
+
readonly type: "string";
|
|
196
|
+
}];
|
|
131
197
|
};
|
|
132
198
|
readonly uniqueItems: true;
|
|
133
199
|
};
|
|
134
200
|
readonly disallow: {
|
|
135
201
|
readonly type: "array";
|
|
136
202
|
readonly items: {
|
|
137
|
-
readonly
|
|
203
|
+
readonly oneOf: readonly [{
|
|
204
|
+
readonly type: "object";
|
|
205
|
+
readonly additionalProperties: false;
|
|
206
|
+
}, {
|
|
207
|
+
readonly type: "string";
|
|
208
|
+
}];
|
|
138
209
|
};
|
|
139
210
|
readonly uniqueItems: true;
|
|
140
211
|
};
|
|
@@ -173,6 +244,7 @@ declare const _default: {
|
|
|
173
244
|
readonly messages: {
|
|
174
245
|
readonly allowHeading: "The level {{ depth }} heading `{{ heading }}` is not in the list of allowed headings. (Allow: {{ allow }}).";
|
|
175
246
|
readonly disallowHeading: "The level {{ depth }} heading `{{ heading }}` is in the list of disallowed headings. (Disallow: {{ disallow }}).";
|
|
247
|
+
readonly emptyAllowHeading: "No level {{ depth }} headings are allowed because the list of allowed headings is empty.";
|
|
176
248
|
};
|
|
177
249
|
readonly language: "markdown";
|
|
178
250
|
readonly dialects: ["commonmark", "gfm"];
|