-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Disallow props that look like directives #6823
Comments
This should also apply to attributes that look like directives. I don't know how to make this play nicely with https://kit.svelte.dev/docs#anchor-options - I don't want SvelteKit-specific escape hatches in Svelte. We'll need to cross that bridge at some point. |
Maybe a pre-processor in SK to get around this? |
How about a special syntax like this? <div @on:click={...}></div> This would be a big breaking change. |
I think this should be done, instead of other one suggest above |
I don't know if they work the way they work but I use tailwindcss for almost all the css side of things. |
IMO this should be ok, since the attribute name as seen by Svelte is
Thankfully we made the decision to have I propose to make this a warning in Svelte 4 and an error in Svelte 5. |
Would it being a warning be enough for us to feel safe adding new directives in some 4.x after 4.0? Or do you think we shouldn't worry about strict semver compliance here, because we're already non-compliant in 3.x and emitting warnings is a step in the right direction? |
I'd say so, yes. Also I think it's unlikely we add new directives in 4.x, it's more likely in 5.x |
...to prevent ambiguity with Svelte directives closes #6823
closes #6823 --------- Co-authored-by: Ben McCann <[email protected]> Co-authored-by: Rich Harris <[email protected]>
There's a warning for these in v4 |
@benmccann is there a way to disable that specific warning? In svelte-native we use |
Could you open a new issue so we can track this more visibly? |
Describe the problem
Currently every directive we add is technically a breaking change, because someone could have already (for some reason) been using a prop/attribute called bubble:foo or whatever.
Describe the proposed solution
Pick a format for directives (probably what we already have now) and make it a compile-time error to have a prop that looks like a directive but doesn't match the names of any of them.
Alternatives considered
No
Importance
nice to have
The text was updated successfully, but these errors were encountered: