Eslint-plugin-react: jsx-pascal-case warns on valid casing when using non-English characters

Created on 23 Jan 2018  路  7Comments  路  Source: yannickcr/eslint-plugin-react

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();
}
bug help wanted

Most helpful comment

Added a PR (#2557) now to support Unicode characters 馃檪馃憤

All 7 comments

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.

Example of failing test case:

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

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

{ code: '<脡urstr枚mming />' }

Any update on this? Our component "Flervalgssp酶rsm氓l" fails this rule.

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

No update, because nobody's sent a PR.

Added a PR (#2557) now to support Unicode characters 馃檪馃憤

Was this page helpful?
0 / 5 - 0 ratings