Skip to content

Omit HTML entities from vue/no-bare-strings-in-template #2730

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

Open
mrleblanc101 opened this issue Apr 1, 2025 · 1 comment
Open

Omit HTML entities from vue/no-bare-strings-in-template #2730

mrleblanc101 opened this issue Apr 1, 2025 · 1 comment

Comments

@mrleblanc101
Copy link

What rule do you want to change?
vue/no-bare-strings-in-template

Does this change cause the rule to produce more or fewer warnings?
Fewer

How will the change be implemented? (New option, new default behavior, etc.)?
New value for default option

Please provide some example code that this change will affect:

<span v-if="$slots.default" class="text-sm">
    <slot /><span class="ml-2 whitespace-nowrap"
        >&zwj;<UHelpTooltip v-if="help" :content="help" class="align-middle"
    /></span>
</span>

What does the rule currently do for this code?

Unexpected non-translated string used.

What will the rule do after it's changed?
No error reported

Additional context

@waynzh
Copy link
Member

waynzh commented Apr 3, 2025

There are some challenges for supporting a complete list of HTML entities. There are many HTML entities, and including all entities will make the allowlist very long.

IMO, the original intention of the rule design is to allow common punctuation marks and special characters, not for all. Maybe a more feasible approach could be to add only the HTML entities you actually use in your project to the allowlist option (will support regexp patterns).

If you frequently use various HTML entities, you may need to consider disabling this rule for specific code segments, or bypassing the check in other ways, like {{ '&zwj;' }}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants