eslint-plugin-markdown-preferences 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,10 +13,10 @@ A specialized ESLint plugin that helps enforce consistent writing style and form
13
13
 
14
14
  ## 📛 Features
15
15
 
16
- - **🔧 Auto-fixable rules** - Automatically format your Markdown files to match your style preferences
17
- - **📝 Line break consistency** - Enforce consistent hard line break styles (backslash `\` vs trailing spaces)
18
- - **🔗 Link enforcement** - Ensure specific words or terms are properly linked to their documentation
19
- - **🎯 Customizable** - Configure rules to match your team's specific requirements
16
+ - **⚡ Effortless automation** - Transform your Markdown with auto-fixing that handles formatting, linking, and style consistency automatically
17
+ - **📖 Professional documentation** - Enforce consistent line breaks, clean up trailing spaces, and organize link definitions for enterprise-ready documentation
18
+ - **🎯 Smart terminology management** - Automatically convert specified words into inline code or clickable links based on your configuration
19
+ - **⚙️ Highly customizable configuration** - Fine-tune every aspect with granular rule options, word lists, ignore patterns, and flexible thresholds to match your exact requirements
20
20
 
21
21
  **Try it live:** Check out the [Online Demo](https://eslint-online-playground.netlify.app/#eslint-plugin-markdown-preferences) to see the plugin in action!
22
22
 
@@ -28,7 +28,7 @@ For detailed usage instructions, rule configurations, and examples, visit our co
28
28
 
29
29
  ## 💿 Installation
30
30
 
31
- ```bash
31
+ ```sh
32
32
  npm install --save-dev eslint eslint-plugin-markdown-preferences
33
33
  ```
34
34
 
@@ -86,17 +86,25 @@ The rules with the following star ⭐ are included in the configs.
86
86
 
87
87
  <!--RULES_TABLE_START-->
88
88
 
89
- ### Markdown Rules
89
+ ### Preference Rules
90
90
 
91
91
  | Rule ID | Description | Fixable | RECOMMENDED |
92
92
  |:--------|:------------|:-------:|:-----------:|
93
+ | [markdown-preferences/no-text-backslash-linebreak](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-text-backslash-linebreak.html) | disallow text backslash at the end of a line. | | ⭐ |
94
+ | [markdown-preferences/prefer-inline-code-words](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-inline-code-words.html) | enforce the use of inline code for specific words. | 🔧 | |
95
+ | [markdown-preferences/prefer-linked-words](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-linked-words.html) | enforce the specified word to be a link. | 🔧 | |
96
+
97
+ ### Stylistic Rules
98
+
99
+ | Rule ID | Description | Fixable | RECOMMENDED |
100
+ |:--------|:------------|:-------:|:-----------:|
101
+ | [markdown-preferences/canonical-code-block-language](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/canonical-code-block-language.html) | enforce canonical language names in code blocks | 🔧 | |
93
102
  | [markdown-preferences/definitions-last](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/definitions-last.html) | require link definitions and footnote definitions to be placed at the end of the document | 🔧 | |
94
103
  | [markdown-preferences/hard-linebreak-style](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/hard-linebreak-style.html) | enforce consistent hard linebreak style. | 🔧 | ⭐ |
95
- | [markdown-preferences/no-text-backslash-linebreak](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-text-backslash-linebreak.html) | disallow text backslash at the end of a line. | | ⭐ |
104
+ | [markdown-preferences/heading-casing](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/heading-casing.html) | enforce consistent casing in headings. | 🔧 | |
96
105
  | [markdown-preferences/no-trailing-spaces](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-trailing-spaces.html) | disallow trailing whitespace at the end of lines in Markdown files. | 🔧 | |
97
- | [markdown-preferences/prefer-inline-code-words](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-inline-code-words.html) | enforce the use of inline code for specific words. | 🔧 | |
98
106
  | [markdown-preferences/prefer-link-reference-definitions](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-link-reference-definitions.html) | enforce using link reference definitions instead of inline links | 🔧 | |
99
- | [markdown-preferences/prefer-linked-words](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-linked-words.html) | enforce the specified word to be a link. | 🔧 | |
107
+ | [markdown-preferences/sort-definitions](https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/sort-definitions.html) | enforce a specific order for link definitions and footnote definitions | 🔧 | |
100
108
 
101
109
  <!--RULES_TABLE_END-->
102
110
  <!--RULES_SECTION_END-->
package/lib/index.d.ts CHANGED
@@ -10,6 +10,11 @@ declare module 'eslint' {
10
10
  }
11
11
  }
12
12
  interface RuleOptions {
13
+ /**
14
+ * enforce canonical language names in code blocks
15
+ * @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/canonical-code-block-language.html
16
+ */
17
+ 'markdown-preferences/canonical-code-block-language'?: Linter.RuleEntry<MarkdownPreferencesCanonicalCodeBlockLanguage>;
13
18
  /**
14
19
  * require link definitions and footnote definitions to be placed at the end of the document
15
20
  * @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/definitions-last.html
@@ -20,6 +25,11 @@ interface RuleOptions {
20
25
  * @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/hard-linebreak-style.html
21
26
  */
22
27
  'markdown-preferences/hard-linebreak-style'?: Linter.RuleEntry<MarkdownPreferencesHardLinebreakStyle>;
28
+ /**
29
+ * enforce consistent casing in headings.
30
+ * @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/heading-casing.html
31
+ */
32
+ 'markdown-preferences/heading-casing'?: Linter.RuleEntry<MarkdownPreferencesHeadingCasing>;
23
33
  /**
24
34
  * disallow text backslash at the end of a line.
25
35
  * @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/no-text-backslash-linebreak.html
@@ -45,10 +55,26 @@ interface RuleOptions {
45
55
  * @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/prefer-linked-words.html
46
56
  */
47
57
  'markdown-preferences/prefer-linked-words'?: Linter.RuleEntry<MarkdownPreferencesPreferLinkedWords>;
58
+ /**
59
+ * enforce a specific order for link definitions and footnote definitions
60
+ * @see https://ota-meshi.github.io/eslint-plugin-markdown-preferences/rules/sort-definitions.html
61
+ */
62
+ 'markdown-preferences/sort-definitions'?: Linter.RuleEntry<MarkdownPreferencesSortDefinitions>;
48
63
  }
64
+ type MarkdownPreferencesCanonicalCodeBlockLanguage = [] | [{
65
+ languages?: {
66
+ [k: string]: string;
67
+ };
68
+ }];
49
69
  type MarkdownPreferencesHardLinebreakStyle = [] | [{
50
70
  style?: ("backslash" | "spaces");
51
71
  }];
72
+ type MarkdownPreferencesHeadingCasing = [] | [{
73
+ style?: ("Title Case" | "Sentence case");
74
+ preserveWords?: string[];
75
+ ignorePatterns?: string[];
76
+ minorWords?: string[];
77
+ }];
52
78
  type MarkdownPreferencesNoTrailingSpaces = [] | [{
53
79
  skipBlankLines?: boolean;
54
80
  ignoreComments?: boolean;
@@ -80,6 +106,13 @@ type MarkdownPreferencesPreferLinkedWords = [] | [{
80
106
  }[];
81
107
  [k: string]: unknown | undefined;
82
108
  }];
109
+ type MarkdownPreferencesSortDefinitions = [] | [{
110
+ order?: (string | [string, ...(string)[]] | {
111
+ match: (string | [string, ...(string)[]]);
112
+ sort: ("alphabetical" | "ignore");
113
+ })[];
114
+ alphabetical?: boolean;
115
+ }];
83
116
  declare namespace recommended_d_exports {
84
117
  export { files, language, name$1 as name, plugins, rules$1 as rules };
85
118
  }
@@ -95,19 +128,27 @@ declare namespace meta_d_exports {
95
128
  export { name, version };
96
129
  }
97
130
  declare const name: "eslint-plugin-markdown-preferences";
98
- declare const version: "0.7.0";
131
+ declare const version: "0.9.0";
99
132
  //#endregion
100
133
  //#region src/index.d.ts
101
134
  declare const configs: {
102
135
  recommended: typeof recommended_d_exports;
103
136
  };
104
137
  declare const rules: Record<string, RuleDefinition>;
138
+ declare const resources: {
139
+ defaultPreserveWords: string[];
140
+ defaultMinorWords: string[];
141
+ };
105
142
  declare const _default: {
106
143
  meta: typeof meta_d_exports;
107
144
  configs: {
108
145
  recommended: typeof recommended_d_exports;
109
146
  };
110
147
  rules: Record<string, RuleDefinition<_eslint_core0.RuleDefinitionTypeOptions>>;
148
+ resources: {
149
+ defaultPreserveWords: string[];
150
+ defaultMinorWords: string[];
151
+ };
111
152
  };
112
153
  //#endregion
113
- export { RuleOptions, configs, _default as default, meta_d_exports as meta, rules };
154
+ export { RuleOptions, configs, _default as default, meta_d_exports as meta, resources, rules };