Skip to content
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

Can't ignore "–" #93

Closed
3raser95 opened this issue Feb 28, 2023 · 3 comments
Closed

Can't ignore "–" #93

3raser95 opened this issue Feb 28, 2023 · 3 comments

Comments

@3raser95
Copy link

3raser95 commented Feb 28, 2023

I've been trying to ignore the string – but the rule doesn't seem to be working for it. I've used this rule:
"i18next/no-literal-string": [ 2, { "words": { exclude: ["–", "Option"] } } ]

With this rule the Option gets ignored fine inside a span element, but – inside span doesn't get ignored. As far as I know the & and ; don't have a special meaning in regex so it should work as is. Is this a bug or am I doing something wrong?

@3raser95
Copy link
Author

3raser95 commented Mar 8, 2023

Found out that I need to exclude "\u2013" even though in my files they are written like – which is quite confusing and I still think it should be fixed.

@edvardchen
Copy link
Owner

I understand your concern. It will be nice that we can ignore those unicode characters that are not in natural languages. But I don't know if there is a general way to recognize them.

In new version v6.0.0-7 the exclude option can accept regex as params now only if your eslint configuration is written in javascript. You can experiment with regex to see if it's possible. And welcome PR any time

@edvardchen
Copy link
Owner

edvardchen commented May 30, 2023

It turned out that Babel JSX compiler converts HTML entities into the unicode characters they represent

Babel already maintained a complete list of html entities so that we can just copy them over here

I will fix it in #108

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