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

No compile errors when passing empty directive names #6299

Closed
qurafi opened this issue May 4, 2021 · 3 comments · Fixed by #6300
Closed

No compile errors when passing empty directive names #6299

qurafi opened this issue May 4, 2021 · 3 comments · Fixed by #6300

Comments

@qurafi
Copy link
Contributor

qurafi commented May 4, 2021

Looks like I can pass empty directive names which can generate invalid JS code without any compilation errors or with unclear errors

For example in actions

<element use: />

Parts of generated code looks like:

dispose = action_destroyer(_action = .call(null, h1));

Same happens with event directive. but it does not throw JS syntax error

dispose = listen(h1, "", /*_handler*/ ctx[0]);

With bind and animation directives. It throws an error because it is not able to look for the empty variable name in the component.

[!] (plugin svelte) ValidationError: is not declared

@Phaqui
Copy link
Contributor

Phaqui commented May 10, 2021

Unable to reproduce in the repl. The one-line App.svelte component of <div use: /> gives me Unexpected token (Note that you need plugins to import files that are not JavaScript)

Which version is this?

@qurafi
Copy link
Contributor Author

qurafi commented May 10, 2021

You already reproduced it. This message because rollup cannot parse the invalid generated code dispose = action_destroyer(_action = .call(null, h1));

tanhauhau pushed a commit that referenced this issue Jun 28, 2021
…6300)

* Compile error when passing empty directive names

* Revert "Compile error when passing empty directive names"

This reverts commit ac8718b.

* Compile error when passing empty directive names

* Adjust empty-directive-name error offset
@Conduitry
Copy link
Member

In 3.39.0, this now throws a compiler error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants