Repository: yannickcr/eslint-plugin-react (js)

Issue:
False positive for react/jsx-pascal-case on namespaced components
In v5.2.0 I'm getting a false positive for the `react/jsx-pascal-case` rule when using namespaced components.

```jsx
<Modal show={showModal} onHide={this.closeModal}>
  <Modal.Header closeButton>
    <Modal.Title>Demo</Modal.Title>
  </Modal.Header>
</Modal>
```

It looks like it was introduced in cd5ef2b17257d10f5398c35d7fc73fdfb9a360f9.

Pull request:
[fix] - Fix jsx-pascal-case for JSXMemberExpressions.
Only test object (part before the `.`). Fixes #637

Patch:
diff --git a/lib/rules/jsx-pascal-case.js b/lib/rules/jsx-pascal-case.js
index 93bd952b..b7277fb9 100644
--- a/lib/rules/jsx-pascal-case.js
+++ b/lib/rules/jsx-pascal-case.js
@@ -29,9 +29,11 @@ module.exports = function(context) {
     JSXOpeningElement: function(node) {
       var name = elementType(node);
 
-      // Get namespace if the type is JSXNamespacedName.
+      // Get namespace if the type is JSXNamespacedName or JSXMemberExpression
       if (name.indexOf(':') > -1) {
         name = name.substring(0, name.indexOf(':'));
+      } else if (name.indexOf('.') > -1) {
+        name = name.substring(0, name.indexOf('.'));
       }
 
       var isPascalCase = PASCAL_CASE_REGEX.test(name);


Test patch:
diff --git a/tests/lib/rules/jsx-pascal-case.js b/tests/lib/rules/jsx-pascal-case.js
index 187c27a4..752b5f50 100644
--- a/tests/lib/rules/jsx-pascal-case.js
+++ b/tests/lib/rules/jsx-pascal-case.js
@@ -58,6 +58,12 @@ ruleTester.run('jsx-pascal-case', rule, {
     code: '<YMCA />',
     parserOptions: parserOptions,
     options: [{allowAllCaps: true}]
+  }, {
+    code: '<Modal.Header />',
+    parserOptions: parserOptions
+  }, {
+    code: '<Modal:Header />',
+    parserOptions: parserOptions
   }, {
     code: '<IGNORED />',
     parserOptions: parserOptions,