-
-
Notifications
You must be signed in to change notification settings - Fork 681
Fix: casing of unicode characters #694
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
Conversation
What i should do with this than? Remove support for utf-8 and add rule to ban non a-zA-Z characters instead? i feel like its base on preference, some ppl may want to use non ascii characters like #688 |
I think that:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Good work @armano2. Now we can also add rule to prevent usage of non-ascii characters
@mysticatea or @ota-meshi can you also take a look at the code here? I would appreciate second pair of eyes before merging it :) |
My opinion is not changed since #694 (comment). I meant that our utilities should behave as same as https://github.com/vuejs/vue/blob/dev/src/shared/util.js. That doesn't have special handling for non-ASCII characters. |
@mysticatea what should happen with non current implementation is removing them, const invalidChars = /[^a-zA-Z0-9:]+/g anyway new implementation is working better even without unicode characters i fixed also issue with |
4c49621
to
704150a
Compare
@armano2 Why does it remove those? |
no clue, it was copied from vue :) |
i will replace it with .replace(/[\-!#$%^&*()_+~`"'<>,./?\[\]{}\s\r\n\v\t]+/gu, ' ') |
and now it's ignoring unknown (non ascii) characters, and we will have to add new rule to warn about usage of non ascii characters. |
In that case, I think we should keep it as is. My concern is that static analysis gets different behavior to Vue.js compiler and overlooks errors. |
@mysticatea but in vue its used in different context https://github.com/vuejs/vue/blob/a7658e03a16dc507f0abeba41aee705f773727d0/src/core/util/options.js#L260 |
My question in #694 (comment) was "why remove?". But https://github.com/vuejs/vue/blob/a7658e03a16dc507f0abeba41aee705f773727d0/src/core/util/options.js#L260 is not removal. So I should ask again, why does it remove those? If the removal is different behavior to Vue.js compiler, we should not remove those characters. |
that's why i changed it now, we are removing now only invalid characters \-!#$%^&*()_+~`"'<>,./?\[\]{}\s\r\n\v\t those characters can't be used as attribute names and property names. |
Why does remove invalid characters? I think that we should handle invalid names as invalid names because this is an error checker. It should not hide errors. If Vue.js compiler removes the invalid characters, yes, we should follow that. But if not, we should follow that. |
we have to somehow determine when word ends, and those are characters on which we split text, vue compile is never removing invalid characters, it's going to be runtime error.. |
@mysticatea than should i change this to only check whitespaces? |
#688