sveltejs / eslint-plugin-svelte

ESLint plugin for Svelte using AST
https://sveltejs.github.io/eslint-plugin-svelte/
MIT License
276 stars 29 forks source link

fix: update `svelte-eslint-parser` to fix nested `{#snippet}` #805

Closed baseballyama closed 6 days ago

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 4f7a0079fd3ca82f63acec4ada98965e4c835f5f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | -------------------- | ----- | | eslint-plugin-svelte | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

ota-meshi commented 1 week ago

Hmm. The latest svelte/compiler v5 seems to give an OOM error for the following code. I don't know why yet.

{#snippet
foo(
{
a
}
)
}
{/snippet}
{@render
foo(
{
a
}
)
}
ota-meshi commented 1 week ago

There seems to be no problem with 5.0.0-next.163. There may be a problem with the difference with 5.0.0-next.164.

ota-meshi commented 1 week ago

I haven't written a test case yet, so I'm not sure, but we may need to add the s flag to handle newline characters.

https://github.com/sveltejs/svelte/pull/12070/files#diff-07a9d6689d63c982b2e3a45ae4bd624240d27824e8c5bdce8a539b4d2a7c36f1R282

-           params += parser.read(/^./);
+           params += parser.read(/^./s);
ota-meshi commented 1 week ago

It seems to have been fixed already, we just need to wait for the next version release.

https://github.com/sveltejs/svelte/pull/12144/files

ota-meshi commented 1 week ago

Some issues were still not fixed, so I opened an issue in the svelte repo.

https://github.com/sveltejs/svelte/issues/12156