Open sadeghbarati opened 2 weeks ago
I really don't like to reassign class: className
🙅
But If I use only class
I'll get this error
@zernonia is this intended? should we ask it in
Sorry this is eslint error, but how to remove this eslint rule?
It has runtime error check next Stackblitz please (vue-ts starter template)Vue Language Tools
repo about this?
Is this a reason why we have something like className
? 😶🌫️
destructured class prop
without reassign it to className
or any other names@sadeghbarati I think one working approach will be { class: cl }
or something like this. This is not an ESLint error, this is a JavaScript (TS) preserved variable name:
How can we omit this issue:
Default error:
Reserved words documentation link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words
Yeah, you can't name your variable class, that's why className is used. Vue props have different scope so you can name it class in there.
I usually name it cls or _class or something like that, className is too long and too reacty for me, but anyway you need to name it somehow, if you use such approach, because class is reserved word in JS.
I support the proposed change, but it is important to note that this is a breaking change. Anyone using Vue versions earlier than 3.5 without enabling the experimental flag may encounter unexpected errors.
In my experience, there may not be an explicit error message, but the reactivity will fail to function properly, making it difficult to debug.
If this is to be implemented, we would need to properly communicate the required migration steps.
Like @Saeid-Za said, this is a breaking change and imo most people would rather appreciate bug fixes and more mirroring with the official shadcn (new charts)
Describe the feature
Additional information