diff --git a/.changeset/yellow-cats-impress.md b/.changeset/yellow-cats-impress.md new file mode 100644 index 00000000..13ea3232 --- /dev/null +++ b/.changeset/yellow-cats-impress.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +only parsing styles on-demand diff --git a/src/parser/index.ts b/src/parser/index.ts index 49346cf1..351deed6 100644 --- a/src/parser/index.ts +++ b/src/parser/index.ts @@ -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 || {}, { @@ -198,6 +198,9 @@ export function parseForESLint( return resultTemplate.svelteAst.html; }, getStyleContext() { + if (styleContext === null) { + styleContext = parseStyleContext(styleElement, ctx); + } return styleContext; }, styleNodeLoc,
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: