@zinkawaii/eslint-plugin-markdown 0.0.0 → 8.0.3-patch.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026-present KazariEX
4
+ Copyright OpenJS Foundation and other contributors, https://openjsf.org
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @zinkawaii/eslint-plugin-markdown
2
+
3
+ 这是一个 `@eslint/markdown` 的分支,其中 `micromark` 被替换为了 `satorigear`。
@@ -0,0 +1,165 @@
1
+ import { a as processor, i as MarkdownSourceCode, n as MarkdownLanguage, r as InlineConfigComment, t as rules_default } from "./rules-CjI0B_8H.mjs";
2
+ import { InlineMath, Math } from "satorigear";
3
+ import { CustomRuleDefinitionType, CustomRuleTypeDefinitions, CustomRuleVisitorWithExit } from "@eslint/plugin-kit";
4
+ import { Blockquote, Break, Code, Data, Definition, Delete, Emphasis, FootnoteDefinition, FootnoteReference, Heading, Html, Image, ImageReference, InlineCode, Link, LinkReference, List, ListItem, Literal, Node, Paragraph, Parent, Root, Strong, Table, TableCell, TableRow, Text, ThematicBreak, Yaml } from "mdast";
5
+ import { ConfigObject, LanguageContext, LanguageOptions, RuleVisitor } from "@eslint/core";
6
+ export interface RangeMap {
7
+ indent: number;
8
+ js: number;
9
+ md: number;
10
+ }
11
+ export interface BlockBase {
12
+ baseIndentText: string;
13
+ comments: string[];
14
+ rangeMap: RangeMap[];
15
+ }
16
+ export type Block = Code & BlockBase;
17
+ /**
18
+ * Markdown TOML.
19
+ */
20
+ export interface Toml extends Literal {
21
+ /**
22
+ * Node type of mdast TOML.
23
+ */
24
+ type: "toml";
25
+ /**
26
+ * Data associated with the mdast TOML.
27
+ */
28
+ data?: TomlData | undefined;
29
+ }
30
+ /**
31
+ * Info associated with mdast TOML nodes by the ecosystem.
32
+ */
33
+ export interface TomlData extends Data {}
34
+ /**
35
+ * Markdown JSON.
36
+ */
37
+ export interface Json extends Literal {
38
+ /**
39
+ * Node type of mdast JSON.
40
+ */
41
+ type: "json";
42
+ /**
43
+ * Data associated with the mdast JSON.
44
+ */
45
+ data?: JsonData | undefined;
46
+ }
47
+ /**
48
+ * Info associated with mdast JSON nodes by the ecosystem.
49
+ */
50
+ export interface JsonData extends Data {}
51
+ /**
52
+ * Registers additional mdast nodes as valid front matter and root content.
53
+ */
54
+ declare module "mdast" {
55
+ interface FrontmatterContentMap {
56
+ toml: Toml;
57
+ json: Json;
58
+ }
59
+ interface RootContentMap {
60
+ toml: Toml;
61
+ json: Json;
62
+ }
63
+ }
64
+ /**
65
+ * Language options provided for Markdown files.
66
+ */
67
+ export interface MarkdownLanguageOptions extends LanguageOptions {
68
+ /**
69
+ * The options for parsing frontmatter.
70
+ * @default false
71
+ */
72
+ frontmatter?: false | "yaml" | "toml" | "json";
73
+ /**
74
+ * The options for parsing math.
75
+ * @default false
76
+ */
77
+ math?: boolean;
78
+ }
79
+ /**
80
+ * The context object that is passed to the Markdown language plugin methods.
81
+ */
82
+ export type MarkdownLanguageContext = LanguageContext<MarkdownLanguageOptions>;
83
+ /**
84
+ * A Markdown syntax element, including nodes and comments.
85
+ */
86
+ export type MarkdownSyntaxElement = Node | InlineConfigComment;
87
+ export interface MarkdownRuleVisitor extends RuleVisitor, CustomRuleVisitorWithExit<{
88
+ root?(node: Root): void;
89
+ } & { [NodeType in Blockquote | Break | Code | Definition | Emphasis | Heading | Html | Image | ImageReference | InlineCode | Link | LinkReference | List | ListItem | Paragraph | Strong | Text | ThematicBreak | Delete | FootnoteDefinition | FootnoteReference | Table | TableCell | TableRow | Yaml | Toml | Json | InlineMath | Math as NodeType["type"]]?: (node: NodeType, parent?: Parent) => void; }> {}
90
+ export type MarkdownRuleDefinitionTypeOptions = CustomRuleTypeDefinitions;
91
+ export type MarkdownRuleDefinition<Options extends Partial<MarkdownRuleDefinitionTypeOptions> = {}> = CustomRuleDefinitionType<{
92
+ LangOptions: MarkdownLanguageOptions;
93
+ Code: MarkdownSourceCode;
94
+ Visitor: MarkdownRuleVisitor;
95
+ Node: MarkdownSyntaxElement;
96
+ }, Options>;
97
+ declare namespace plugin {
98
+ export namespace meta {
99
+ let name: string;
100
+ let namespace: string;
101
+ let version: string;
102
+ }
103
+ export namespace processors {
104
+ export { processor as markdown };
105
+ }
106
+ export namespace languages {
107
+ let commonmark: MarkdownLanguage;
108
+ let gfm: MarkdownLanguage;
109
+ }
110
+ export { rules_default as rules };
111
+ export let configs: {
112
+ "recommended-legacy": {
113
+ plugins: string[];
114
+ overrides: ({
115
+ files: string[];
116
+ processor: string;
117
+ parserOptions?: undefined;
118
+ rules?: undefined;
119
+ } | {
120
+ files: string[];
121
+ parserOptions: {
122
+ ecmaFeatures: {
123
+ impliedStrict: boolean;
124
+ };
125
+ };
126
+ rules: {
127
+ "eol-last": "off";
128
+ "no-undef": "off";
129
+ "no-unused-expressions": "off";
130
+ "no-unused-vars": "off";
131
+ "padded-blocks": "off";
132
+ strict: "off";
133
+ "unicode-bom": "off";
134
+ };
135
+ processor?: undefined;
136
+ })[];
137
+ };
138
+ recommended: {
139
+ name: string;
140
+ files: string[];
141
+ language: string;
142
+ plugins: {};
143
+ rules: {
144
+ readonly "markdown/fenced-code-language": "error";
145
+ readonly "markdown/heading-increment": "error";
146
+ readonly "markdown/no-duplicate-definitions": "error";
147
+ readonly "markdown/no-empty-definitions": "error";
148
+ readonly "markdown/no-empty-images": "error";
149
+ readonly "markdown/no-empty-links": "error";
150
+ readonly "markdown/no-invalid-label-refs": "error";
151
+ readonly "markdown/no-missing-atx-heading-space": "error";
152
+ readonly "markdown/no-missing-label-refs": "error";
153
+ readonly "markdown/no-missing-link-fragments": "error";
154
+ readonly "markdown/no-multiple-h1": "error";
155
+ readonly "markdown/no-reference-like-urls": "error";
156
+ readonly "markdown/no-reversed-media-syntax": "error";
157
+ readonly "markdown/no-space-in-emphasis": "error";
158
+ readonly "markdown/no-unused-definitions": "error";
159
+ readonly "markdown/require-alt-text": "error";
160
+ };
161
+ }[];
162
+ processor: ConfigObject[];
163
+ };
164
+ }
165
+ export { MarkdownLanguage, MarkdownSourceCode, plugin as default };
package/dist/index.mjs ADDED
@@ -0,0 +1,93 @@
1
+ import { a as processor, i as MarkdownSourceCode, n as MarkdownLanguage, t as rules_default } from "./rules-CjI0B_8H.mjs";
2
+ // vendor/src/build/recommended-config.js
3
+ const rules = {
4
+ "markdown/fenced-code-language": "error",
5
+ "markdown/heading-increment": "error",
6
+ "markdown/no-duplicate-definitions": "error",
7
+ "markdown/no-empty-definitions": "error",
8
+ "markdown/no-empty-images": "error",
9
+ "markdown/no-empty-links": "error",
10
+ "markdown/no-invalid-label-refs": "error",
11
+ "markdown/no-missing-atx-heading-space": "error",
12
+ "markdown/no-missing-label-refs": "error",
13
+ "markdown/no-missing-link-fragments": "error",
14
+ "markdown/no-multiple-h1": "error",
15
+ "markdown/no-reference-like-urls": "error",
16
+ "markdown/no-reversed-media-syntax": "error",
17
+ "markdown/no-space-in-emphasis": "error",
18
+ "markdown/no-unused-definitions": "error",
19
+ "markdown/require-alt-text": "error"
20
+ };
21
+ // vendor/src/index.js
22
+ /**
23
+ * @fileoverview Markdown plugin.
24
+ * @author Brandon Mills
25
+ */
26
+ /**
27
+ * @import { ConfigObject, RulesConfig } from "@eslint/core";
28
+ */
29
+ /** @satisfies {RulesConfig} */
30
+ const processorRulesConfig = {
31
+ "eol-last": "off",
32
+ "no-undef": "off",
33
+ "no-unused-expressions": "off",
34
+ "no-unused-vars": "off",
35
+ "padded-blocks": "off",
36
+ strict: "off",
37
+ "unicode-bom": "off"
38
+ };
39
+ let recommendedPlugins;
40
+ let processorPlugins;
41
+ const plugin = {
42
+ meta: {
43
+ name: "@eslint/markdown",
44
+ namespace: "markdown",
45
+ version: "8.0.3"
46
+ },
47
+ processors: { markdown: processor },
48
+ languages: {
49
+ commonmark: new MarkdownLanguage({ mode: "commonmark" }),
50
+ gfm: new MarkdownLanguage({ mode: "gfm" })
51
+ },
52
+ rules: rules_default,
53
+ configs: {
54
+ "recommended-legacy": {
55
+ plugins: ["markdown"],
56
+ overrides: [{
57
+ files: ["*.md"],
58
+ processor: "markdown/markdown"
59
+ }, {
60
+ files: ["**/*.md/**"],
61
+ parserOptions: { ecmaFeatures: { impliedStrict: true } },
62
+ rules: { ...processorRulesConfig }
63
+ }]
64
+ },
65
+ recommended: [{
66
+ name: "markdown/recommended",
67
+ files: ["**/*.md"],
68
+ language: "markdown/commonmark",
69
+ plugins: recommendedPlugins = {},
70
+ rules
71
+ }],
72
+ processor: [
73
+ {
74
+ name: "markdown/recommended/plugin",
75
+ plugins: processorPlugins = {}
76
+ },
77
+ {
78
+ name: "markdown/recommended/processor",
79
+ files: ["**/*.md"],
80
+ processor: "markdown/markdown"
81
+ },
82
+ {
83
+ name: "markdown/recommended/code-blocks",
84
+ files: ["**/*.md/**"],
85
+ languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
86
+ rules: { ...processorRulesConfig }
87
+ }
88
+ ]
89
+ }
90
+ };
91
+ Object.assign(recommendedPlugins, { markdown: plugin });
92
+ Object.assign(processorPlugins, { markdown: plugin });
93
+ export { MarkdownLanguage, MarkdownSourceCode, plugin as default };