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

Issue:
Missing converter: no-duplicate-imports
### 💥 Missing Converter

-   `tslint-to-eslint-config` version: 1.2.0
-   `typescript-eslint` version: 2.3.2

#### TSLint Rule Name

`no-duplicate-imports`


Pull request:
Added converter for no-duplicate-imports rule
<!--
👋 Hi, thanks for sending a PR to tslint-to-eslint-config! 💖
Please fill out all fields below to ensure your PR is reviewed quickly.
-->

## PR Checklist

-   [X] Addresses an existing issue: fixes #167 
-   [X] That issue was marked as [`status: accepting prs`](https://github.com/typescript-eslint/tslint-to-eslint-config/labels/status%3A%20accepting%20prs)

## Overview

<!-- Brief description of what is changed and how the code change does that. -->
Added converter for the no-duplicate-imports rule and unit tests.


Patch:
diff --git a/src/rules/converters.ts b/src/rules/converters.ts
index 96a0365..716e7a2 100644
--- a/src/rules/converters.ts
+++ b/src/rules/converters.ts
@@ -38,6 +38,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";
@@ -140,6 +141,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],
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/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/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",
+                },
+            ],
+        });
+    });
+});