Skip to content

Commit b980a7b

Browse files
author
Daniel Thielman
committed
Fixes an Edge Case in jsx-pascal-case
Single letter tag names are techincally PascalCase, and should be supported.
1 parent e3c27f9 commit b980a7b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/rules/jsx-pascal-case.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 0 deletions
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)