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

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


Pull request:
Implement converter for triple-equals rule #187
<!--
👋 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 #187 
-   [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. -->


Patch:
diff --git a/src/rules/converters.ts b/src/rules/converters.ts
index f1a6289..c844e40 100644
--- a/src/rules/converters.ts
+++ b/src/rules/converters.ts
@@ -86,6 +86,7 @@ import { convertPreferConst } from "./converters/prefer-const";
 import { convertPreferForOf } from "./converters/prefer-for-of";
 import { convertPreferFunctionOverMethod } from "./converters/prefer-function-over-method";
 import { convertPreferObjectSpread } from "./converters/prefer-object-spread";
+import { convertPreferReadonly } from "./converters/prefer-readonly";
 import { convertPreferTemplate } from "./converters/prefer-template";
 import { convertPromiseFunctionAsync } from "./converters/promise-function-async";
 import { convertRadix } from "./converters/radix";
@@ -99,6 +100,7 @@ import { convertUnifiedSignatures } from "./converters/unified-signatures";
 import { convertUnnecessaryBind } from "./converters/unnecessary-bind";
 import { convertUnnecessaryConstructor } from "./converters/unnecessary-constructor";
 import { convertUseIsnan } from "./converters/use-isnan";
+import { convertTripleEquals } from "./converters/triple-equals";
 
 /**
  * Keys TSLint rule names to their ESLint rule converters.
@@ -194,6 +196,7 @@ export const converters = new Map([
     ["one-variable-per-declaration", convertOneVariablePerDeclaration],
     ["prefer-const", convertPreferConst],
     ["prefer-function-over-method", convertPreferFunctionOverMethod],
+    ["prefer-readonly", convertPreferReadonly],
     ["prefer-template", convertPreferTemplate],
     ["space-before-function-paren", convertSpaceBeforeFunctionParen],
     ["switch-default", convertSwitchDefault],
@@ -205,7 +208,7 @@ export const converters = new Map([
     ["no-octal-literal", convertNoOctalLiteral],
     ["no-regex-spaces", convertNoRegexSpaces],
     ["no-unnecessary-semicolons", convertNoUnnecessarySemicolons],
-
+    ["triple-equals", convertTripleEquals],
     // These converters are all for rules that need more complex option conversions.
     // Some of them will likely need to have notices about changed lint behaviors...
     // If you're willing to take on that work, that'd be great! Please send PRs! 💖
@@ -223,7 +226,6 @@ export const converters = new Map([
     // ["no-void-expression", convertNoVoidExpression], // (no exact equivalent)
     // ["quotemark", convertQuotemark], // quotes
     // ["space-within-parens", convertSpaceWithinParens], // space-in-parens
-    // ["triple-equals", convertTripleEquals], // eqeqeq
     // ["variable-name", convertVariableName], // a bunch of rules...
 
     // tslint-microsoft-contrib rules:
diff --git a/src/rules/converters/prefer-readonly.ts b/src/rules/converters/prefer-readonly.ts
new file mode 100644
index 0000000..aaa2681
--- /dev/null
+++ b/src/rules/converters/prefer-readonly.ts
@@ -0,0 +1,15 @@
+import { RuleConverter } from "../converter";
+
+export const convertPreferReadonly: RuleConverter = tslintRule => {
+    return {
+        rules: [
+            {
+                ...(tslintRule.ruleArguments.length !== 0 &&
+                    tslintRule.ruleArguments[0] === "only-inline-lambdas" && {
+                        ruleArguments: [{ onlyInlineLambdas: true }],
+                    }),
+                ruleName: "prefer-readonly",
+            },
+        ],
+    };
+};
diff --git a/src/rules/converters/triple-equals.ts b/src/rules/converters/triple-equals.ts
new file mode 100644
index 0000000..26c6975
--- /dev/null
+++ b/src/rules/converters/triple-equals.ts
@@ -0,0 +1,48 @@
+import { RuleConverter } from "../converter";
+
+export const convertTripleEquals: RuleConverter = tslintRule => {
+    const getRuleOptions = () => {
+        const smartOptionNotice =
+            'Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.';
+
+        if (
+            tslintRule.ruleArguments.length !== 0 &&
+            tslintRule.ruleArguments[0] === "allow-null-check"
+        ) {
+            return {
+                arguments: ["smart"],
+                notices: [smartOptionNotice],
+            };
+        }
+
+        if (
+            tslintRule.ruleArguments.length !== 0 &&
+            tslintRule.ruleArguments[0] === "allow-undefined-check"
+        ) {
+            return {
+                arguments: ["smart"],
+                notices: [
+                    'Option "allow-undefined-check" is not supported by ESLint. Option "smart" is the closest.',
+                    smartOptionNotice,
+                ],
+            };
+        }
+
+        return {
+            arguments: ["always"],
+            notices: [],
+        };
+    };
+
+    const options = getRuleOptions();
+
+    return {
+        rules: [
+            {
+                ruleName: "eqeqeq",
+                ruleArguments: options.arguments,
+                notices: options.notices,
+            },
+        ],
+    };
+};


Test patch:
diff --git a/src/rules/converters/tests/prefer-readonly.test.ts b/src/rules/converters/tests/prefer-readonly.test.ts
new file mode 100644
index 0000000..e2761ca
--- /dev/null
+++ b/src/rules/converters/tests/prefer-readonly.test.ts
@@ -0,0 +1,32 @@
+import { convertPreferReadonly } from "../prefer-readonly";
+
+describe(convertPreferReadonly, () => {
+    test("conversion without arguments", () => {
+        const result = convertPreferReadonly({
+            ruleArguments: [],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleName: "prefer-readonly",
+                },
+            ],
+        });
+    });
+
+    test("conversion with an argument", () => {
+        const result = convertPreferReadonly({
+            ruleArguments: ["only-inline-lambdas"],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleArguments: [{ onlyInlineLambdas: true }],
+                    ruleName: "prefer-readonly",
+                },
+            ],
+        });
+    });
+});
diff --git a/src/rules/converters/tests/triple-equals.test.ts b/src/rules/converters/tests/triple-equals.test.ts
new file mode 100644
index 0000000..ad2940b
--- /dev/null
+++ b/src/rules/converters/tests/triple-equals.test.ts
@@ -0,0 +1,56 @@
+import { convertTripleEquals } from "../triple-equals";
+
+describe(convertTripleEquals, () => {
+    test("conversion without arguments", () => {
+        const result = convertTripleEquals({
+            ruleArguments: [],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleArguments: ["always"],
+                    ruleName: "eqeqeq",
+                    notices: [],
+                },
+            ],
+        });
+    });
+
+    test("conversion with an allow-null-check argument", () => {
+        const result = convertTripleEquals({
+            ruleArguments: ["allow-null-check"],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleArguments: ["smart"],
+                    ruleName: "eqeqeq",
+                    notices: [
+                        'Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.',
+                    ],
+                },
+            ],
+        });
+    });
+
+    test("conversion with an allow-undefined-check argument", () => {
+        const result = convertTripleEquals({
+            ruleArguments: ["allow-undefined-check"],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleArguments: ["smart"],
+                    ruleName: "eqeqeq",
+                    notices: [
+                        'Option "allow-undefined-check" is not supported by ESLint. Option "smart" is the closest.',
+                        'Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.',
+                    ],
+                },
+            ],
+        });
+    });
+});