Skip to content

Commit 5aa2f2b

Browse files
committed
Adding parent to PostCSS root
1 parent 98319a6 commit 5aa2f2b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/ast/style.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import type { BaseNode } from "./base";
44
export type ESLintCompatiblePostCSSNode<PostCSSNode extends Node = Node> =
55
BaseNode &
66
(PostCSSNode extends Container<infer Child>
7-
? Omit<Container<ESLintCompatiblePostCSSNode<Child>>, "walk"> & {
7+
? Omit<
8+
Container<ESLintCompatiblePostCSSNode<Child>>,
9+
"parent" | "walk"
10+
> & {
11+
parent: BaseNode;
812
walk(
913
callback: (
1014
node: ESLintCompatiblePostCSSNode<Child>,

src/parser/converts/root.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export function convertSvelteRoot(
157157
style.body?.walk((node: ESLintCompatiblePostCSSNode<ChildNode>) =>
158158
convertPostCSSNodeToESLintNode(node, style.loc, contentRange)
159159
);
160+
style.body.parent = style;
160161
delete style.body.source?.input.file;
161162
}
162163
ctx.addToken("HTMLText", contentRange);

0 commit comments

Comments
 (0)