eslint-markdown 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/build/core/constants.d.ts +18 -2
  2. package/build/core/constants.js +37 -2
  3. package/build/core/types.d.ts +15 -3
  4. package/build/index.d.ts +6 -1505
  5. package/build/index.js +6 -4
  6. package/build/rules/allow-heading.d.ts +14 -5
  7. package/build/rules/allow-heading.js +11 -1
  8. package/build/rules/allow-image-url.d.ts +24 -5
  9. package/build/rules/allow-image-url.js +11 -1
  10. package/build/rules/allow-link-url.d.ts +24 -5
  11. package/build/rules/allow-link-url.js +11 -1
  12. package/build/rules/code-lang-shorthand.d.ts +20 -8
  13. package/build/rules/consistent-code-style.d.ts +18 -5
  14. package/build/rules/consistent-code-style.js +24 -7
  15. package/build/rules/consistent-delete-style.d.ts +15 -7
  16. package/build/rules/consistent-delete-style.js +5 -1
  17. package/build/rules/consistent-emphasis-style.d.ts +15 -7
  18. package/build/rules/consistent-emphasis-style.js +5 -1
  19. package/build/rules/consistent-inline-code-style.d.ts +1 -4
  20. package/build/rules/consistent-strong-style.d.ts +15 -7
  21. package/build/rules/consistent-strong-style.js +5 -1
  22. package/build/rules/consistent-thematic-break-style.d.ts +15 -7
  23. package/build/rules/consistent-unordered-list-style.d.ts +19 -8
  24. package/build/rules/consistent-unordered-list-style.js +2 -1
  25. package/build/rules/en-capitalization.d.ts +1 -4
  26. package/build/rules/index.d.ts +42 -111
  27. package/build/rules/no-consecutive-blank-line.d.ts +20 -8
  28. package/build/rules/no-control-character.d.ts +18 -4
  29. package/build/rules/no-curly-quote.d.ts +20 -4
  30. package/build/rules/no-double-punctuation.d.ts +15 -7
  31. package/build/rules/no-double-space.d.ts +13 -7
  32. package/build/rules/no-emoji.d.ts +15 -7
  33. package/build/rules/no-git-conflict-marker.d.ts +23 -7
  34. package/build/rules/no-git-conflict-marker.js +9 -1
  35. package/build/rules/no-irregular-dash.d.ts +18 -4
  36. package/build/rules/no-irregular-whitespace.d.ts +18 -4
  37. package/build/rules/no-tab.d.ts +16 -4
  38. package/build/rules/no-trailing-heading-punctuation.d.ts +13 -7
  39. package/build/rules/no-trailing-heading-punctuation.js +3 -5
  40. package/build/rules/no-url-trailing-slash.d.ts +1 -4
  41. package/build/rules/require-heading-id.d.ts +22 -4
  42. package/build/rules/require-image-title.d.ts +15 -7
  43. package/build/rules/require-link-title.d.ts +15 -7
  44. package/package.json +4 -3
@@ -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;
@@ -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,13 +1,20 @@
1
1
  /**
2
2
  * @fileoverview Define common types.
3
3
  */
4
- import type { MarkdownRuleDefinition, MarkdownRuleDefinitionTypeOptions } from '@eslint/markdown';
4
+ import type { MarkdownRuleDefinition, MarkdownRuleDefinitionTypeOptions, MarkdownRuleVisitor } from '@eslint/markdown';
5
+ /**
6
+ * Keeps inferred context types nameable without exposing Markdown's internal types.
7
+ *
8
+ * NOTE: This type supports compatibility with ESLint v9 and v10.
9
+ * Reevaluate whether it is still needed when ESLint v9 support is dropped.
10
+ */
11
+ export type RuleContext<Options extends Partial<MarkdownRuleDefinitionTypeOptions>> = Omit<Parameters<MarkdownRuleDefinition<Options>['create']>[0], never>;
5
12
  /**
6
13
  * Represents a rule module with specific rule options and message IDs.
7
14
  * @template RuleOptions The rule options.
8
15
  * @template MessageIds The message IDs.
9
16
  */
10
- export type RuleModule<RuleOptions extends MarkdownRuleDefinitionTypeOptions['RuleOptions'], MessageIds extends MarkdownRuleDefinitionTypeOptions['MessageIds']> = MarkdownRuleDefinition<{
17
+ export interface RuleModule<RuleOptions extends MarkdownRuleDefinitionTypeOptions['RuleOptions'], MessageIds extends MarkdownRuleDefinitionTypeOptions['MessageIds']> extends MarkdownRuleDefinition<{
11
18
  RuleOptions: RuleOptions;
12
19
  MessageIds: MessageIds;
13
20
  ExtRuleDocs: Partial<{
@@ -16,4 +23,9 @@ export type RuleModule<RuleOptions extends MarkdownRuleDefinitionTypeOptions['Ru
16
23
  */
17
24
  stylistic: boolean;
18
25
  }>;
19
- }>;
26
+ }> {
27
+ create(context: RuleContext<{
28
+ RuleOptions: RuleOptions;
29
+ MessageIds: MessageIds;
30
+ }>): MarkdownRuleVisitor;
31
+ }