Repository: nzakas/eslint-plugin-typescript
Pull request #98 (2017-12-01 01:54:57)

Fix class-name-casing cannot recognize PascalCase containing digits
When `class-name-casing` is enabled, `class Foo2 {}` will be reported as invalid.


Patch:
diff --git a/lib/rules/adjacent-overload-signatures.js b/lib/rules/adjacent-overload-signatures.js
index 221765a..3627693 100644
--- a/lib/rules/adjacent-overload-signatures.js
+++ b/lib/rules/adjacent-overload-signatures.js
@@ -88,9 +88,7 @@ module.exports = {
                     if (index > -1 && lastName !== name) {
                         context.report({
                             node: member,
-                            message: `All '${
-                                name
-                            }' signatures should be adjacent`
+                            message: `All '${name}' signatures should be adjacent`
                         });
                     } else if (name && index === -1) {
                         seen.push(name);
diff --git a/lib/rules/class-name-casing.js b/lib/rules/class-name-casing.js
index c230701..0c26e3c 100644
--- a/lib/rules/class-name-casing.js
+++ b/lib/rules/class-name-casing.js
@@ -33,9 +33,7 @@ module.exports = {
          * @returns {boolean}      Is the name PascalCased?
          */
         function isPascalCase(name) {
-            return (
-                name[0].toUpperCase() === name[0] && /^[A-Za-z]+$/.test(name)
-            );
+            return /^[A-Z][0-9A-Za-z]*$/.test(name);
         }
 
         /**
diff --git a/lib/rules/no-explicit-any.js b/lib/rules/no-explicit-any.js
index b7c36ab..5db9211 100644
--- a/lib/rules/no-explicit-any.js
+++ b/lib/rules/no-explicit-any.js
@@ -91,7 +91,7 @@ module.exports = {
                     );
                 }
             },
-            TypeAnnotation(node) {
+            TSTypeAnnotation(node) {
                 if (node.typeAnnotation) {
                     checkGenericNodeForAnnotation(node.typeAnnotation);
                 }
diff --git a/lib/rules/no-unused-vars.js b/lib/rules/no-unused-vars.js
index f5b077f..4bd75df 100644
--- a/lib/rules/no-unused-vars.js
+++ b/lib/rules/no-unused-vars.js
@@ -261,7 +261,7 @@ module.exports = {
                 }
             },
 
-            TypeAnnotation(node) {
+            TSTypeAnnotation(node) {
                 if (node.typeAnnotation) {
                     markTypeAnnotationAsUsed(node.typeAnnotation);
                 }
diff --git a/lib/rules/type-annotation-spacing.js b/lib/rules/type-annotation-spacing.js
index 8a8aeb2..77d4b30 100644
--- a/lib/rules/type-annotation-spacing.js
+++ b/lib/rules/type-annotation-spacing.js
@@ -71,7 +71,7 @@ module.exports = {
         /**
          * Checks if there's proper spacing around type annotations (no space
          * before colon, one space after).
-         * @param {ASTNode} typeAnnotation The TypeAnnotation node.
+         * @param {ASTNode} typeAnnotation The TSTypeAnnotation node.
          * @returns {void}
          * @private
          */
@@ -163,7 +163,7 @@ module.exports = {
                     );
                 }
             },
-            TypeAnnotation(node) {
+            TSTypeAnnotation(node) {
                 checkTypeAnnotationSpacing(node.typeAnnotation);
             },
             FunctionDeclaration: checkFunctionReturnTypeSpacing,
diff --git a/package.json b/package.json
index a0ae107..acc45cd 100644
--- a/package.json
+++ b/package.json
@@ -23,18 +23,18 @@
     "requireindex": "~1.1.0"
   },
   "devDependencies": {
-    "eslint": "^4.6.1",
+    "eslint": "^4.13.1",
     "eslint-config-eslint": "^4.0.0",
-    "eslint-config-prettier": "^2.4.0",
+    "eslint-config-prettier": "^2.9.0",
     "eslint-docs": "^0.1.1",
     "eslint-plugin-node": "^5.1.1",
     "eslint-plugin-prettier": "^2.2.0",
     "husky": "^0.14.3",
-    "lint-staged": "^4.1.3",
-    "mocha": "^3.5.3",
-    "prettier": "1.8.2",
-    "typescript": "~2.5.1",
-    "typescript-eslint-parser": "^8.0.0"
+    "lint-staged": "^6.0.0",
+    "mocha": "^4.0.1",
+    "prettier": "1.9.1",
+    "typescript": "~2.6.1",
+    "typescript-eslint-parser": "^10.0.0"
   },
   "lint-staged": {
     "*.js": [


Test patch:
diff --git a/tests/lib/rules/class-name-casing.js b/tests/lib/rules/class-name-casing.js
index f68d23c..ff9bf55 100644
--- a/tests/lib/rules/class-name-casing.js
+++ b/tests/lib/rules/class-name-casing.js
@@ -29,7 +29,8 @@ ruleTester.run("class-name-casing", rule, {
             }
         },
         "var Foo = class {};",
-        "interface SomeInterface {}"
+        "interface SomeInterface {}",
+        "class ClassNameWithDigit2 {}"
     ],
 
     invalid: [