diff --git a/lib/rules/jsx-pascal-case.js b/lib/rules/jsx-pascal-case.js index 268755c2e1..fb8ea45427 100644 --- a/lib/rules/jsx-pascal-case.js +++ b/lib/rules/jsx-pascal-case.js @@ -51,6 +51,7 @@ module.exports = { return { JSXOpeningElement(node) { let name = elementType(node); + if (name.length === 1) return undefined; // Get namespace if the type is JSXNamespacedName or JSXMemberExpression if (name.indexOf(':') > -1) { diff --git a/tests/lib/rules/jsx-pascal-case.js b/tests/lib/rules/jsx-pascal-case.js index 0a17cd4ef8..f0965730f2 100644 --- a/tests/lib/rules/jsx-pascal-case.js +++ b/tests/lib/rules/jsx-pascal-case.js @@ -59,6 +59,12 @@ ruleTester.run('jsx-pascal-case', rule, { }, { code: '', options: [{ignore: ['IGNORED']}] + }, { + code: '' + }, { + code: '<$ />' + }, { + code: '<_ />' }], invalid: [{ @@ -82,5 +88,8 @@ ruleTester.run('jsx-pascal-case', rule, { code: '<__ />', options: [{allowAllCaps: true}], errors: [{message: 'Imported JSX component __ must be in PascalCase or SCREAMING_SNAKE_CASE'}] + }, { + code: '<$a />', + errors: [{message: 'Imported JSX component $a must be in PascalCase'}] }] });