Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/yellow-cats-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-eslint-parser": minor
---

only parsing styles on-demand
5 changes: 4 additions & 1 deletion src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export function parseForESLint(
const styleElement = ast.body.find(
(b): b is SvelteStyleElement => b.type === "SvelteStyleElement"
);
const styleContext = parseStyleContext(styleElement, ctx);
let styleContext: StyleContext | null = null;

resultScript.ast = ast as any;
resultScript.services = Object.assign(resultScript.services || {}, {
Expand All @@ -198,6 +198,9 @@ export function parseForESLint(
return resultTemplate.svelteAst.html;
},
getStyleContext() {
if (styleContext === null) {
styleContext = parseStyleContext(styleElement, ctx);
}
return styleContext;
},
styleNodeLoc,
Expand Down