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.
Files changed (46) hide show
  1. package/build/core/constants.d.ts +18 -2
  2. package/build/core/constants.js +37 -2
  3. package/build/core/utils/index.d.ts +2 -1
  4. package/build/core/utils/index.js +2 -1
  5. package/build/core/utils/normalize-regex-pattern.d.ts +11 -0
  6. package/build/core/utils/normalize-regex-pattern.js +16 -0
  7. package/build/index.d.ts +109 -26
  8. package/build/index.js +3 -3
  9. package/build/rules/allow-heading.d.ts +87 -15
  10. package/build/rules/allow-heading.js +19 -13
  11. package/build/rules/allow-image-url.d.ts +37 -5
  12. package/build/rules/allow-image-url.js +24 -6
  13. package/build/rules/allow-link-url.d.ts +37 -5
  14. package/build/rules/allow-link-url.js +24 -6
  15. package/build/rules/code-lang-shorthand.d.ts +19 -4
  16. package/build/rules/consistent-code-style.d.ts +17 -1
  17. package/build/rules/consistent-code-style.js +2 -1
  18. package/build/rules/consistent-delete-style.d.ts +14 -3
  19. package/build/rules/consistent-delete-style.js +5 -1
  20. package/build/rules/consistent-emphasis-style.d.ts +14 -3
  21. package/build/rules/consistent-emphasis-style.js +5 -1
  22. package/build/rules/consistent-strong-style.d.ts +14 -3
  23. package/build/rules/consistent-strong-style.js +5 -1
  24. package/build/rules/consistent-thematic-break-style.d.ts +14 -3
  25. package/build/rules/consistent-unordered-list-style.d.ts +18 -4
  26. package/build/rules/consistent-unordered-list-style.js +2 -1
  27. package/build/rules/index.d.ts +109 -26
  28. package/build/rules/index.js +0 -2
  29. package/build/rules/no-consecutive-blank-line.d.ts +19 -4
  30. package/build/rules/no-control-character.d.ts +17 -0
  31. package/build/rules/no-curly-quote.d.ts +19 -0
  32. package/build/rules/no-double-punctuation.d.ts +14 -3
  33. package/build/rules/no-double-space.d.ts +12 -3
  34. package/build/rules/no-emoji.d.ts +14 -3
  35. package/build/rules/no-git-conflict-marker.d.ts +12 -3
  36. package/build/rules/no-irregular-dash.d.ts +17 -0
  37. package/build/rules/no-irregular-whitespace.d.ts +17 -0
  38. package/build/rules/no-tab.d.ts +15 -0
  39. package/build/rules/no-trailing-heading-punctuation.d.ts +12 -3
  40. package/build/rules/no-trailing-heading-punctuation.js +3 -5
  41. package/build/rules/require-heading-id.d.ts +21 -0
  42. package/build/rules/require-image-title.d.ts +14 -3
  43. package/build/rules/require-link-title.d.ts +14 -3
  44. package/package.json +1 -1
  45. package/build/rules/no-bold-paragraph.d.ts +0 -30
  46. package/build/rules/no-bold-paragraph.js +0 -48
@@ -2,7 +2,7 @@
2
2
  * @fileoverview Rule to enforce the use of allowed or disallowed headings.
3
3
  * @author lumir(lumirlumir)
4
4
  */
5
- import { testRegexStateless } from '../core/utils/index.js';
5
+ import { normalizeRegexPattern, testRegexStateless } from '../core/utils/index.js';
6
6
  import { URL_RULE_DOCS } from '../core/constants.js';
7
7
  // --------------------------------------------------------------------------------
8
8
  // Helper
@@ -13,14 +13,14 @@ const headingOptionsSchema = {
13
13
  allow: {
14
14
  type: 'array',
15
15
  items: {
16
- type: 'object',
16
+ oneOf: [{ type: 'object', additionalProperties: false }, { type: 'string' }],
17
17
  },
18
18
  uniqueItems: true,
19
19
  },
20
20
  disallow: {
21
21
  type: 'array',
22
22
  items: {
23
- type: 'object',
23
+ oneOf: [{ type: 'object', additionalProperties: false }, { type: 'string' }],
24
24
  },
25
25
  uniqueItems: true,
26
26
  },
@@ -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'],
@@ -73,20 +74,25 @@ export default {
73
74
  create(context) {
74
75
  const { sourceCode } = context;
75
76
  const [{ h1, h2, h3, h4, h5, h6 }] = context.options;
76
- const headingMap = {
77
- 1: h1,
78
- 2: h2,
79
- 3: h3,
80
- 4: h4,
81
- 5: h5,
82
- 6: h6,
83
- };
77
+ const headingMap = [h1, h2, h3, h4, h5, h6].map(({ allow, disallow }) => ({
78
+ allow: allow.map(normalizeRegexPattern),
79
+ disallow: disallow.map(normalizeRegexPattern),
80
+ }));
84
81
  return {
85
82
  heading(node) {
86
83
  const { depth } = node;
87
- const { allow, disallow } = headingMap[depth];
84
+ const { allow, disallow } = headingMap[depth - 1];
88
85
  const headingText = sourceCode.getText(node);
89
- if (!allow.some(regex => testRegexStateless(regex, headingText))) {
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))) {
90
96
  context.report({
91
97
  node,
92
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
  {
8
- allowUrls: RegExp[];
9
- disallowUrls: RegExp[];
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
+ */
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
+ */
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";
@@ -26,14 +47,24 @@ declare const _default: {
26
47
  readonly allowUrls: {
27
48
  readonly type: "array";
28
49
  readonly items: {
29
- readonly type: "object";
50
+ readonly oneOf: [{
51
+ readonly type: "object";
52
+ readonly additionalProperties: false;
53
+ }, {
54
+ readonly type: "string";
55
+ }];
30
56
  };
31
57
  readonly uniqueItems: true;
32
58
  };
33
59
  readonly disallowUrls: {
34
60
  readonly type: "array";
35
61
  readonly items: {
36
- readonly type: "object";
62
+ readonly oneOf: [{
63
+ readonly type: "object";
64
+ readonly additionalProperties: false;
65
+ }, {
66
+ readonly type: "string";
67
+ }];
37
68
  };
38
69
  readonly uniqueItems: true;
39
70
  };
@@ -55,6 +86,7 @@ declare const _default: {
55
86
  readonly messages: {
56
87
  readonly allowImageUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
57
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.";
58
90
  };
59
91
  readonly language: "markdown";
60
92
  readonly dialects: ["commonmark", "gfm"];
@@ -3,7 +3,7 @@
3
3
  * @author lumir(lumirlumir)
4
4
  */
5
5
  import { normalizeIdentifier } from 'micromark-util-normalize-identifier';
6
- import { getElementsByTagName, testRegexStateless } from '../core/utils/index.js';
6
+ import { getElementsByTagName, normalizeRegexPattern, testRegexStateless, } from '../core/utils/index.js';
7
7
  import { URL_RULE_DOCS } from '../core/constants.js';
8
8
  // --------------------------------------------------------------------------------
9
9
  // Rule Definition
@@ -24,14 +24,20 @@ export default {
24
24
  allowUrls: {
25
25
  type: 'array',
26
26
  items: {
27
- type: 'object',
27
+ oneOf: [
28
+ { type: 'object', additionalProperties: false },
29
+ { type: 'string' },
30
+ ],
28
31
  },
29
32
  uniqueItems: true,
30
33
  },
31
34
  disallowUrls: {
32
35
  type: 'array',
33
36
  items: {
34
- type: 'object',
37
+ oneOf: [
38
+ { type: 'object', additionalProperties: false },
39
+ { type: 'string' },
40
+ ],
35
41
  },
36
42
  uniqueItems: true,
37
43
  },
@@ -56,14 +62,17 @@ export default {
56
62
  messages: {
57
63
  allowImageUrl: 'The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).',
58
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.',
59
66
  },
60
67
  language: 'markdown',
61
68
  dialects: ['commonmark', 'gfm'],
62
69
  },
63
70
  create(context) {
64
71
  const { sourceCode } = context;
65
- const [{ allowUrls, disallowUrls }] = context.options;
66
- const allowDefinitions = new Set(context.options[0].allowDefinitions.map(identifier => normalizeIdentifier(identifier).toLowerCase()));
72
+ const [{ allowUrls: allowUrlsOption, disallowUrls: disallowUrlsOption, allowDefinitions: allowDefinitionsOption, },] = context.options;
73
+ const allowUrls = allowUrlsOption.map(normalizeRegexPattern);
74
+ const disallowUrls = disallowUrlsOption.map(normalizeRegexPattern);
75
+ const allowDefinitions = new Set(allowDefinitionsOption.map(identifier => normalizeIdentifier(identifier).toLowerCase()));
67
76
  const images = new Set();
68
77
  const imageReferenceIdentifiers = new Set();
69
78
  const definitions = new Set();
@@ -114,7 +123,16 @@ export default {
114
123
  * Therefore, calling the `some` method on an empty array will always return `false`.
115
124
  */
116
125
  for (const { loc, url } of images) {
117
- if (!allowUrls.some(regex => testRegexStateless(regex, url))) {
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))) {
118
136
  context.report({
119
137
  loc,
120
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
  {
8
- allowUrls: RegExp[];
9
- disallowUrls: RegExp[];
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
+ */
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
+ */
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";
@@ -26,14 +47,24 @@ declare const _default: {
26
47
  readonly allowUrls: {
27
48
  readonly type: "array";
28
49
  readonly items: {
29
- readonly type: "object";
50
+ readonly oneOf: [{
51
+ readonly type: "object";
52
+ readonly additionalProperties: false;
53
+ }, {
54
+ readonly type: "string";
55
+ }];
30
56
  };
31
57
  readonly uniqueItems: true;
32
58
  };
33
59
  readonly disallowUrls: {
34
60
  readonly type: "array";
35
61
  readonly items: {
36
- readonly type: "object";
62
+ readonly oneOf: [{
63
+ readonly type: "object";
64
+ readonly additionalProperties: false;
65
+ }, {
66
+ readonly type: "string";
67
+ }];
37
68
  };
38
69
  readonly uniqueItems: true;
39
70
  };
@@ -55,6 +86,7 @@ declare const _default: {
55
86
  readonly messages: {
56
87
  readonly allowLinkUrl: "The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).";
57
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.";
58
90
  };
59
91
  readonly language: "markdown";
60
92
  readonly dialects: ["commonmark", "gfm"];
@@ -3,7 +3,7 @@
3
3
  * @author lumir(lumirlumir)
4
4
  */
5
5
  import { normalizeIdentifier } from 'micromark-util-normalize-identifier';
6
- import { getElementsByTagName, testRegexStateless } from '../core/utils/index.js';
6
+ import { getElementsByTagName, normalizeRegexPattern, testRegexStateless, } from '../core/utils/index.js';
7
7
  import { URL_RULE_DOCS } from '../core/constants.js';
8
8
  // --------------------------------------------------------------------------------
9
9
  // Rule Definition
@@ -24,14 +24,20 @@ export default {
24
24
  allowUrls: {
25
25
  type: 'array',
26
26
  items: {
27
- type: 'object',
27
+ oneOf: [
28
+ { type: 'object', additionalProperties: false },
29
+ { type: 'string' },
30
+ ],
28
31
  },
29
32
  uniqueItems: true,
30
33
  },
31
34
  disallowUrls: {
32
35
  type: 'array',
33
36
  items: {
34
- type: 'object',
37
+ oneOf: [
38
+ { type: 'object', additionalProperties: false },
39
+ { type: 'string' },
40
+ ],
35
41
  },
36
42
  uniqueItems: true,
37
43
  },
@@ -56,14 +62,17 @@ export default {
56
62
  messages: {
57
63
  allowLinkUrl: 'The URL `{{ url }}` is not in the list of allowed URLs. (Allow: {{ patterns }}).',
58
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.',
59
66
  },
60
67
  language: 'markdown',
61
68
  dialects: ['commonmark', 'gfm'],
62
69
  },
63
70
  create(context) {
64
71
  const { sourceCode } = context;
65
- const [{ allowUrls, disallowUrls }] = context.options;
66
- const allowDefinitions = new Set(context.options[0].allowDefinitions.map(identifier => normalizeIdentifier(identifier).toLowerCase()));
72
+ const [{ allowUrls: allowUrlsOption, disallowUrls: disallowUrlsOption, allowDefinitions: allowDefinitionsOption, },] = context.options;
73
+ const allowUrls = allowUrlsOption.map(normalizeRegexPattern);
74
+ const disallowUrls = disallowUrlsOption.map(normalizeRegexPattern);
75
+ const allowDefinitions = new Set(allowDefinitionsOption.map(identifier => normalizeIdentifier(identifier).toLowerCase()));
67
76
  const links = new Set();
68
77
  const linkReferenceIdentifiers = new Set();
69
78
  const definitions = new Set();
@@ -114,7 +123,16 @@ export default {
114
123
  * Therefore, calling the `some` method on an empty array will always return `false`.
115
124
  */
116
125
  for (const { loc, url } of links) {
117
- if (!allowUrls.some(regex => testRegexStateless(regex, url))) {
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))) {
118
136
  context.report({
119
137
  loc,
120
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
- type RuleOptions = [{
6
- allow: string[];
7
- override: Record<string, string>;
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 = 'indent' | 'fence-backtick' | 'fence-tilde';
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', 'indent', 'fence-backtick', 'fence-tilde'],
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 RuleOptions = [{
6
- style: 'consistent' | '~' | '~~';
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 RuleOptions = [{
6
- style: 'consistent' | '*' | '_';
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 RuleOptions = [{
6
- style: 'consistent' | '*' | '_';
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
- type RuleOptions = [{
6
- style: string;
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
- type RuleOptions = [{
8
- style: 'consistent' | 'sublist' | UnorderedListStyle;
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,