Skip to content

Commit 0fd3668

Browse files
committed
Merge pull request #508 from dthielman/pascal-edge-case
Fix jsx-pascal-case to support single letter component names (fixes #505)
2 parents 4c52dd2 + b980a7b commit 0fd3668

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/rules/jsx-pascal-case.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// Constants
1010
// ------------------------------------------------------------------------------
1111

12-
var PASCAL_CASE_REGEX = /^[A-Z0-9]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]*)*$/;
12+
var PASCAL_CASE_REGEX = /^([A-Z0-9]|[A-Z0-9]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]*)*)$/;
1313
var COMPAT_TAG_REGEX = /^[a-z]|\-/;
1414

1515
// ------------------------------------------------------------------------------

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

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ ruleTester.run('jsx-pascal-case', rule, {
5151
}, {
5252
code: '<T3stComp0nent />',
5353
parserOptions: parserOptions
54+
},
55+
{
56+
code: '<T />',
57+
parserOptions: parserOptions
5458
}],
5559

5660
invalid: [{

0 commit comments

Comments
 (0)