Skip to content

Commit 5fac02c

Browse files
mehmetljharb
mehmet
authored andcommitted
[Fix] jsx-pascal-case: false negative with namespacing
Fixes #1336.
1 parent d02bb9a commit 5fac02c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/rules/jsx-pascal-case.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const jsxUtil = require('../util/jsx');
1313
// Constants
1414
// ------------------------------------------------------------------------------
1515

16-
const PASCAL_CASE_REGEX = /^([A-Z0-9]|[A-Z0-9]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]*)*)$/;
16+
const PASCAL_CASE_REGEX = /^(.*[.])*([A-Z]|[A-Z]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]*)*)$/;
1717
const ALL_CAPS_TAG_REGEX = /^[A-Z0-9]+([A-Z0-9_]*[A-Z0-9]+)?$/;
1818

1919
// ------------------------------------------------------------------------------

tests/lib/rules/jsx-pascal-case.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ruleTester.run('jsx-pascal-case', rule, {
4545
}, {
4646
code: '<TestComponent1 />'
4747
}, {
48-
code: '<T3stComp0nent />'
48+
code: '<T3StComp0Nent />'
4949
}, {
5050
code: '<T />'
5151
}, {
@@ -59,6 +59,8 @@ ruleTester.run('jsx-pascal-case', rule, {
5959
options: [{allowAllCaps: true}]
6060
}, {
6161
code: '<Modal.Header />'
62+
}, {
63+
code: '<qualification.T3StComp0Nent />'
6264
}, {
6365
code: '<Modal:Header />'
6466
}, {

0 commit comments

Comments
 (0)