Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style tag inside svelte:head marked as an error #586

Closed
ehrencrona opened this issue Oct 2, 2020 · 2 comments · Fixed by sveltejs/svelte#5487
Closed

Style tag inside svelte:head marked as an error #586

ehrencrona opened this issue Oct 2, 2020 · 2 comments · Fixed by sveltejs/svelte#5487
Labels
bug Something isn't working

Comments

@ehrencrona
Copy link
Contributor

ehrencrona commented Oct 2, 2020

The following file does not check out with svelte-check (I noticed this while looking at sveltejs/prettier-plugin-svelte#149):

<svelte:head>
  <style>
  </style>
</svelte:head>
> npx [email protected] src/deleteme.svelte 

Loading svelte-check in workspace: /projects/svelte/prettier-plugin-svelte
Getting Svelte diagnostics...
====================================

/projects/svelte/prettier-plugin-svelte/src/deleteme.svelte:5:17
Error: ';' expected. (js)
</svelte:head>

/projects/svelte/prettier-plugin-svelte/src/deleteme.svelte:6:1
Error: Expression expected. (js)

System (please complete the following information):
MacOS, Node 14.4, Svelte-check 1.0.54

@ehrencrona ehrencrona added the bug Something isn't working label Oct 2, 2020
@dummdidumm
Copy link
Member

svelte2tsx transformation is wrong, gets transformed to

///<reference types="svelte" />
<></>;function render() {
<><sveltehead>
  
</sveltehead> </></style> // <---------------- wrong
return { props: {}, slots: {}, getters: {}, events: {} }}

export default class extends createSvelte2TsxComponent(__sveltets_partial(__sveltets_with_any_event(render))) {
}

@ehrencrona
Copy link
Contributor Author

It's this line of code https://github.com/sveltejs/language-tools/blob/master/packages/svelte2tsx/src/htmlxtojsx/nodes/element.ts#L20 together with the issue I fixed in sveltejs/svelte#5487

That was tricky to find :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants