eslint-markdown 0.14.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/index.d.ts +9 -6
- package/build/index.js +3 -3
- package/build/rules/allow-heading.d.ts +13 -1
- package/build/rules/allow-heading.js +11 -1
- package/build/rules/allow-image-url.d.ts +23 -1
- package/build/rules/allow-image-url.js +11 -1
- package/build/rules/allow-link-url.d.ts +23 -1
- package/build/rules/allow-link-url.js +11 -1
- 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 +9 -6
- 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
|
@@ -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
|
+
// --------------------------------------------------------------------------------
|
package/build/index.d.ts
CHANGED
|
@@ -232,6 +232,7 @@ declare const plugin: {
|
|
|
232
232
|
readonly messages: {
|
|
233
233
|
readonly allowHeading: "The level {{ depth }} heading `{{ heading }}` is not in the list of allowed headings. (Allow: {{ allow }}).";
|
|
234
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.";
|
|
235
236
|
};
|
|
236
237
|
readonly language: "markdown";
|
|
237
238
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -241,7 +242,7 @@ declare const plugin: {
|
|
|
241
242
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
242
243
|
RuleOptions: [Record<"h1" | "h2" | "h3" | "h4" | "h5" | "h6", import("./rules/allow-heading.js").HeadingOptions>];
|
|
243
244
|
Node: import("mdast").Node;
|
|
244
|
-
MessageIds: "allowHeading" | "disallowHeading";
|
|
245
|
+
MessageIds: "allowHeading" | "disallowHeading" | "emptyAllowHeading";
|
|
245
246
|
}>) => {
|
|
246
247
|
heading(node: import("mdast").Heading): void;
|
|
247
248
|
};
|
|
@@ -300,6 +301,7 @@ declare const plugin: {
|
|
|
300
301
|
readonly messages: {
|
|
301
302
|
readonly allowImageUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
|
|
302
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.";
|
|
303
305
|
};
|
|
304
306
|
readonly language: "markdown";
|
|
305
307
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -313,7 +315,7 @@ declare const plugin: {
|
|
|
313
315
|
allowDefinitions: string[];
|
|
314
316
|
}];
|
|
315
317
|
Node: import("mdast").Node;
|
|
316
|
-
MessageIds: "allowImageUrl" | "disallowImageUrl";
|
|
318
|
+
MessageIds: "allowImageUrl" | "disallowImageUrl" | "emptyAllowImageUrl";
|
|
317
319
|
}>) => {
|
|
318
320
|
image(node: import("mdast").Image): void;
|
|
319
321
|
html(node: import("mdast").Html): void;
|
|
@@ -376,6 +378,7 @@ declare const plugin: {
|
|
|
376
378
|
readonly messages: {
|
|
377
379
|
readonly allowLinkUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
|
|
378
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.";
|
|
379
382
|
};
|
|
380
383
|
readonly language: "markdown";
|
|
381
384
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -389,7 +392,7 @@ declare const plugin: {
|
|
|
389
392
|
allowDefinitions: string[];
|
|
390
393
|
}];
|
|
391
394
|
Node: import("mdast").Node;
|
|
392
|
-
MessageIds: "allowLinkUrl" | "disallowLinkUrl";
|
|
395
|
+
MessageIds: "allowLinkUrl" | "disallowLinkUrl" | "emptyAllowLinkUrl";
|
|
393
396
|
}>) => {
|
|
394
397
|
link(node: import("mdast").Link): void;
|
|
395
398
|
html(node: import("mdast").Html): void;
|
|
@@ -545,7 +548,7 @@ declare const plugin: {
|
|
|
545
548
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
546
549
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
547
550
|
RuleOptions: [{
|
|
548
|
-
style: "consistent" | "~" | "~~";
|
|
551
|
+
style: "consistent" | ("~" | "~~");
|
|
549
552
|
}];
|
|
550
553
|
Node: import("mdast").Node;
|
|
551
554
|
MessageIds: "style";
|
|
@@ -585,7 +588,7 @@ declare const plugin: {
|
|
|
585
588
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
586
589
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
587
590
|
RuleOptions: [{
|
|
588
|
-
style: "consistent" | "*" | "_";
|
|
591
|
+
style: "consistent" | ("*" | "_");
|
|
589
592
|
}];
|
|
590
593
|
Node: import("mdast").Node;
|
|
591
594
|
MessageIds: "style";
|
|
@@ -651,7 +654,7 @@ declare const plugin: {
|
|
|
651
654
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
652
655
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
653
656
|
RuleOptions: [{
|
|
654
|
-
style: "consistent" | "*" | "_";
|
|
657
|
+
style: "consistent" | ("*" | "_");
|
|
655
658
|
}];
|
|
656
659
|
Node: import("mdast").Node;
|
|
657
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
|
+
* Allowed heading patterns. Only headings matching at least one pattern are allowed.
|
|
9
|
+
* @default [new RegExp('.*', 'u')] // But as a regex literal.
|
|
10
|
+
*/
|
|
7
11
|
allow: (RegExp | string)[];
|
|
12
|
+
/**
|
|
13
|
+
* Disallowed heading patterns. Headings matching any pattern are reported.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
8
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";
|
|
@@ -233,6 +244,7 @@ declare const _default: {
|
|
|
233
244
|
readonly messages: {
|
|
234
245
|
readonly allowHeading: "The level {{ depth }} heading `{{ heading }}` is not in the list of allowed headings. (Allow: {{ allow }}).";
|
|
235
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.";
|
|
236
248
|
};
|
|
237
249
|
readonly language: "markdown";
|
|
238
250
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -66,6 +66,7 @@ export default {
|
|
|
66
66
|
messages: {
|
|
67
67
|
allowHeading: 'The level {{ depth }} heading `{{ heading }}` is not in the list of allowed headings. (Allow: {{ allow }}).',
|
|
68
68
|
disallowHeading: 'The level {{ depth }} heading `{{ heading }}` is in the list of disallowed headings. (Disallow: {{ disallow }}).',
|
|
69
|
+
emptyAllowHeading: 'No level {{ depth }} headings are allowed because the list of allowed headings is empty.',
|
|
69
70
|
},
|
|
70
71
|
language: 'markdown',
|
|
71
72
|
dialects: ['commonmark', 'gfm'],
|
|
@@ -82,7 +83,16 @@ export default {
|
|
|
82
83
|
const { depth } = node;
|
|
83
84
|
const { allow, disallow } = headingMap[depth - 1];
|
|
84
85
|
const headingText = sourceCode.getText(node);
|
|
85
|
-
if (
|
|
86
|
+
if (allow.length === 0) {
|
|
87
|
+
context.report({
|
|
88
|
+
node,
|
|
89
|
+
messageId: 'emptyAllowHeading',
|
|
90
|
+
data: {
|
|
91
|
+
depth,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
else if (!allow.some(regex => testRegexStateless(regex, headingText))) {
|
|
86
96
|
context.report({
|
|
87
97
|
node,
|
|
88
98
|
messageId: 'allowHeading',
|
|
@@ -3,14 +3,35 @@
|
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
5
|
import type { Definition } from 'mdast';
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `allow-image-url` rule.
|
|
8
|
+
*/
|
|
6
9
|
type RuleOptions = [
|
|
7
10
|
{
|
|
11
|
+
/**
|
|
12
|
+
* Allowed URLs act like a ***whitelist***.
|
|
13
|
+
*
|
|
14
|
+
* Only those written on the whitelist **can** pass through.
|
|
15
|
+
* @default [new RegExp('.*', 'u')] // But as a regex literal.
|
|
16
|
+
*/
|
|
8
17
|
allowUrls: (RegExp | string)[];
|
|
18
|
+
/**
|
|
19
|
+
* On the contrary, disallowed URLs act like a ***blacklist***.
|
|
20
|
+
*
|
|
21
|
+
* Only those written on the blacklist **cannot** pass through.
|
|
22
|
+
* @default []
|
|
23
|
+
*/
|
|
9
24
|
disallowUrls: (RegExp | string)[];
|
|
25
|
+
/**
|
|
26
|
+
* When specified, specific definitions are allowed if they match one of the identifiers in this array.
|
|
27
|
+
*
|
|
28
|
+
* This is useful for ignoring definitions that are intentionally left, such as comments or placeholders.
|
|
29
|
+
* @default ['//']
|
|
30
|
+
*/
|
|
10
31
|
allowDefinitions: string[];
|
|
11
32
|
}
|
|
12
33
|
];
|
|
13
|
-
type MessageIds = 'allowImageUrl' | 'disallowImageUrl';
|
|
34
|
+
type MessageIds = 'allowImageUrl' | 'disallowImageUrl' | 'emptyAllowImageUrl';
|
|
14
35
|
declare const _default: {
|
|
15
36
|
readonly meta: {
|
|
16
37
|
readonly type: "problem";
|
|
@@ -65,6 +86,7 @@ declare const _default: {
|
|
|
65
86
|
readonly messages: {
|
|
66
87
|
readonly allowImageUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
|
|
67
88
|
readonly disallowImageUrl: "The URL `{{ url }}` is in the list of disallowed URLs. (Disallow: {{ patterns }}).";
|
|
89
|
+
readonly emptyAllowImageUrl: "The URL `{{ url }}` is not allowed because the list of allowed URLs is empty.";
|
|
68
90
|
};
|
|
69
91
|
readonly language: "markdown";
|
|
70
92
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -62,6 +62,7 @@ export default {
|
|
|
62
62
|
messages: {
|
|
63
63
|
allowImageUrl: 'The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).',
|
|
64
64
|
disallowImageUrl: 'The URL `{{ url }}` is in the list of disallowed URLs. (Disallow: {{ patterns }}).',
|
|
65
|
+
emptyAllowImageUrl: 'The URL `{{ url }}` is not allowed because the list of allowed URLs is empty.',
|
|
65
66
|
},
|
|
66
67
|
language: 'markdown',
|
|
67
68
|
dialects: ['commonmark', 'gfm'],
|
|
@@ -122,7 +123,16 @@ export default {
|
|
|
122
123
|
* Therefore, calling the `some` method on an empty array will always return `false`.
|
|
123
124
|
*/
|
|
124
125
|
for (const { loc, url } of images) {
|
|
125
|
-
if (
|
|
126
|
+
if (allowUrls.length === 0) {
|
|
127
|
+
context.report({
|
|
128
|
+
loc,
|
|
129
|
+
messageId: 'emptyAllowImageUrl',
|
|
130
|
+
data: {
|
|
131
|
+
url,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
else if (!allowUrls.some(regex => testRegexStateless(regex, url))) {
|
|
126
136
|
context.report({
|
|
127
137
|
loc,
|
|
128
138
|
messageId: 'allowImageUrl',
|
|
@@ -3,14 +3,35 @@
|
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
5
|
import type { Definition } from 'mdast';
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `allow-link-url` rule.
|
|
8
|
+
*/
|
|
6
9
|
type RuleOptions = [
|
|
7
10
|
{
|
|
11
|
+
/**
|
|
12
|
+
* Allowed URLs act like a ***whitelist***.
|
|
13
|
+
*
|
|
14
|
+
* Only those written on the whitelist **can** pass through.
|
|
15
|
+
* @default [new RegExp('.*', 'u')] // But as a regex literal.
|
|
16
|
+
*/
|
|
8
17
|
allowUrls: (RegExp | string)[];
|
|
18
|
+
/**
|
|
19
|
+
* On the contrary, disallowed URLs act like a ***blacklist***.
|
|
20
|
+
*
|
|
21
|
+
* Only those written on the blacklist **cannot** pass through.
|
|
22
|
+
* @default []
|
|
23
|
+
*/
|
|
9
24
|
disallowUrls: (RegExp | string)[];
|
|
25
|
+
/**
|
|
26
|
+
* When specified, specific definitions are allowed if they match one of the identifiers in this array.
|
|
27
|
+
*
|
|
28
|
+
* This is useful for ignoring definitions that are intentionally left, such as comments or placeholders.
|
|
29
|
+
* @default ['//']
|
|
30
|
+
*/
|
|
10
31
|
allowDefinitions: string[];
|
|
11
32
|
}
|
|
12
33
|
];
|
|
13
|
-
type MessageIds = 'allowLinkUrl' | 'disallowLinkUrl';
|
|
34
|
+
type MessageIds = 'allowLinkUrl' | 'disallowLinkUrl' | 'emptyAllowLinkUrl';
|
|
14
35
|
declare const _default: {
|
|
15
36
|
readonly meta: {
|
|
16
37
|
readonly type: "problem";
|
|
@@ -65,6 +86,7 @@ declare const _default: {
|
|
|
65
86
|
readonly messages: {
|
|
66
87
|
readonly allowLinkUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
|
|
67
88
|
readonly disallowLinkUrl: "The URL `{{ url }}` is in the list of disallowed URLs. (Disallow: {{ patterns }}).";
|
|
89
|
+
readonly emptyAllowLinkUrl: "The URL `{{ url }}` is not allowed because the list of allowed URLs is empty.";
|
|
68
90
|
};
|
|
69
91
|
readonly language: "markdown";
|
|
70
92
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -62,6 +62,7 @@ export default {
|
|
|
62
62
|
messages: {
|
|
63
63
|
allowLinkUrl: 'The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).',
|
|
64
64
|
disallowLinkUrl: 'The URL `{{ url }}` is in the list of disallowed URLs. (Disallow: {{ patterns }}).',
|
|
65
|
+
emptyAllowLinkUrl: 'The URL `{{ url }}` is not allowed because the list of allowed URLs is empty.',
|
|
65
66
|
},
|
|
66
67
|
language: 'markdown',
|
|
67
68
|
dialects: ['commonmark', 'gfm'],
|
|
@@ -122,7 +123,16 @@ export default {
|
|
|
122
123
|
* Therefore, calling the `some` method on an empty array will always return `false`.
|
|
123
124
|
*/
|
|
124
125
|
for (const { loc, url } of links) {
|
|
125
|
-
if (
|
|
126
|
+
if (allowUrls.length === 0) {
|
|
127
|
+
context.report({
|
|
128
|
+
loc,
|
|
129
|
+
messageId: 'emptyAllowLinkUrl',
|
|
130
|
+
data: {
|
|
131
|
+
url,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
else if (!allowUrls.some(regex => testRegexStateless(regex, url))) {
|
|
126
136
|
context.report({
|
|
127
137
|
loc,
|
|
128
138
|
messageId: 'allowLinkUrl',
|
|
@@ -2,10 +2,25 @@
|
|
|
2
2
|
* @fileoverview Rule to enforce the use of shorthand for code block language identifiers.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `code-lang-shorthand` rule.
|
|
7
|
+
*/
|
|
8
|
+
type RuleOptions = [
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* An array of code block language identifiers to allow.
|
|
12
|
+
*
|
|
13
|
+
* Each value must be the full, unabridged language identifier.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
16
|
+
allow: string[];
|
|
17
|
+
/**
|
|
18
|
+
* An object where the **key** is the full, unabridged language identifier and the **value** is the abbreviated form.
|
|
19
|
+
* @default {}
|
|
20
|
+
*/
|
|
21
|
+
override: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
];
|
|
9
24
|
declare const _default: {
|
|
10
25
|
readonly meta: {
|
|
11
26
|
readonly type: "problem";
|
|
@@ -2,15 +2,31 @@
|
|
|
2
2
|
* @fileoverview Rule to enforce consistent code style.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
type CodeStyle =
|
|
5
|
+
type CodeStyle = (typeof CODE_STYLE)[number];
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `consistent-code-style` rule.
|
|
8
|
+
*/
|
|
6
9
|
type RuleOptions = [
|
|
7
10
|
{
|
|
11
|
+
/**
|
|
12
|
+
* When `style` is set to `'consistent'`, the rule enforces that all code blocks in the document use the same style as the first one encountered.
|
|
13
|
+
* @default 'consistent'
|
|
14
|
+
*/
|
|
8
15
|
style: 'consistent' | CodeStyle;
|
|
16
|
+
/**
|
|
17
|
+
* Require a specific number of blank lines above each fenced code block.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
9
20
|
blankLineAbove: number | false;
|
|
21
|
+
/**
|
|
22
|
+
* Require a specific number of blank lines below each fenced code block.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
10
25
|
blankLineBelow: number | false;
|
|
11
26
|
}
|
|
12
27
|
];
|
|
13
28
|
type MessageIds = 'style' | 'blankLineAbove' | 'blankLineBelow';
|
|
29
|
+
declare const CODE_STYLE: readonly ["indent", "fence-backtick", "fence-tilde"];
|
|
14
30
|
declare const _default: {
|
|
15
31
|
readonly meta: {
|
|
16
32
|
readonly type: "layout";
|
|
@@ -19,6 +19,7 @@ import { URL_RULE_DOCS } from '../core/constants.js';
|
|
|
19
19
|
// --------------------------------------------------------------------------------
|
|
20
20
|
// Helper
|
|
21
21
|
// --------------------------------------------------------------------------------
|
|
22
|
+
const CODE_STYLE = ['indent', 'fence-backtick', 'fence-tilde'];
|
|
22
23
|
/**
|
|
23
24
|
* Get the current code style based on the given text.
|
|
24
25
|
* @param text The text to determine the code style from.
|
|
@@ -54,7 +55,7 @@ export default {
|
|
|
54
55
|
type: 'object',
|
|
55
56
|
properties: {
|
|
56
57
|
style: {
|
|
57
|
-
enum: ['consistent',
|
|
58
|
+
enum: ['consistent', ...CODE_STYLE],
|
|
58
59
|
},
|
|
59
60
|
blankLineAbove: {
|
|
60
61
|
oneOf: [
|
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
* @fileoverview Rule to enforce consistent delete style.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type DeleteStyle = (typeof DELETE_STYLE)[number];
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `consistent-delete-style` rule.
|
|
8
|
+
*/
|
|
9
|
+
type RuleOptions = [
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* When `style` is set to `'consistent'`, the rule enforces that all deletes in the document use the same style as the first one encountered.
|
|
13
|
+
* @default 'consistent'
|
|
14
|
+
*/
|
|
15
|
+
style: 'consistent' | DeleteStyle;
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
declare const DELETE_STYLE: readonly ["~", "~~"];
|
|
8
19
|
declare const _default: {
|
|
9
20
|
readonly meta: {
|
|
10
21
|
readonly type: "layout";
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
// --------------------------------------------------------------------------------
|
|
8
8
|
import { URL_RULE_DOCS } from '../core/constants.js';
|
|
9
9
|
// --------------------------------------------------------------------------------
|
|
10
|
+
// Helper
|
|
11
|
+
// --------------------------------------------------------------------------------
|
|
12
|
+
const DELETE_STYLE = ['~', '~~'];
|
|
13
|
+
// --------------------------------------------------------------------------------
|
|
10
14
|
// Rule Definition
|
|
11
15
|
// --------------------------------------------------------------------------------
|
|
12
16
|
export default {
|
|
@@ -24,7 +28,7 @@ export default {
|
|
|
24
28
|
type: 'object',
|
|
25
29
|
properties: {
|
|
26
30
|
style: {
|
|
27
|
-
enum: ['consistent',
|
|
31
|
+
enum: ['consistent', ...DELETE_STYLE],
|
|
28
32
|
},
|
|
29
33
|
},
|
|
30
34
|
additionalProperties: false,
|
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
* @fileoverview Rule to enforce consistent emphasis style.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type EmphasisStyle = (typeof EMPHASIS_STYLE)[number];
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `consistent-emphasis-style` rule.
|
|
8
|
+
*/
|
|
9
|
+
type RuleOptions = [
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* When `style` is set to `'consistent'`, the rule enforces that all emphasis in the document use the same style as the first one encountered.
|
|
13
|
+
* @default 'consistent'
|
|
14
|
+
*/
|
|
15
|
+
style: 'consistent' | EmphasisStyle;
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
declare const EMPHASIS_STYLE: readonly ["*", "_"];
|
|
8
19
|
declare const _default: {
|
|
9
20
|
readonly meta: {
|
|
10
21
|
readonly type: "layout";
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
// --------------------------------------------------------------------------------
|
|
8
8
|
import { URL_RULE_DOCS } from '../core/constants.js';
|
|
9
9
|
// --------------------------------------------------------------------------------
|
|
10
|
+
// Helper
|
|
11
|
+
// --------------------------------------------------------------------------------
|
|
12
|
+
const EMPHASIS_STYLE = ['*', '_'];
|
|
13
|
+
// --------------------------------------------------------------------------------
|
|
10
14
|
// Rule Definition
|
|
11
15
|
// --------------------------------------------------------------------------------
|
|
12
16
|
export default {
|
|
@@ -24,7 +28,7 @@ export default {
|
|
|
24
28
|
type: 'object',
|
|
25
29
|
properties: {
|
|
26
30
|
style: {
|
|
27
|
-
enum: ['consistent',
|
|
31
|
+
enum: ['consistent', ...EMPHASIS_STYLE],
|
|
28
32
|
},
|
|
29
33
|
},
|
|
30
34
|
additionalProperties: false,
|
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
* @fileoverview Rule to enforce consistent strong style.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type StrongStyle = (typeof STRONG_STYLE)[number];
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `consistent-strong-style` rule.
|
|
8
|
+
*/
|
|
9
|
+
type RuleOptions = [
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* When `style` is set to `'consistent'`, the rule enforces that all strong in the document use the same style as the first one encountered.
|
|
13
|
+
* @default 'consistent'
|
|
14
|
+
*/
|
|
15
|
+
style: 'consistent' | StrongStyle;
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
declare const STRONG_STYLE: readonly ["*", "_"];
|
|
8
19
|
declare const _default: {
|
|
9
20
|
readonly meta: {
|
|
10
21
|
readonly type: "layout";
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
// --------------------------------------------------------------------------------
|
|
8
8
|
import { URL_RULE_DOCS } from '../core/constants.js';
|
|
9
9
|
// --------------------------------------------------------------------------------
|
|
10
|
+
// Helper
|
|
11
|
+
// --------------------------------------------------------------------------------
|
|
12
|
+
const STRONG_STYLE = ['*', '_'];
|
|
13
|
+
// --------------------------------------------------------------------------------
|
|
10
14
|
// Rule Definition
|
|
11
15
|
// --------------------------------------------------------------------------------
|
|
12
16
|
export default {
|
|
@@ -24,7 +28,7 @@ export default {
|
|
|
24
28
|
type: 'object',
|
|
25
29
|
properties: {
|
|
26
30
|
style: {
|
|
27
|
-
enum: ['consistent',
|
|
31
|
+
enum: ['consistent', ...STRONG_STYLE],
|
|
28
32
|
},
|
|
29
33
|
},
|
|
30
34
|
additionalProperties: false,
|
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
* @fileoverview Rule to enforce consistent thematic break style.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `consistent-thematic-break-style` rule.
|
|
7
|
+
*/
|
|
8
|
+
type RuleOptions = [
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* When `style` is set to `'consistent'`, the rule enforces that all thematic breaks in the document use the same style as the first one encountered.
|
|
12
|
+
*
|
|
13
|
+
* You can also specify a particular style by setting style to `'---'`, `'***'`, `'___'`, or any other valid thematic break, which will enforce that all thematic breaks use the specified style. A valid thematic break is a sequence of three or more matching `-`, `*`, or `_` characters, each optionally followed by any number of spaces or tabs.
|
|
14
|
+
* @default 'consistent'
|
|
15
|
+
*/
|
|
16
|
+
style: string;
|
|
17
|
+
}
|
|
18
|
+
];
|
|
8
19
|
declare const _default: {
|
|
9
20
|
readonly meta: {
|
|
10
21
|
readonly type: "layout";
|
|
@@ -3,10 +3,24 @@
|
|
|
3
3
|
* @author hyoban
|
|
4
4
|
*/
|
|
5
5
|
import type { ListItem } from 'mdast';
|
|
6
|
-
type UnorderedListStyle =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
type UnorderedListStyle = (typeof UNORDERED_LIST_STYLE)[number];
|
|
7
|
+
/**
|
|
8
|
+
* Options for the `consistent-unordered-list-style` rule.
|
|
9
|
+
*/
|
|
10
|
+
type RuleOptions = [
|
|
11
|
+
{
|
|
12
|
+
/**
|
|
13
|
+
* When `style` is set to `'consistent'`, the rule enforces that all unordered list markers in the document use the same style as the first one encountered.
|
|
14
|
+
*
|
|
15
|
+
* When `style` is set to `'sublist'`, the rule enforces that all unordered list markers in sublists use a consistent symbol that differs from that of their parent list, depending on the nesting depth.
|
|
16
|
+
*
|
|
17
|
+
* You can also specify a particular style by setting style to `'-'`, `'*'`, or `'+'`, which will enforce that all unordered list markers use the specified style.
|
|
18
|
+
* @default 'consistent'
|
|
19
|
+
*/
|
|
20
|
+
style: 'consistent' | 'sublist' | UnorderedListStyle;
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
declare const UNORDERED_LIST_STYLE: readonly ["*", "+", "-"];
|
|
10
24
|
declare const _default: {
|
|
11
25
|
readonly meta: {
|
|
12
26
|
readonly type: "layout";
|
|
@@ -6,6 +6,7 @@ import { URL_RULE_DOCS } from '../core/constants.js';
|
|
|
6
6
|
// --------------------------------------------------------------------------------
|
|
7
7
|
// Helper
|
|
8
8
|
// --------------------------------------------------------------------------------
|
|
9
|
+
const UNORDERED_LIST_STYLE = ['*', '+', '-'];
|
|
9
10
|
/**
|
|
10
11
|
* Get the next unordered list style in sequence.
|
|
11
12
|
* Inspired by [`markdownlint`](https://github.com/DavidAnson/markdownlint/blob/v0.40.0/lib/md004.mjs#L9).
|
|
@@ -41,7 +42,7 @@ export default {
|
|
|
41
42
|
type: 'object',
|
|
42
43
|
properties: {
|
|
43
44
|
style: {
|
|
44
|
-
enum: ['consistent', 'sublist',
|
|
45
|
+
enum: ['consistent', 'sublist', ...UNORDERED_LIST_STYLE],
|
|
45
46
|
},
|
|
46
47
|
},
|
|
47
48
|
additionalProperties: false,
|
package/build/rules/index.d.ts
CHANGED
|
@@ -223,6 +223,7 @@ declare const _default: {
|
|
|
223
223
|
readonly messages: {
|
|
224
224
|
readonly allowHeading: "The level {{ depth }} heading `{{ heading }}` is not in the list of allowed headings. (Allow: {{ allow }}).";
|
|
225
225
|
readonly disallowHeading: "The level {{ depth }} heading `{{ heading }}` is in the list of disallowed headings. (Disallow: {{ disallow }}).";
|
|
226
|
+
readonly emptyAllowHeading: "No level {{ depth }} headings are allowed because the list of allowed headings is empty.";
|
|
226
227
|
};
|
|
227
228
|
readonly language: "markdown";
|
|
228
229
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -232,7 +233,7 @@ declare const _default: {
|
|
|
232
233
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
233
234
|
RuleOptions: [Record<"h1" | "h2" | "h3" | "h4" | "h5" | "h6", import("./allow-heading.js").HeadingOptions>];
|
|
234
235
|
Node: import("mdast").Node;
|
|
235
|
-
MessageIds: "allowHeading" | "disallowHeading";
|
|
236
|
+
MessageIds: "allowHeading" | "disallowHeading" | "emptyAllowHeading";
|
|
236
237
|
}>) => {
|
|
237
238
|
heading(node: import("mdast").Heading): void;
|
|
238
239
|
};
|
|
@@ -291,6 +292,7 @@ declare const _default: {
|
|
|
291
292
|
readonly messages: {
|
|
292
293
|
readonly allowImageUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
|
|
293
294
|
readonly disallowImageUrl: "The URL `{{ url }}` is in the list of disallowed URLs. (Disallow: {{ patterns }}).";
|
|
295
|
+
readonly emptyAllowImageUrl: "The URL `{{ url }}` is not allowed because the list of allowed URLs is empty.";
|
|
294
296
|
};
|
|
295
297
|
readonly language: "markdown";
|
|
296
298
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -304,7 +306,7 @@ declare const _default: {
|
|
|
304
306
|
allowDefinitions: string[];
|
|
305
307
|
}];
|
|
306
308
|
Node: import("mdast").Node;
|
|
307
|
-
MessageIds: "allowImageUrl" | "disallowImageUrl";
|
|
309
|
+
MessageIds: "allowImageUrl" | "disallowImageUrl" | "emptyAllowImageUrl";
|
|
308
310
|
}>) => {
|
|
309
311
|
image(node: import("mdast").Image): void;
|
|
310
312
|
html(node: import("mdast").Html): void;
|
|
@@ -367,6 +369,7 @@ declare const _default: {
|
|
|
367
369
|
readonly messages: {
|
|
368
370
|
readonly allowLinkUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
|
|
369
371
|
readonly disallowLinkUrl: "The URL `{{ url }}` is in the list of disallowed URLs. (Disallow: {{ patterns }}).";
|
|
372
|
+
readonly emptyAllowLinkUrl: "The URL `{{ url }}` is not allowed because the list of allowed URLs is empty.";
|
|
370
373
|
};
|
|
371
374
|
readonly language: "markdown";
|
|
372
375
|
readonly dialects: ["commonmark", "gfm"];
|
|
@@ -380,7 +383,7 @@ declare const _default: {
|
|
|
380
383
|
allowDefinitions: string[];
|
|
381
384
|
}];
|
|
382
385
|
Node: import("mdast").Node;
|
|
383
|
-
MessageIds: "allowLinkUrl" | "disallowLinkUrl";
|
|
386
|
+
MessageIds: "allowLinkUrl" | "disallowLinkUrl" | "emptyAllowLinkUrl";
|
|
384
387
|
}>) => {
|
|
385
388
|
link(node: import("mdast").Link): void;
|
|
386
389
|
html(node: import("mdast").Html): void;
|
|
@@ -536,7 +539,7 @@ declare const _default: {
|
|
|
536
539
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
537
540
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
538
541
|
RuleOptions: [{
|
|
539
|
-
style: "consistent" | "~" | "~~";
|
|
542
|
+
style: "consistent" | ("~" | "~~");
|
|
540
543
|
}];
|
|
541
544
|
Node: import("mdast").Node;
|
|
542
545
|
MessageIds: "style";
|
|
@@ -576,7 +579,7 @@ declare const _default: {
|
|
|
576
579
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
577
580
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
578
581
|
RuleOptions: [{
|
|
579
|
-
style: "consistent" | "*" | "_";
|
|
582
|
+
style: "consistent" | ("*" | "_");
|
|
580
583
|
}];
|
|
581
584
|
Node: import("mdast").Node;
|
|
582
585
|
MessageIds: "style";
|
|
@@ -642,7 +645,7 @@ declare const _default: {
|
|
|
642
645
|
LangOptions: import("@eslint/markdown").MarkdownLanguageOptions;
|
|
643
646
|
Code: import("@eslint/markdown").MarkdownSourceCode;
|
|
644
647
|
RuleOptions: [{
|
|
645
|
-
style: "consistent" | "*" | "_";
|
|
648
|
+
style: "consistent" | ("*" | "_");
|
|
646
649
|
}];
|
|
647
650
|
Node: import("mdast").Node;
|
|
648
651
|
MessageIds: "style";
|
|
@@ -3,10 +3,25 @@
|
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
* @see https://github.com/DavidAnson/markdownlint/blob/main/lib/md012.mjs
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `no-consecutive-blank-line` rule.
|
|
8
|
+
*/
|
|
9
|
+
type RuleOptions = [
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Set the maximum number of consecutive blank lines to allow.
|
|
13
|
+
*
|
|
14
|
+
* This value must be an integer greater than or equal to `1`.
|
|
15
|
+
* @default 1
|
|
16
|
+
*/
|
|
17
|
+
max: number;
|
|
18
|
+
/**
|
|
19
|
+
* `true` allows consecutive blank lines in all code blocks, while `string[]` allows consecutive blank lines only in code blocks for the specified languages.
|
|
20
|
+
* @default true
|
|
21
|
+
*/
|
|
22
|
+
skipCode: boolean | string[];
|
|
23
|
+
}
|
|
24
|
+
];
|
|
10
25
|
declare const _default: {
|
|
11
26
|
readonly meta: {
|
|
12
27
|
readonly type: "layout";
|
|
@@ -2,10 +2,27 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow control character.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-control-character` rule.
|
|
7
|
+
*/
|
|
5
8
|
type RuleOptions = [
|
|
6
9
|
{
|
|
10
|
+
/**
|
|
11
|
+
* When specified, specific control characters are allowed if they match one of the characters in this array.
|
|
12
|
+
*
|
|
13
|
+
* This is useful for ignoring certain control characters that are intentionally used in the document.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
7
16
|
allow: string[];
|
|
17
|
+
/**
|
|
18
|
+
* `true` allows control characters in all code blocks, while `string[]` allows control characters only in code blocks for the specified languages.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
8
21
|
skipCode: boolean | string[];
|
|
22
|
+
/**
|
|
23
|
+
* `true` allows control characters in all inline code.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
9
26
|
skipInlineCode: boolean;
|
|
10
27
|
}
|
|
11
28
|
];
|
|
@@ -2,11 +2,30 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow curly quotes(`“`, `”`, `‘` or `’`) in text.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-curly-quote` rule.
|
|
7
|
+
*/
|
|
5
8
|
type RuleOptions = [
|
|
6
9
|
{
|
|
10
|
+
/**
|
|
11
|
+
* When `checkLeftDoubleQuotationMark` is set to `false`, this rule will not check for the left double quotation mark (`“`).
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
7
14
|
checkLeftDoubleQuotationMark: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* When `checkRightDoubleQuotationMark` is set to `false`, this rule will not check for the right double quotation mark (`”`).
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
8
19
|
checkRightDoubleQuotationMark: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* When `checkLeftSingleQuotationMark` is set to `false`, this rule will not check for the left single quotation mark (`‘`).
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
9
24
|
checkLeftSingleQuotationMark: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* When `checkRightSingleQuotationMark` is set to `false`, this rule will not check for the right single quotation mark (`’`).
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
10
29
|
checkRightSingleQuotationMark: boolean;
|
|
11
30
|
}
|
|
12
31
|
];
|
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow double consecutive punctuation in text.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-double-punctuation` rule.
|
|
7
|
+
*/
|
|
8
|
+
type RuleOptions = [
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* When `allow` is specified, the listed two-character punctuation patterns are ignored by this rule.
|
|
12
|
+
*
|
|
13
|
+
* This is useful when punctuation such as `!!` or `?!` is intentionally used for tone or emphasis instead of being treated as a typo.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
16
|
+
allow: string[];
|
|
17
|
+
}
|
|
18
|
+
];
|
|
8
19
|
type MessageIds = 'noDoublePunctuation' | 'suggestReplaceWithLeft' | 'suggestReplaceWithRight';
|
|
9
20
|
declare const _default: {
|
|
10
21
|
readonly meta: {
|
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow double or multiple consecutive spaces in text, except for leading and trailing spaces.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-double-space` rule.
|
|
7
|
+
*/
|
|
8
|
+
type RuleOptions = [
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* When `checkMultipleSpace` is set to `true`, this rule will also check for multiple consecutive spaces (more than two) within a sentence.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
checkMultipleSpace: boolean;
|
|
15
|
+
}
|
|
16
|
+
];
|
|
8
17
|
type MessageIds = 'noDoubleSpace' | 'noMultipleSpace';
|
|
9
18
|
declare const _default: {
|
|
10
19
|
readonly meta: {
|
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow emojis in text.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-emoji` rule.
|
|
7
|
+
*/
|
|
8
|
+
type RuleOptions = [
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* When specified, specific emoji sequences are allowed if they match one of the strings in this array.
|
|
12
|
+
*
|
|
13
|
+
* This is useful when a document intentionally uses a small set of raw Unicode emojis while still disallowing all others.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
16
|
+
allow: string[];
|
|
17
|
+
}
|
|
18
|
+
];
|
|
8
19
|
declare const _default: {
|
|
9
20
|
readonly meta: {
|
|
10
21
|
readonly type: "problem";
|
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow git conflict markers.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-git-conflict-marker` rule.
|
|
7
|
+
*/
|
|
8
|
+
type RuleOptions = [
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* `true` allows Git conflict markers in all code blocks, while `string[]` allows Git conflict markers only in code blocks for the specified languages.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
skipCode: boolean | string[];
|
|
15
|
+
}
|
|
16
|
+
];
|
|
8
17
|
declare const _default: {
|
|
9
18
|
readonly meta: {
|
|
10
19
|
readonly type: "problem";
|
|
@@ -2,10 +2,27 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow irregular dash.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-irregular-dash` rule.
|
|
7
|
+
*/
|
|
5
8
|
type RuleOptions = [
|
|
6
9
|
{
|
|
10
|
+
/**
|
|
11
|
+
* When specified, specific irregular dash characters are allowed if they match one of the characters in this array.
|
|
12
|
+
*
|
|
13
|
+
* This is useful for ignoring certain irregular dashes that are intentionally used in the document.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
7
16
|
allow: string[];
|
|
17
|
+
/**
|
|
18
|
+
* `true` allows irregular dashes in all code blocks, while `string[]` allows irregular dashes only in code blocks for the specified languages.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
8
21
|
skipCode: boolean | string[];
|
|
22
|
+
/**
|
|
23
|
+
* `true` allows irregular dashes in all inline code.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
9
26
|
skipInlineCode: boolean;
|
|
10
27
|
}
|
|
11
28
|
];
|
|
@@ -2,10 +2,27 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow irregular whitespace.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-irregular-whitespace` rule.
|
|
7
|
+
*/
|
|
5
8
|
type RuleOptions = [
|
|
6
9
|
{
|
|
10
|
+
/**
|
|
11
|
+
* When specified, specific irregular whitespaces are allowed if they match one of the characters in this array.
|
|
12
|
+
*
|
|
13
|
+
* This is useful for ignoring certain irregular whitespaces that are intentionally used in the document.
|
|
14
|
+
* @default []
|
|
15
|
+
*/
|
|
7
16
|
allow: string[];
|
|
17
|
+
/**
|
|
18
|
+
* `true` allows irregular whitespaces in all code blocks, while `string[]` allows irregular whitespaces only in code blocks for the specified languages.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
8
21
|
skipCode: boolean | string[];
|
|
22
|
+
/**
|
|
23
|
+
* `true` allows irregular whitespaces in all inline code.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
9
26
|
skipInlineCode: boolean;
|
|
10
27
|
}
|
|
11
28
|
];
|
package/build/rules/no-tab.d.ts
CHANGED
|
@@ -2,10 +2,25 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow tab characters.
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-tab` rule.
|
|
7
|
+
*/
|
|
5
8
|
type RuleOptions = [
|
|
6
9
|
{
|
|
10
|
+
/**
|
|
11
|
+
* `true` allows tabs in all code blocks, while `string[]` allows tabs only in code blocks for the specified languages.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
7
14
|
skipCode: boolean | string[];
|
|
15
|
+
/**
|
|
16
|
+
* `true` allows tabs in all inline code.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
8
19
|
skipInlineCode: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Number of spaces to replace each tab with when applying an autofix.
|
|
22
|
+
* @default 4
|
|
23
|
+
*/
|
|
9
24
|
tabWidth: number;
|
|
10
25
|
}
|
|
11
26
|
];
|
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
* @fileoverview Rule to disallow trailing punctuation in headings.
|
|
3
3
|
* @author Ga eun Lee(tooth-is-silver)
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Options for the `no-trailing-heading-punctuation` rule.
|
|
7
|
+
*/
|
|
8
|
+
type RuleOptions = [
|
|
9
|
+
{
|
|
10
|
+
/**
|
|
11
|
+
* Specifies the characters that are not allowed at the end of headings.
|
|
12
|
+
* @default ['.', ',', ';', ':', '!', '。', ',', ';', ':', '!']
|
|
13
|
+
*/
|
|
14
|
+
punctuation: string[];
|
|
15
|
+
}
|
|
16
|
+
];
|
|
8
17
|
declare const _default: {
|
|
9
18
|
readonly meta: {
|
|
10
19
|
readonly type: "problem";
|
|
@@ -6,16 +6,14 @@
|
|
|
6
6
|
// Import
|
|
7
7
|
// --------------------------------------------------------------------------------
|
|
8
8
|
import { escapeStringRegexp } from '../core/utils/index.js';
|
|
9
|
-
import { URL_RULE_DOCS } from '../core/constants.js';
|
|
9
|
+
import { URL_RULE_DOCS, punctuation as defaultPunctuation, gemojiRegex, } from '../core/constants.js';
|
|
10
10
|
// --------------------------------------------------------------------------------
|
|
11
11
|
// Helper
|
|
12
12
|
// --------------------------------------------------------------------------------
|
|
13
13
|
/**
|
|
14
14
|
* Regular expression for identifying a GitHub emoji code at the end of a line.
|
|
15
|
-
* - NOTE: These patterns are based on the `markdownlint`.
|
|
16
|
-
* @see https://github.com/DavidAnson/markdownlint/blob/v0.41.1/helpers/helpers.cjs#L36-L38
|
|
17
15
|
*/
|
|
18
|
-
const trailingGemojiRegex =
|
|
16
|
+
const trailingGemojiRegex = new RegExp(`${gemojiRegex.source}$`, gemojiRegex.flags);
|
|
19
17
|
/**
|
|
20
18
|
* Regular expression for identifying an HTML entity at the end of a line.
|
|
21
19
|
* - NOTE: These patterns are based on the `markdownlint`.
|
|
@@ -55,7 +53,7 @@ export default {
|
|
|
55
53
|
],
|
|
56
54
|
defaultOptions: [
|
|
57
55
|
{
|
|
58
|
-
punctuation: [
|
|
56
|
+
punctuation: [...defaultPunctuation],
|
|
59
57
|
},
|
|
60
58
|
],
|
|
61
59
|
messages: {
|
|
@@ -3,11 +3,32 @@
|
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
5
|
import type { Heading } from 'mdast';
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `require-heading-id` rule.
|
|
8
|
+
*/
|
|
6
9
|
type RuleOptions = [
|
|
10
|
+
/**
|
|
11
|
+
* `'always'` enforces the presence of heading IDs. `'never'` disallows heading IDs.
|
|
12
|
+
* @default 'always'
|
|
13
|
+
*/
|
|
7
14
|
'always' | 'never',
|
|
8
15
|
{
|
|
16
|
+
/**
|
|
17
|
+
* The left delimiter to use for heading IDs.
|
|
18
|
+
* @default '{'
|
|
19
|
+
*/
|
|
9
20
|
leftDelimiter: string;
|
|
21
|
+
/**
|
|
22
|
+
* The right delimiter to use for heading IDs.
|
|
23
|
+
* @default '}'
|
|
24
|
+
*/
|
|
10
25
|
rightDelimiter: string;
|
|
26
|
+
/**
|
|
27
|
+
* An array of heading depths to ignore.
|
|
28
|
+
*
|
|
29
|
+
* For example, `[1, 2]` would ignore level 1 and level 2 headings.
|
|
30
|
+
* @default []
|
|
31
|
+
*/
|
|
11
32
|
allowDepths: Heading['depth'][];
|
|
12
33
|
}
|
|
13
34
|
];
|
|
@@ -3,9 +3,20 @@
|
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
5
|
import type { Definition } from 'mdast';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `require-image-title` rule.
|
|
8
|
+
*/
|
|
9
|
+
type RuleOptions = [
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* When specified, specific definitions are allowed if they match one of the identifiers in this array.
|
|
13
|
+
*
|
|
14
|
+
* This is useful for ignoring definitions that are intentionally left without titles, such as comments or placeholders.
|
|
15
|
+
* @default ['//']
|
|
16
|
+
*/
|
|
17
|
+
allowDefinitions: string[];
|
|
18
|
+
}
|
|
19
|
+
];
|
|
9
20
|
declare const _default: {
|
|
10
21
|
readonly meta: {
|
|
11
22
|
readonly type: "problem";
|
|
@@ -3,9 +3,20 @@
|
|
|
3
3
|
* @author lumir(lumirlumir)
|
|
4
4
|
*/
|
|
5
5
|
import type { Definition } from 'mdast';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Options for the `require-link-title` rule.
|
|
8
|
+
*/
|
|
9
|
+
type RuleOptions = [
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* When specified, specific definitions are allowed if they match one of the identifiers in this array.
|
|
13
|
+
*
|
|
14
|
+
* This is useful for ignoring definitions that are intentionally left without titles, such as comments or placeholders.
|
|
15
|
+
* @default ['//']
|
|
16
|
+
*/
|
|
17
|
+
allowDefinitions: string[];
|
|
18
|
+
}
|
|
19
|
+
];
|
|
9
20
|
declare const _default: {
|
|
10
21
|
readonly meta: {
|
|
11
22
|
readonly type: "problem";
|