-
Notifications
You must be signed in to change notification settings - Fork 525
Replace html-escape with built-in function on Svelte package #2535
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
Replace html-escape with built-in function on Svelte package #2535
Conversation
Hmm, I'm confused why I fail in coding standards. I have run |
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.
I’m on board with this change 👍 The Svelte escape is a better fit for our attribute use case, since it escapes exactly what we need, avoids over-escaping, and seems to be bit more efficient.
@kresnasatya please make sure to pass the second true
argument so it escapes correctly for an HTML attribute.
Alright. I have added it. Please review @pedroborges . Thank you. |
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.
Looks good! Thanks, @kresnasatya.
I'll let @pascalbaljet have the final word on merging this 😉
@pascalbaljet I fixed the merge conflict but now these ES2020 checks for React and Vue are failing, I'm not sure what those are about. Any ideas? |
Ah yes, npmjs is giving 403/409/422 errors all day in CI, nothing to worry about it seems :) |
Can't we use |
@kresnasatya please give lodash-es escape a try and run the tests. From a little research I did it seems very similar to the escape utility from Svelte. |
I see the escape function from lodash-es pass the svelte test. How do you think @pedroborges? If it's okay then, I just need one more commit to remove the |
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.
Nice! Only thing left is removing escape.ts
.
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.
👍
Alright, all is good. Feel free to check again @pedroborges |
Thanks! |
The references come from: https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/escaping.js (Svelte 5) and https://github.com/sveltejs/svelte/blob/svelte-4/packages/svelte/src/shared/utils/escape.js (Svelte 4). By using the built-in function, we can reduce third-party dep on Svelte package.