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

Issue:
Missing Converter for prefer-conditional-expression
<!--
👋 Hi, thanks for filing an issue on tslint-to-eslint-config! 💖
Please fill out all fields below to ensure your issue is addressed.

If your issue doesn't provide enough info to fully explain or reproduce your bug, it will be closed. 😦
-->

### 💥 Missing Converter

-   `tslint-to-eslint-config` version: 2.1.0
-   `typescript-eslint` version: 4.14.1

#### TSLint Rule Name

  * tslint-to-eslint-config does not know the ESLint equivalent for TSLint's "prefer-conditional-expression".

#### Package Source

Not 100% sure this is a complete match, but the doc reads as close enough:
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md

Pull request description:
Add prefer-conditional-expression converter
<!--
👋 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 #935
-   [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. -->

Not 100% sure if it checks nested "if-else-if" statements but based on the eslint plugin docs, does seem to only check simple "if-else" cases.

Patch:
diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts
index 13857fd..1853b72 100644
--- a/src/converters/lintConfigs/rules/ruleConverters.ts
+++ b/src/converters/lintConfigs/rules/ruleConverters.ts
@@ -112,6 +112,7 @@ import { convertOneLine } from "./ruleConverters/one-line";
 import { convertOneVariablePerDeclaration } from "./ruleConverters/one-variable-per-declaration";
 import { convertOnlyArrowFunctions } from "./ruleConverters/only-arrow-functions";
 import { convertOrderedImports } from "./ruleConverters/ordered-imports";
+import { convertPreferConditionalExpression } from "./ruleConverters/prefer-conditional-expression";
 import { convertPreferConst } from "./ruleConverters/prefer-const";
 import { convertPreferForOf } from "./ruleConverters/prefer-for-of";
 import { convertPreferFunctionOverMethod } from "./ruleConverters/prefer-function-over-method";
@@ -374,6 +375,7 @@ export const ruleConverters = new Map([
     ["only-arrow-functions", convertOnlyArrowFunctions],
     ["ordered-imports", convertOrderedImports],
     ["pipe-prefix", convertPipePrefix],
+    ["prefer-conditional-expression", convertPreferConditionalExpression],
     ["prefer-const", convertPreferConst],
     ["prefer-for-of", convertPreferForOf],
     ["prefer-function-over-method", convertPreferFunctionOverMethod],
diff --git a/src/converters/lintConfigs/rules/ruleConverters/prefer-conditional-expression.ts b/src/converters/lintConfigs/rules/ruleConverters/prefer-conditional-expression.ts
new file mode 100644
index 0000000..167354e
--- /dev/null
+++ b/src/converters/lintConfigs/rules/ruleConverters/prefer-conditional-expression.ts
@@ -0,0 +1,18 @@
+import { RuleConverter } from "../ruleConverter";
+
+export const PREFER_CONDITIONAL_EXPRESSION_NOTICE =
+    "The eslint-plugin-unicorn only supports simple 'if-else' statements.";
+
+export const convertPreferConditionalExpression: RuleConverter = (tslintRule) => {
+    return {
+        rules: [
+            {
+                ...(tslintRule.ruleArguments.length !== 0 && {
+                    notices: [PREFER_CONDITIONAL_EXPRESSION_NOTICE],
+                }),
+                ruleName: "unicorn/prefer-ternary",
+            },
+        ],
+        plugins: ["eslint-plugin-unicorn"],
+    };
+};


Test patch:
diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-conditional-expression.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-conditional-expression.test.ts
new file mode 100644
index 0000000..58135b2
--- /dev/null
+++ b/src/converters/lintConfigs/rules/ruleConverters/tests/prefer-conditional-expression.test.ts
@@ -0,0 +1,34 @@
+import { convertPreferConditionalExpression, PREFER_CONDITIONAL_EXPRESSION_NOTICE } from "../prefer-conditional-expression";
+
+describe(convertPreferConditionalExpression, () => {
+    test("conversion without arguments", () => {
+        const result = convertPreferConditionalExpression({
+            ruleArguments: [],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    ruleName: "unicorn/prefer-ternary",
+                },
+            ],
+            plugins: ["eslint-plugin-unicorn"],
+        });
+    });
+
+    test("conversion with 'check-else-if' argument", () => {
+        const result = convertPreferConditionalExpression({
+            ruleArguments: ['check-else-if'],
+        });
+
+        expect(result).toEqual({
+            rules: [
+                {
+                    notices: [PREFER_CONDITIONAL_EXPRESSION_NOTICE],
+                    ruleName: "unicorn/prefer-ternary",
+                },
+            ],
+            plugins: ["eslint-plugin-unicorn"],
+        });
+    });
+});
\ No newline at end of file