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

jsx-pascal-case warns on valid casing when using non-English characters #1654

Closed
bjornreppen opened this issue Jan 23, 2018 · 7 comments · Fixed by #2557
Closed

jsx-pascal-case warns on valid casing when using non-English characters #1654

bjornreppen opened this issue Jan 23, 2018 · 7 comments · Fixed by #2557

Comments

@bjornreppen
Copy link

This rule only works when strictly using the 26 english characters hard coded in the regex.

const PASCAL_CASE_REGEX = /^([A-Z0-9]|[A-Z0-9]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]))$/;

In order to support all cased languages, how do you feel about modifying the casing check for example using a technique similar to this (to detect letters):

function isLetter(c) {
  return c.toLowerCase() != c.toUpperCase();
}
@ljharb
Copy link
Member

ljharb commented Jan 25, 2018

I'm not sure about that specific technique, but I'm very open to adding test cases that fail with the current method, and then fixing the implementation to pass those tests.

@bjornreppen
Copy link
Author

bjornreppen commented Jan 25, 2018

Example of failing test case:

{ code: '<Surströmming />' }

@cquezel
Copy link

cquezel commented Mar 19, 2018

I don't know the implementation details, but this might test a case not covered by the original proposed test.

{ code: '<Éurströmming />' }

@Lars-Andreas
Copy link

Any update on this? Our component "Flervalgsspørsmål" fails this rule.

@InExtremaRes
Copy link

Same here, a component called Año (year in spanish) fails.

@ljharb
Copy link
Member

ljharb commented Nov 20, 2019

No update, because nobody's sent a PR.

@Svish
Copy link
Contributor

Svish commented Jan 29, 2020

Added a PR (#2557) now to support Unicode characters 🙂👍

@ljharb ljharb closed this as completed in 598277e Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

6 participants