@html-eslint/types 0.51.0 → 0.53.0-alpha.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/lib/ast.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AnyHTMLNode } from "./html-ast";
2
2
  import { AnyJsNode } from "./js-ast";
3
+ import { AnyCssNode } from "./css-ast";
3
4
  export { AnyToken } from "es-html-parser";
4
- export type AnyNode = AnyHTMLNode | AnyJsNode;
5
+ export type AnyNode = AnyHTMLNode | AnyJsNode | AnyCssNode;
@@ -0,0 +1,53 @@
1
+ import CSSTree, { CssLocation, List } from "css-tree";
2
+
3
+ type ToESTree<Node extends CSSTree.CssNodeCommon> = Omit<
4
+ Node,
5
+ "type" | "children"
6
+ > & {
7
+ range: [number, number];
8
+ loc: CssLocation;
9
+ };
10
+
11
+ export type AnyCssNode =
12
+ | CssStyleSheet
13
+ | CssSelectorList
14
+ | CssSelector
15
+ | CssBlock
16
+ | CssDeclaration
17
+ | CssCombinator;
18
+
19
+ export type CssStyleSheet = ToESTree<CSSTree.StyleSheetPlain> & {
20
+ parent?: AnyCssNode;
21
+ type: "CssStyleSheet";
22
+ children: List<AnyCssNode>;
23
+ };
24
+
25
+ export type CssSelectorList = ToESTree<CSSTree.SelectorListPlain> & {
26
+ parent?: AnyCssNode;
27
+ type: "CssSelectorList";
28
+ children: List<AnyCssNode>;
29
+ };
30
+
31
+ export type CssSelector = ToESTree<CSSTree.SelectorPlain> & {
32
+ parent?: AnyCssNode;
33
+ type: "CssSelector";
34
+ children: List<AnyCssNode>;
35
+ };
36
+
37
+ export type CssBlock = ToESTree<CSSTree.Block> & {
38
+ parent?: AnyCssNode;
39
+ type: "CssBlock";
40
+ children: AnyCssNode[];
41
+ };
42
+
43
+ export type CssDeclaration = ToESTree<CSSTree.Declaration> & {
44
+ parent?: AnyCssNode;
45
+ type: "CssDeclaration";
46
+ children: List<AnyCssNode>;
47
+ };
48
+
49
+ export type CssCombinator = ToESTree<CSSTree.Combinator> & {
50
+ parent?: AnyCssNode;
51
+ type: "CssCombinator";
52
+ loc?: CssLocation | null;
53
+ };
package/lib/html-ast.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as Parser from "es-html-parser";
2
+ import { AnyCssNode, CssStyleSheet } from "./css-ast";
2
3
 
3
4
  export interface Document extends Parser.DocumentNode {
4
5
  parent: null;
@@ -108,6 +109,7 @@ export interface CloseScriptTag extends Parser.CloseScriptTagNode {
108
109
 
109
110
  export interface ScriptTagContent extends Parser.ScriptTagContentNode {
110
111
  parent: ScriptTag;
112
+ stylesheet?: AnyCssNode;
111
113
  }
112
114
 
113
115
  export interface StyleTag extends Parser.StyleTagNode {
@@ -132,6 +134,7 @@ export interface CloseStyleTag extends Parser.CloseStyleTagNode {
132
134
 
133
135
  export interface StyleTagContent extends Parser.StyleTagContentNode {
134
136
  parent: StyleTag;
137
+ stylesheet?: CssStyleSheet;
135
138
  }
136
139
 
137
140
  export interface Attribute extends Parser.AttributeNode {
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./html-ast";
2
2
  export * from "./js-ast";
3
3
  export * from "./ast";
4
+ export * from "./css-ast";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-eslint/types",
3
- "version": "0.51.0",
3
+ "version": "0.53.0-alpha.0",
4
4
  "description": "Types for @html-eslint/eslint-plugin",
5
5
  "author": "yeonjuan",
6
6
  "homepage": "https://github.com/yeonjuan/html-eslint#readme",
@@ -23,12 +23,14 @@
23
23
  "url": "https://github.com/yeonjuan/html-eslint/issues"
24
24
  },
25
25
  "dependencies": {
26
+ "@types/css-tree": "^2.3.11",
26
27
  "@types/estree": "^1.0.6",
27
28
  "es-html-parser": "0.3.1",
28
29
  "eslint": "^9.39.1"
29
30
  },
30
31
  "devDependencies": {
32
+ "css-tree": "^3.1.0",
31
33
  "typescript": "^5.8.3"
32
34
  },
33
- "gitHead": "fcf6a16bcd2d74ca1b3037d0729a30a852dff494"
35
+ "gitHead": "0739c592dbc3129713e89cd92bc16be62c12164d"
34
36
  }