@html-eslint/types 0.35.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 YeonJuan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/lib/ast.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { AnyHTMLNode } from "./html-ast";
2
+ import { AnyJsNode } from "./js-ast";
3
+
4
+ export type AnyNode = AnyHTMLNode | AnyJsNode;
@@ -0,0 +1,200 @@
1
+ import * as Parser from "es-html-parser";
2
+ import eslint from "eslint";
3
+ import * as estree from "estree";
4
+
5
+ export interface Document extends Parser.DocumentNode {
6
+ parent: null;
7
+ children: Array<Tag | Text | Comment | Doctype | ScriptTag | StyleTag>;
8
+ }
9
+
10
+ export type Text = Parser.TextNode & {
11
+ parent: Tag | Document | null;
12
+ };
13
+
14
+ export interface Doctype extends Parser.DoctypeNode {
15
+ parent: Document | Tag;
16
+ open: DoctypeOpen;
17
+ close: DoctypeClose;
18
+ attributes: Array<DoctypeAttribute>;
19
+ }
20
+
21
+ export interface DoctypeOpen extends Parser.DoctypeOpenNode {
22
+ parent: Doctype;
23
+ }
24
+
25
+ export interface DoctypeClose extends Parser.DoctypeCloseNode {
26
+ parent: Doctype;
27
+ }
28
+
29
+ export interface DoctypeAttribute extends Parser.DoctypeAttributeNode {
30
+ parent: Doctype;
31
+ startWrapper?: DoctypeAttributeWrapperStart;
32
+ value?: DoctypeAttributeValue;
33
+ endWrapper?: DoctypeAttributeWrapperEnd;
34
+ }
35
+
36
+ export interface DoctypeAttributeValue
37
+ extends Parser.DoctypeAttributeValueNode {
38
+ parent: DoctypeAttribute;
39
+ }
40
+
41
+ export interface DoctypeAttributeWrapperStart
42
+ extends Parser.DoctypeAttributeWrapperStartNode {
43
+ parent: DoctypeAttribute;
44
+ }
45
+
46
+ export interface DoctypeAttributeWrapperEnd
47
+ extends Parser.DoctypeAttributeWrapperEndNode {
48
+ parent: DoctypeAttribute;
49
+ }
50
+
51
+ export interface Comment extends Parser.CommentNode {
52
+ parent: Tag | Document;
53
+ open: CommentOpen;
54
+ close: CommentClose;
55
+ value: CommentContent;
56
+ }
57
+
58
+ export interface CommentOpen extends Parser.CommentOpenNode {
59
+ parent: Comment;
60
+ }
61
+
62
+ export interface CommentClose extends Parser.CommentCloseNode {
63
+ parent: Comment;
64
+ }
65
+
66
+ export interface CommentContent extends Parser.CommentContentNode {
67
+ parent: Comment;
68
+ }
69
+
70
+ export interface Tag extends Parser.TagNode {
71
+ parent: Document | Tag;
72
+ openStart: OpenTagStart;
73
+ openEnd: OpenTagEnd;
74
+ attributes: Array<Attribute>;
75
+ close?: CloseTag;
76
+ children: Array<Tag | Text | StyleTag | ScriptTag>;
77
+ }
78
+
79
+ export interface OpenTagStart extends Parser.OpenTagStartNode {
80
+ parent: Tag;
81
+ }
82
+
83
+ export interface OpenTagEnd extends Parser.OpenTagEndNode {
84
+ parent: Tag;
85
+ }
86
+
87
+ export interface CloseTag extends Parser.CloseTagNode {
88
+ parent: Tag;
89
+ }
90
+
91
+ export interface ScriptTag extends Parser.ScriptTagNode {
92
+ parent: Document | Tag;
93
+ attributes: Array<Attribute>;
94
+ openStart: OpenScriptTagStart;
95
+ openEnd: OpenScriptTagEnd;
96
+ value?: ScriptTagContent;
97
+ }
98
+
99
+ export interface OpenScriptTagStart extends Parser.OpenScriptTagStartNode {
100
+ parent: ScriptTag;
101
+ }
102
+
103
+ export interface OpenScriptTagEnd extends Parser.OpenScriptTagEndNode {
104
+ parent: ScriptTag;
105
+ }
106
+
107
+ export interface CloseScriptTag extends Parser.CloseScriptTagNode {
108
+ parent: ScriptTag;
109
+ }
110
+
111
+ export interface ScriptTagContent extends Parser.ScriptTagContentNode {
112
+ parent: ScriptTag;
113
+ }
114
+
115
+ export interface StyleTag extends Parser.StyleTagNode {
116
+ parent: Document | Tag;
117
+ attributes: Array<Attribute>;
118
+ openStart: OpenStyleTagStart;
119
+ openEnd: OpenStyleTagEnd;
120
+ value?: StyleTagContent;
121
+ }
122
+
123
+ export interface OpenStyleTagStart extends Parser.OpenStyleTagStartNode {
124
+ parent: StyleTag;
125
+ }
126
+
127
+ export interface OpenStyleTagEnd extends Parser.OpenStyleTagEndNode {
128
+ parent: StyleTag;
129
+ }
130
+
131
+ export interface CloseStyleTag extends Parser.CloseStyleTagNode {
132
+ parent: StyleTag;
133
+ }
134
+
135
+ export interface StyleTagContent extends Parser.StyleTagContentNode {
136
+ parent: StyleTag;
137
+ }
138
+
139
+ export interface Attribute extends Parser.AttributeNode {
140
+ parent: Tag;
141
+ key: AttributeKey;
142
+ value?: AttributeValue;
143
+ startWrapper?: AttributeValueWrapperStart;
144
+ endWrapper?: AttributeValueWrapperEnd;
145
+ }
146
+
147
+ export interface AttributeKey extends Parser.AttributeKeyNode {
148
+ parent: Attribute;
149
+ }
150
+
151
+ export interface AttributeValue extends Parser.AttributeValueNode {
152
+ parent: Attribute;
153
+ }
154
+
155
+ export interface AttributeValueWrapperStart
156
+ extends Parser.AttributeValueWrapperStartNode {
157
+ parent: Attribute;
158
+ }
159
+
160
+ export interface AttributeValueWrapperEnd
161
+ extends Parser.AttributeValueWrapperEndNode {
162
+ parent: Attribute;
163
+ }
164
+
165
+ export type TemplateText = Text["parts"][number];
166
+
167
+ export type OpenTemplate = Parser.OpenTemplateNode;
168
+ export type CloseTemplate = Parser.CloseTemplateNode;
169
+
170
+ export type AnyHTMLNode =
171
+ | Document
172
+ | Doctype
173
+ | DoctypeOpen
174
+ | DoctypeClose
175
+ | DoctypeAttribute
176
+ | DoctypeAttributeValue
177
+ | Comment
178
+ | CommentOpen
179
+ | CommentClose
180
+ | CommentContent
181
+ | Tag
182
+ | OpenTagStart
183
+ | OpenTagEnd
184
+ | CloseTag
185
+ | ScriptTag
186
+ | OpenScriptTagStart
187
+ | OpenScriptTagEnd
188
+ | ScriptTagContent
189
+ | CloseScriptTag
190
+ | StyleTag
191
+ | OpenStyleTagStart
192
+ | OpenStyleTagEnd
193
+ | StyleTagContent
194
+ | CloseStyleTag
195
+ | Attribute
196
+ | AttributeKey
197
+ | AttributeValue
198
+ | AttributeValueWrapperEnd
199
+ | AttributeValueWrapperStart
200
+ | Text;
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./html-ast";
2
+ export * from "./js-ast";
3
+ export * from "./ast";
@@ -0,0 +1,35 @@
1
+ import * as Parser from "es-html-parser";
2
+ import eslint from "eslint";
3
+ import * as estree from "estree";
4
+
5
+ interface EstreeNode extends estree.BaseNode {
6
+ type: string;
7
+ loc: eslint.AST.SourceLocation;
8
+ range: eslint.AST.Range;
9
+ }
10
+
11
+ export interface TaggedTemplateExpression
12
+ extends estree.TaggedTemplateExpression {
13
+ parent: EstreeNode | null;
14
+ loc: eslint.AST.SourceLocation;
15
+ range: eslint.AST.Range;
16
+ quasi: TemplateLiteral;
17
+ }
18
+
19
+ export interface TemplateLiteral extends estree.TemplateLiteral {
20
+ parent: EstreeNode | null;
21
+ loc: eslint.AST.SourceLocation;
22
+ range: eslint.AST.Range;
23
+ quasis: TemplateElement[];
24
+ }
25
+
26
+ export interface TemplateElement extends estree.TemplateElement {
27
+ parent: EstreeNode | null;
28
+ loc: eslint.AST.SourceLocation;
29
+ range: eslint.AST.Range;
30
+ }
31
+
32
+ export type AnyJsNode =
33
+ | TaggedTemplateExpression
34
+ | TemplateLiteral
35
+ | TemplateElement;
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@html-eslint/types",
3
+ "version": "0.35.1",
4
+ "description": "Types for @html-eslint/eslint-plugin",
5
+ "author": "yeonjuan",
6
+ "homepage": "https://github.com/yeonjuan/html-eslint#readme",
7
+ "license": "MIT",
8
+ "types": "lib/index.d.ts",
9
+ "files": [
10
+ "lib"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/yeonjuan/html-eslint.git"
18
+ },
19
+ "scripts": {
20
+ "ts": "tsc --noEmit"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/yeonjuan/html-eslint/issues"
24
+ },
25
+ "devDependencies": {
26
+ "@types/estree": "^1.0.6",
27
+ "es-html-parser": "0.1.1",
28
+ "eslint": "^9.19.0",
29
+ "typescript": "^5.7.2"
30
+ },
31
+ "gitHead": "b11e32e8205e808f8b2712e082d1ece37b5191aa"
32
+ }