Repository: typescript-eslint/tslint-to-eslint-config (ts)

Issue:
Missing converter: newline-before-return
### 💥 Missing Converter

-   `tslint-to-eslint-config` version: 1.2.0
-   `typescript-eslint` version: 2.3.2

#### TSLint Rule Name

`newline-before-return`


Pull request description:
Add missing converter: newline-before-return
To #164

## PR Checklist

-   [x] Addresses an existing issue: fixes #164 
-   [x] That issue was marked as [`status: accepting prs`](https://github.com/typescript-eslint/tslint-to-eslint-config/labels/status%3A%20accepting%20prs)

## Overview

Add converter for `newline-before-return` with suggested configuration for new `padding-line-between-statements` rule

Patch:
diff --git a/src/rules/converters.ts b/src/rules/converters.ts
index 96a0365..cbb800c 100644
--- a/src/rules/converters.ts
+++ b/src/rules/converters.ts
@@ -25,6 +25,7 @@ import { convertMaxClassesPerFile } from "./converters/max-classes-per-file";
 import { convertMaxFileLineCount } from "./converters/max-file-line-count";
 import { convertMaxLineLength } from "./converters/max-line-length";
 import { convertMemberOrdering } from "./converters/member-ordering";
+import { convertNewlineBeforeReturn } from "./converters/newline-before-return";
 import { convertNewlinePerChainedCall } from "./converters/newline-per-chained-call";
 import { convertNewParens } from "./converters/new-parens";
 import { convertNoAngleBracketTypeAssertion } from "./converters/no-angle-bracket-type-assertion";
@@ -38,6 +39,7 @@ import { convertNoConstantCondition } from "./converters/no-constant-condition";
 import { convertNoConstruct } from "./converters/no-construct";
 import { convertNoControlRegex } from "./converters/no-control-regex";
 import { convertNoDebugger } from "./converters/no-debugger";
+import { convertNoDuplicateImports } from "./converters/no-duplicate-imports";
 import { convertNoDuplicateSuper } from "./converters/no-duplicate-super";
 import { convertNoDuplicateSwitchCase } from "./converters/no-duplicate-switch-case";
 import { convertNoEmpty } from "./converters/no-empty";
@@ -132,6 +134,7 @@ export const converters = new Map([
     ["member-access", convertMemberAccess],
     ["member-ordering", convertMemberOrdering],
     ["new-parens", convertNewParens],
+    ["newline-before-return", convertNewlineBeforeReturn],
     ["newline-per-chained-call", convertNewlinePerChainedCall],
     ["no-angle-bracket-type-assertion", convertNoAngleBracketTypeAssertion],
     ["no-any", convertNoExplicitAny],
@@ -140,6 +143,7 @@ export const converters = new Map([
     ["no-conditional-assignment", convertNoConditionalAssignment],
     ["no-construct", convertNoConstruct],
     ["no-debugger", convertNoDebugger],
+    ["no-duplicate-imports", convertNoDuplicateImports],
     ["no-duplicate-super", convertNoDuplicateSuper],
     ["no-duplicate-switch-case", convertNoDuplicateSwitchCase],
     ["no-empty-interface", convertNoEmptyInterface],
@@ -230,7 +234,6 @@ export const converters = new Map([
     // TSLint core rules:
     // ["ban", convertBan], // no-restricted-properties
     // ["import-blacklist", convertImportBlacklist], // no-restricted-imports
-    // ["newline-before-return", convertNewlineBeforeReturn],
     // ["no-duplicate-variable", convertNoDuplicateVariable], // no-redeclare
     // ["no-shadowed-variable", convertNoShadowedVariable], // no-shadow
     // ["no-trailing-whitespace", convertNoTrailingWhitespace], //  no-trailing-spaces
diff --git a/src/rules/converters/max-line-length.ts b/src/rules/converters/max-line-length.ts
index 24ad4b1..c502adf 100644
--- a/src/rules/converters/max-line-length.ts
+++ b/src/rules/converters/max-line-length.ts
@@ -12,22 +12,22 @@ export const convertMaxLineLength: RuleConverter = tslintRule => {
 };
 
 const collectArguments = (ruleArguments: any[]) => {
-    if (ruleArguments.length === 0 || ruleArguments[0] === false || ruleArguments.length < 2) {
+    if (ruleArguments.length === 0) {
         return undefined;
     }
 
-    if (ruleArguments.length === 2 && typeof ruleArguments[1] === "number") {
+    const argument = ruleArguments[0];
+
+    if (typeof argument === "number") {
         return {
             ruleArguments: [
                 {
-                    code: ruleArguments[1],
+                    code: argument,
                 },
             ],
         };
     }
 
-    const argument = ruleArguments[1];
-
     return {
         ruleArguments: [
             {
diff --git a/src/rules/converters/newline-before-return.ts b/src/rules/converters/newline-before-return.ts
new file mode 100644
index 0000000..3e6916a
--- /dev/null
+++ b/src/rules/converters/newline-before-return.ts
@@ -0,0 +1,19 @@
+import { RuleConverter } from "../converter";
+
+export const convertNewlineBeforeReturn: RuleConverter = () => {
+    return {
+        rules: [
+            {
+                ruleName: "padding-line-between-statements",
+                ruleArguments: [
+                    "error",
+                    {
+                        blankLine: "always",
+                        prev: "*",
+                        next: "return",
+                    },
+                ],
+            },
+        ],
+    };
+};
diff --git a/src/rules/converters/no-duplicate-imports.ts b/src/rules/converters/no-duplicate-imports.ts
new file mode 100644
index 0000000..1419d15
--- /dev/null
+++ b/src/rules/converters/no-duplicate-imports.ts
@@ -0,0 +1,14 @@
+import { RuleConverter } from "../converter";
+
+export const convertNoDuplicateImports: RuleConverter = tslintRule => {
+    return {
+        rules: [
+            {
+                ...(tslintRule.ruleArguments.includes("allow-namespace-imports") && {
+                    notices: ["ESLint does not support optional config allow-namespace-imports."],
+                }),
+                ruleName: "no-duplicate-imports",
+            },
+        ],
+    };
+};


Test patch:
diff --git a/src/rules/converters/tests/max-line-length.test.ts b/src/rules/converters/tests/max-line-length.test.ts
index 17332a2..14b9d62 100644
--- a/src/rules/converters/tests/max-line-length.test.ts
+++ b/src/rules/converters/tests/max-line-length.test.ts
@@ -15,37 +15,9 @@ describe(convertMaxLineLength, () => {
         });
     });
 
-    test("conversion with one argument true value", () => {
+    test("conversion with one argument number", () => {
         const result = convertMaxLineLength({
-            ruleArguments: [true],
-        });
-
-        expect(result).toEqual({
-            rules: [
-                {
-                    ruleName: "max-len",
-                },
-            ],
-        });
-    });
-
-    test("conversion with two arguments and first is false", () => {
-        const result = convertMaxLineLength({
-            ruleArguments: [false, 123],
-        });
-
-        expect(result).toEqual({
-            rules: [
-                {
-                    ruleName: "max-len",
-                },
-            ],
-        });
-    });
-
-    test("conversion with two arguments and second is number", () => {
-        const result = convertMaxLineLength({
-            ruleArguments: [true, 123],
+            ruleArguments: [123],
         });
 
         expect(result).toEqual({
@@ -58,10 +30,9 @@ describe(convertMaxLineLength, () => {
         });
     });
 
-    test("conversion with two arguments and second is object", () => {
+    test("conversion with one object argument", () => {
         const result = convertMaxLineLength({
             ruleArguments: [
-                true,
                 {
                     limit: 123,
                     "ignore-pattern": "^import |^export {(.*?)}",
@@ -91,7 +62,6 @@ describe(convertMaxLineLength, () => {
     test("conversion with check-strings inverting value true to false", () => {
         const result = convertMaxLineLength({
             ruleArguments: [
-                true,
                 {
                     limit: 123,
                     "check-strings": true,
@@ -117,7 +87,6 @@ describe(convertMaxLineLength, () => {
     test("conversion with check-strings inverting value false to true", () => {
         const result = convertMaxLineLength({
             ruleArguments: [
-                true,
                 {
                     limit: 123,
                     "check-strings": false,
@@ -143,7 +112,6 @@ describe(convertMaxLineLength, () => {
     test("conversion with check-regex inverting value true to false", () => {
         const result = convertMaxLineLength({
             ruleArguments: [
-                true,
                 {
                     limit: 123,
                     "check-regex": true,
@@ -169,7 +137,6 @@ describe(convertMaxLineLength, () => {
     test("conversion with check-regex inverting value false to true", () => {
         const result = convertMaxLineLength({
             ruleArguments: [
-                true,
                 {
                     limit: 123,
                     "check-regex": false,
diff --git a/src/rules/converters/tests/newline-before-return.test.ts b/src/rules/converters/tests/newline-before-return.test.ts
new file mode 100644
index 0000000..97f8dc7
--- /dev/null
+++ b/src/rules/converters/tests/newline-before-return.test.ts
@@ -0,0 +1,25 @@
+import { convertNewlineBeforeReturn } from "../newline-before-return";
+
+describe(convertNewlineBeforeReturn, () => {
+    test("conversion without arguments", () => {
+        const result = convertNewlineBeforeReturn({
+            ruleArguments: [],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleName: "padding-line-between-statements",
+                    ruleArguments: [
+                        "error",
+                        {
+                            blankLine: "always",
+                            next: "return",
+                            prev: "*",
+                        },
+                    ],
+                },
+            ],
+        });
+    });
+});
diff --git a/src/rules/converters/tests/no-duplicate-imports.test.ts b/src/rules/converters/tests/no-duplicate-imports.test.ts
new file mode 100644
index 0000000..b089f41
--- /dev/null
+++ b/src/rules/converters/tests/no-duplicate-imports.test.ts
@@ -0,0 +1,32 @@
+import { convertNoDuplicateImports } from "../no-duplicate-imports";
+
+describe(convertNoDuplicateImports, () => {
+    test("conversion without arguments", () => {
+        const result = convertNoDuplicateImports({
+            ruleArguments: [],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleName: "no-duplicate-imports",
+                },
+            ],
+        });
+    });
+
+    test("conversion with allow-namespace-imports argument", () => {
+        const result = convertNoDuplicateImports({
+            ruleArguments: ["allow-namespace-imports"],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    notices: ["ESLint does not support optional config allow-namespace-imports."],
+                    ruleName: "no-duplicate-imports",
+                },
+            ],
+        });
+    });
+});