Repository: nzakas/eslint-plugin-typescript
Pull request #122 (2018-03-23 09:39:07)

Added fixer for member-delimiter-style

mightyiam: Valuable contributions, @bradzacher. Keep it up!

Patch:
diff --git a/README.md b/README.md
index ccc1723..c64b194 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,7 @@ Then configure the rules you want to use under the rules section.
 * [`typescript/no-type-alias`](./docs/rules/no-type-alias.md) — Disallow the use of type aliases (`interface-over-type-literal` from TSLint)
 * [`typescript/no-unused-vars`](./docs/rules/no-unused-vars.md) — Prevent TypeScript-specific constructs from being erroneously flagged as unused
 * [`typescript/no-use-before-define`](./docs/rules/no-use-before-define.md) — Disallow the use of variables before they are defined
+* [`typescript/no-var-requires`](./docs/rules/no-var-requires.md) — Disallows the use of require statements except in import statements (`no-var-requires` from TSLint)
 * [`typescript/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) — Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules. (`no-internal-module` from TSLint)
 * [`typescript/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) — Require consistent spacing around type annotations
 <!-- end rule list -->
diff --git a/docs/rules/no-var-requires.md b/docs/rules/no-var-requires.md
new file mode 100644
index 0000000..d376176
--- /dev/null
+++ b/docs/rules/no-var-requires.md
@@ -0,0 +1,28 @@
+# Disallows the use of require statements except in import statements (no-var-requires)
+
+In other words, the use of forms such as `var foo = require("foo")` are banned. Instead use ES6 style imports or `import foo = require("foo")` imports.
+
+## Rule Details
+
+Examples of **incorrect** code for this rule:
+
+```ts
+var foo = require("foo");
+const foo = require("foo");
+let foo = require("foo");
+```
+
+Examples of **correct** code for this rule:
+
+```ts
+import foo = require("foo");
+require("foo");
+```
+
+## When Not To Use It
+
+If you don't care about TypeScript module syntax, then you will not need this rule.
+
+## Compatibility
+
+* TSLint: [no-var-requires](https://palantir.github.io/tslint/rules/no-var-requires/)
diff --git a/lib/rules/member-delimiter-style.js b/lib/rules/member-delimiter-style.js
index 854f99f..8e2eb10 100644
--- a/lib/rules/member-delimiter-style.js
+++ b/lib/rules/member-delimiter-style.js
@@ -90,6 +90,7 @@ module.exports = {
          */
         function checkLastToken(member, opts, isLast, isSameLine) {
             let message;
+            let missingDelimiter = false;
             const lastToken = sourceCode.getLastToken(member, {
                 includeComments: false
             });
@@ -118,6 +119,7 @@ module.exports = {
                 }
 
                 if (!canOmit) {
+                    missingDelimiter = true;
                     message =
                         opts.delimiter === "semi"
                             ? "Expected a semicolon."
@@ -138,7 +140,29 @@ module.exports = {
                             column: lastToken.loc.end.column
                         }
                     },
-                    message
+                    message,
+                    fix(fixer) {
+                        let token;
+
+                        if (opts.delimiter === "semi") {
+                            token = ";";
+                        } else if (opts.delimiter === "comma") {
+                            token = ",";
+                        } else {
+                            // remove the unneeded token
+                            return fixer.remove(lastToken);
+                        }
+
+                        if (missingDelimiter) {
+                            // add the missing delimiter
+                            return fixer.insertTextAfter(lastToken, token);
+                        } else if (isLast && !opts.requireLast) {
+                            return fixer.remove(lastToken);
+                        }
+
+                        // correct the current delimiter
+                        return fixer.replaceText(lastToken, token);
+                    }
                 });
             }
         }
diff --git a/lib/rules/member-ordering.js b/lib/rules/member-ordering.js
index 0785e5b..28e0513 100644
--- a/lib/rules/member-ordering.js
+++ b/lib/rules/member-ordering.js
@@ -172,23 +172,9 @@ module.exports = {
          */
         function shouldBeProcessedAsMethod(node) {
             // check for bound methods in ClassProperty nodes.
-            if (
-                node.value &&
-                functionExpressions.indexOf(node.value.type) > -1
-            ) {
-                return true;
-            }
-
-            // check for bound methods in TSPropertySignature nodes.
-            if (
-                node.typeAnnotation &&
-                node.typeAnnotation.typeAnnotation &&
-                node.typeAnnotation.typeAnnotation.type === "TSFunctionType"
-            ) {
-                return true;
-            }
-
-            return false;
+            return (
+                node.value && functionExpressions.indexOf(node.value.type) > -1
+            );
         }
 
         /**
diff --git a/lib/rules/no-var-requires.js b/lib/rules/no-var-requires.js
new file mode 100644
index 0000000..d4e6592
--- /dev/null
+++ b/lib/rules/no-var-requires.js
@@ -0,0 +1,45 @@
+/**
+ * @fileoverview Disallows the use of require statements except in import statements.
+ * @author Macklin Underdown
+ */
+"use strict";
+
+const util = require("../util");
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = {
+    meta: {
+        docs: {
+            description:
+                "Disallows the use of require statements except in import statements",
+            extraDescription: [util.tslintRule("no-var-requires")],
+            category: "TypeScript",
+            url:
+                "https://github.com/nzakas/eslint-plugin-typescript/blob/master/docs/rules/no-var-requires.md"
+        },
+        schema: []
+    },
+    create(context) {
+        //----------------------------------------------------------------------
+        // Public
+        //----------------------------------------------------------------------
+
+        return {
+            CallExpression(node) {
+                if (
+                    node.callee.name === "require" &&
+                    node.parent.type === "VariableDeclarator"
+                ) {
+                    context.report({
+                        node,
+                        message:
+                            "Require statement not part of import statement"
+                    });
+                }
+            }
+        };
+    }
+};
diff --git a/package.json b/package.json
index 7fcb0e3..dd8c3c3 100644
--- a/package.json
+++ b/package.json
@@ -27,12 +27,12 @@
     "eslint-config-eslint": "^4.0.0",
     "eslint-config-prettier": "^2.9.0",
     "eslint-docs": "^0.1.1",
-    "eslint-plugin-node": "^5.1.1",
+    "eslint-plugin-node": "^6.0.1",
     "eslint-plugin-prettier": "^2.2.0",
     "husky": "^0.14.3",
     "lint-staged": "^6.0.0",
     "mocha": "^4.0.1",
-    "prettier": "1.9.1",
+    "prettier": "^1.11.1",
     "typescript": "~2.6.1",
     "typescript-eslint-parser": "^10.0.0"
   },


Test patch:
diff --git a/tests/lib/rules/member-delimiter-style.js b/tests/lib/rules/member-delimiter-style.js
index 4fa2ef1..9463d52 100644
--- a/tests/lib/rules/member-delimiter-style.js
+++ b/tests/lib/rules/member-delimiter-style.js
@@ -723,6 +723,12 @@ type Bar = {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string;
+    age: number;
 }
             `,
             errors: [
@@ -743,6 +749,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string;
+    age: number;
 }
             `,
             options: [{ delimiter: "semi" }],
@@ -764,6 +776,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string;
+    age: number;
 }
             `,
             options: [{ delimiter: "semi", requireLast: true }],
@@ -782,9 +800,37 @@ interface Foo {
         },
         {
             code: `
+interface Foo {
+    name: string
+    age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string;
+    age: number
+}
+            `,
+            options: [{ delimiter: "semi", requireLast: false }],
+            errors: [
+                {
+                    message: "Expected a semicolon.",
+                    line: 3,
+                    column: 17
+                }
+            ]
+        },
+        {
+            code: `
 interface Foo {
     name: string;
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string;
+    age: number;
 }
             `,
             options: [{ delimiter: "semi", requireLast: true }],
@@ -801,6 +847,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
 }
             `,
             options: [{ delimiter: "comma" }],
@@ -822,6 +874,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
 }
             `,
             options: [{ delimiter: "comma", requireLast: true }],
@@ -843,6 +901,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number
 }
             `,
             options: [{ delimiter: "comma", requireLast: false }],
@@ -859,6 +923,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
 }
             `,
             options: [{ delimiter: "comma" }],
@@ -880,6 +950,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
 }
             `,
             options: [{ delimiter: "comma", requireLast: true }],
@@ -901,6 +977,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number
 }
             `,
             options: [{ delimiter: "comma", requireLast: false }],
@@ -917,6 +999,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number
 }
             `,
             options: [{ delimiter: "comma", requireLast: false }],
@@ -938,6 +1026,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none" }],
@@ -959,6 +1053,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: true }],
@@ -980,6 +1080,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: false }],
@@ -996,6 +1102,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: false }],
@@ -1012,6 +1124,12 @@ interface Foo {
 interface Foo {
     name: string,
     age: number,
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none" }],
@@ -1033,6 +1151,12 @@ interface Foo {
 interface Foo {
     name: string,
     age: number,
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: true }],
@@ -1054,6 +1178,12 @@ interface Foo {
 interface Foo {
     name: string,
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: false }],
@@ -1070,6 +1200,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number,
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: false }],
@@ -1086,6 +1222,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string;
+    age: number;
 }
             `,
             options: [
@@ -1112,6 +1254,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string;
+    age: number;
 }
             `,
             options: [
@@ -1141,6 +1289,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string;
+    age: number;
 }
             `,
             options: [
@@ -1165,6 +1319,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
 }
             `,
             options: [
@@ -1191,6 +1351,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
 }
             `,
             options: [
@@ -1220,6 +1386,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number
 }
             `,
             options: [
@@ -1244,6 +1416,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
 }
             `,
             options: [
@@ -1270,6 +1448,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
 }
             `,
             options: [
@@ -1299,6 +1483,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number
 }
             `,
             options: [
@@ -1323,6 +1513,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number
 }
             `,
             options: [
@@ -1352,6 +1548,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -1378,6 +1580,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -1407,6 +1615,12 @@ interface Foo {
 interface Foo {
     name: string;
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -1431,6 +1645,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number;
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -1455,6 +1675,12 @@ interface Foo {
 interface Foo {
     name: string,
     age: number,
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -1481,6 +1707,12 @@ interface Foo {
 interface Foo {
     name: string,
     age: number,
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -1510,6 +1742,12 @@ interface Foo {
 interface Foo {
     name: string,
     age: number
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -1534,6 +1772,12 @@ interface Foo {
 interface Foo {
     name: string
     age: number,
+}
+            `,
+            output: `
+interface Foo {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -1558,6 +1802,12 @@ interface Foo {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string;
+    age: number;
 }
             `,
             errors: [
@@ -1578,6 +1828,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string;
+    age: number;
 }
             `,
             options: [{ delimiter: "semi" }],
@@ -1599,6 +1855,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string;
+    age: number;
 }
             `,
             options: [{ delimiter: "semi", requireLast: true }],
@@ -1620,6 +1882,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string;
+    age: number;
 }
             `,
             options: [{ delimiter: "semi", requireLast: true }],
@@ -1636,6 +1904,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number,
 }
             `,
             options: [{ delimiter: "comma" }],
@@ -1657,6 +1931,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number,
 }
             `,
             options: [{ delimiter: "comma", requireLast: true }],
@@ -1678,6 +1958,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number
 }
             `,
             options: [{ delimiter: "comma", requireLast: false }],
@@ -1694,6 +1980,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number,
 }
             `,
             options: [{ delimiter: "comma" }],
@@ -1715,6 +2007,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number,
 }
             `,
             options: [{ delimiter: "comma", requireLast: true }],
@@ -1736,6 +2034,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number
 }
             `,
             options: [{ delimiter: "comma", requireLast: false }],
@@ -1752,6 +2056,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number
 }
             `,
             options: [{ delimiter: "comma", requireLast: false }],
@@ -1773,6 +2083,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none" }],
@@ -1794,6 +2110,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: true }],
@@ -1815,6 +2137,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: false }],
@@ -1831,6 +2159,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: false }],
@@ -1847,6 +2181,12 @@ type Foo = {
 type Foo = {
     name: string,
     age: number,
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none" }],
@@ -1868,6 +2208,12 @@ type Foo = {
 type Foo = {
     name: string,
     age: number,
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: true }],
@@ -1889,6 +2235,12 @@ type Foo = {
 type Foo = {
     name: string,
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: false }],
@@ -1905,6 +2257,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number,
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [{ delimiter: "none", requireLast: false }],
@@ -1921,6 +2279,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string;
+    age: number;
 }
             `,
             options: [
@@ -1947,6 +2311,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string;
+    age: number;
 }
             `,
             options: [
@@ -1976,6 +2346,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string;
+    age: number;
 }
             `,
             options: [
@@ -2000,6 +2376,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number,
 }
             `,
             options: [
@@ -2026,6 +2408,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number,
 }
             `,
             options: [
@@ -2055,6 +2443,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number
 }
             `,
             options: [
@@ -2079,6 +2473,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number,
 }
             `,
             options: [
@@ -2105,6 +2505,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number,
 }
             `,
             options: [
@@ -2134,6 +2540,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number
 }
             `,
             options: [
@@ -2158,6 +2570,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string,
+    age: number
 }
             `,
             options: [
@@ -2187,6 +2605,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -2213,6 +2637,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -2242,6 +2672,12 @@ type Foo = {
 type Foo = {
     name: string;
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -2266,6 +2702,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number;
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -2290,6 +2732,12 @@ type Foo = {
 type Foo = {
     name: string,
     age: number,
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -2316,6 +2764,12 @@ type Foo = {
 type Foo = {
     name: string,
     age: number,
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -2345,6 +2799,12 @@ type Foo = {
 type Foo = {
     name: string,
     age: number
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -2369,6 +2829,12 @@ type Foo = {
 type Foo = {
     name: string
     age: number,
+}
+            `,
+            output: `
+type Foo = {
+    name: string
+    age: number
 }
             `,
             options: [
@@ -2398,6 +2864,17 @@ interface Foo {
 type Bar = {
     name: string,
     age: number,
+}
+            `,
+            output: `
+interface Foo {
+    name: string,
+    age: number,
+}
+
+type Bar = {
+    name: string;
+    age: number;
 }
             `,
             options: [
@@ -2437,6 +2914,11 @@ type Bar = {
             code: `
 interface Foo {
     [key: string]: any
+}
+            `,
+            output: `
+interface Foo {
+    [key: string]: any;
 }
             `,
             errors: [
@@ -2451,6 +2933,11 @@ interface Foo {
             code: `
 interface Foo {
     [key: string]: any
+}
+            `,
+            output: `
+interface Foo {
+    [key: string]: any;
 }
             `,
             options: [{ ignoreSingleLine: true }],
@@ -2464,6 +2951,7 @@ interface Foo {
         },
         {
             code: "interface Foo { [key: string]: any }",
+            output: "interface Foo { [key: string]: any; }",
             options: [{ ignoreSingleLine: false }],
             errors: [
                 {
@@ -2475,6 +2963,7 @@ interface Foo {
         },
         {
             code: "interface Foo { [key: string]: any }",
+            output: "interface Foo { [key: string]: any; }",
             options: [
                 {
                     requireLast: true,
@@ -2491,6 +2980,7 @@ interface Foo {
         },
         {
             code: "interface Foo { [key: string]: any }",
+            output: "interface Foo { [key: string]: any; }",
             options: [
                 {
                     requireLast: true,
@@ -2512,6 +3002,11 @@ interface Foo {
             code: `
 type Foo = {
     [key: string]: any
+}
+            `,
+            output: `
+type Foo = {
+    [key: string]: any;
 }
             `,
             errors: [
@@ -2526,6 +3021,11 @@ type Foo = {
             code: `
 type Foo = {
     [key: string]: any
+}
+            `,
+            output: `
+type Foo = {
+    [key: string]: any;
 }
             `,
             options: [{ ignoreSingleLine: true }],
@@ -2539,6 +3039,7 @@ type Foo = {
         },
         {
             code: "type Foo = { [key: string]: any }",
+            output: "type Foo = { [key: string]: any; }",
             options: [{ ignoreSingleLine: false }],
             errors: [
                 {
@@ -2550,6 +3051,7 @@ type Foo = {
         },
         {
             code: "type Foo = { [key: string]: any }",
+            output: "type Foo = { [key: string]: any; }",
             options: [
                 {
                     requireLast: true,
@@ -2566,6 +3068,7 @@ type Foo = {
         },
         {
             code: "type Foo = { [key: string]: any }",
+            output: "type Foo = { [key: string]: any; }",
             options: [
                 {
                     requireLast: true,
diff --git a/tests/lib/rules/member-ordering.js b/tests/lib/rules/member-ordering.js
index ea23bcc..1fee670 100644
--- a/tests/lib/rules/member-ordering.js
+++ b/tests/lib/rules/member-ordering.js
@@ -540,6 +540,21 @@ class Foo {
         },
         {
             code: `
+class Foo {
+    private required: boolean;
+    private typeChecker: (data: any) => boolean;
+    constructor(validator: (data: any) => boolean) {
+        this.typeChecker = validator;
+    }
+    check(data: any): boolean {
+        return this.typeChecker(data);
+    }
+}
+            `,
+            options: [{ classes: ["field", "constructor", "method"] }]
+        },
+        {
+            code: `
 class Foo {
     public static G() {}
     protected static H() {}
@@ -1184,9 +1199,9 @@ class Foo {
 class Foo {
     J() {}
     K = () => {}
-    L: () => {}
     constructor () {}
     A: string;
+    L: () => {}
 }
             `,
             options: [{ default: ["method", "constructor", "field"] }]
@@ -1194,8 +1209,8 @@ class Foo {
         `
 interface Foo {
     A: string;
+    K: () => {};
     J();
-    K: () => {}
 }
         `,
         {
@@ -1211,8 +1226,8 @@ interface Foo {
         `
 type Foo = {
     A: string;
-    J();
     K: () => {}
+    J();
 }
         `,
         {
@@ -2903,12 +2918,6 @@ class Foo {
                         "Member K should be declared before all constructor definitions.",
                     line: 5,
                     column: 5
-                },
-                {
-                    message:
-                        "Member L should be declared before all constructor definitions.",
-                    line: 6,
-                    column: 5
                 }
             ]
         },
@@ -2916,32 +2925,14 @@ class Foo {
             code: `
 interface Foo {
     K: () => {}
-    A: string;
-    J();
-}
-            `,
-            errors: [
-                {
-                    message:
-                        "Member A should be declared before all method definitions.",
-                    line: 4,
-                    column: 5
-                }
-            ]
-        },
-        {
-            code: `
-interface Foo {
     J();
     A: string;
-    K: () => {}
 }
             `,
-            options: [{ default: ["method", "constructor", "field"] }],
             errors: [
                 {
                     message:
-                        "Member K should be declared before all field definitions.",
+                        "Member A should be declared before all method definitions.",
                     line: 5,
                     column: 5
                 }
@@ -2951,15 +2942,15 @@ interface Foo {
             code: `
 type Foo = {
     K: () => {}
-    A: string;
     J();
+    A: string;
 }
             `,
             errors: [
                 {
                     message:
                         "Member A should be declared before all method definitions.",
-                    line: 4,
+                    line: 5,
                     column: 5
                 }
             ]
@@ -2967,16 +2958,16 @@ type Foo = {
         {
             code: `
 type Foo = {
-    J();
     A: string;
     K: () => {}
+    J();
 }
             `,
             options: [{ default: ["method", "constructor", "field"] }],
             errors: [
                 {
                     message:
-                        "Member K should be declared before all field definitions.",
+                        "Member J should be declared before all field definitions.",
                     line: 5,
                     column: 5
                 }
diff --git a/tests/lib/rules/no-var-requires.js b/tests/lib/rules/no-var-requires.js
new file mode 100644
index 0000000..4715cb9
--- /dev/null
+++ b/tests/lib/rules/no-var-requires.js
@@ -0,0 +1,56 @@
+/**
+ * @fileoverview Disallows the use of require statements except in import statements.
+ * @author Macklin Underdown
+ */
+"use strict";
+
+//------------------------------------------------------------------------------
+// Requirements
+//------------------------------------------------------------------------------
+
+const rule = require("../../../lib/rules/no-var-requires"),
+    RuleTester = require("eslint").RuleTester;
+
+//------------------------------------------------------------------------------
+// Tests
+//------------------------------------------------------------------------------
+
+const ruleTester = new RuleTester({
+    parser: "typescript-eslint-parser"
+});
+
+ruleTester.run("no-var-requires", rule, {
+    valid: ["import foo = require('foo')", "require('foo')"],
+    invalid: [
+        {
+            code: "var foo = require('foo')",
+            errors: [
+                {
+                    message: "Require statement not part of import statement",
+                    line: 1,
+                    column: 11
+                }
+            ]
+        },
+        {
+            code: "const foo = require('foo')",
+            errors: [
+                {
+                    message: "Require statement not part of import statement",
+                    line: 1,
+                    column: 13
+                }
+            ]
+        },
+        {
+            code: "let foo = require('foo')",
+            errors: [
+                {
+                    message: "Require statement not part of import statement",
+                    line: 1,
+                    column: 11
+                }
+            ]
+        }
+    ]
+});