From b14d73c97be5f101ba5e0934a12952b1ee2dbd20 Mon Sep 17 00:00:00 2001 From: mehmet Date: Mon, 31 Jul 2017 15:04:35 +0300 Subject: [PATCH] case #1334 - false negative with namespacing/qualifications using jsx-pascal case #1336 - false postive with names starting with a number using jsx-pascal [Can besaid it is fixed, but inside it is not accepted anyway. Seems just fixed the regex] --- lib/rules/jsx-pascal-case.js | 2 +- tests/lib/rules/jsx-pascal-case.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rules/jsx-pascal-case.js b/lib/rules/jsx-pascal-case.js index 25589be96b..6425494b40 100644 --- a/lib/rules/jsx-pascal-case.js +++ b/lib/rules/jsx-pascal-case.js @@ -11,7 +11,7 @@ const elementType = require('jsx-ast-utils/elementType'); // Constants // ------------------------------------------------------------------------------ -const PASCAL_CASE_REGEX = /^([A-Z0-9]|[A-Z0-9]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]*)*)$/; +const PASCAL_CASE_REGEX = /^(.*[.])*([A-Z]|[A-Z]+[a-z0-9]+(?:[A-Z0-9]+[a-z0-9]*)*)$/; const COMPAT_TAG_REGEX = /^[a-z]|\-/; const ALL_CAPS_TAG_REGEX = /^[A-Z0-9]+$/; diff --git a/tests/lib/rules/jsx-pascal-case.js b/tests/lib/rules/jsx-pascal-case.js index 06a7b93f80..71f094e676 100644 --- a/tests/lib/rules/jsx-pascal-case.js +++ b/tests/lib/rules/jsx-pascal-case.js @@ -51,6 +51,8 @@ ruleTester.run('jsx-pascal-case', rule, { options: [{allowAllCaps: true}] }, { code: '' + }, { + code: '' }, { code: '' }, {