Svelte: Svelte should throw a compile time error when illegal characters are used in computed names

Created on 8 Jan 2018  Â·  3Comments  Â·  Source: sveltejs/svelte

Computed values are transformed into functions so random-api becomes random-api(){} which is not allowed.

        computed:{
            "random-api":(pw_min,pw_max,passwords)=>{
                return `apiurlsomethingsomething`
            }
        }

The compiler should suggest an alternative like random_api, which is admittedly uglier :woman_shrugging:, but completely valid, and not svelte's fault _obvi_

enhancement bug

Most helpful comment

@arxpoetica, @Rich-Harris threw this issue my way on gitter this morning.
I understand the high-level problem and will muddle through the code to figure out how to go about implementing a fix.

All 3 comments

@arxpoetica, @Rich-Harris threw this issue my way on gitter this morning.
I understand the high-level problem and will muddle through the code to figure out how to go about implementing a fix.

Submitted #1099
I'm open to all questions and suggestions.

Fix released in 1.52 — thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rich-Harris picture Rich-Harris  Â·  3Comments

robnagler picture robnagler  Â·  3Comments

clitetailor picture clitetailor  Â·  3Comments

Rich-Harris picture Rich-Harris  Â·  3Comments

AntoninBeaufort picture AntoninBeaufort  Â·  3Comments