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

Issue:
Errors loading user-requested configurations are ignored
### 🐛 Bug Report

-   `tslint-to-eslint-config` version: 0.2.2
-   ESLint version: N/A
-   Node version: N/A

#### Actual Behavior

If a user provides a configuration flag such as `--eslint` for a configuration that isn't required (so, any other than `tslint.json`), and there is an error in reading from that configuration, nothing bad happens. `tslint-to-eslint-config` will still continue as if the user had never asked for it.

#### Expected Behavior

When the user explicitly provides the `--eslint` flag on the CLI, errors loading the ESLint configurations should be reported. It's misleading to imply there were no errors.

#### Reproduction

Run `npx tslint-to-eslint-config --eslint ./nope.js` when `./nope.js` does not exist.

Pull request:
Added error reporting for optional configurations
## PR Checklist

-   [x] Addresses an existing issue: fixes #125
-   [x] That issue was marked as [`status: accepting prs`](https://github.com/typescript-eslint/tslint-to-eslint-config/labels/status%3A%20accepting%20prs)

## Overview

If configurations whose values were requested on the CLI give an error, those complaints will be logged.

https://twitter.com/JoshuaKGoldberg/status/1155596519883624449

Patch:
diff --git a/src/input/findOriginalConfigurations.ts b/src/input/findOriginalConfigurations.ts
index a2139f0..df0fb14 100644
--- a/src/input/findOriginalConfigurations.ts
+++ b/src/input/findOriginalConfigurations.ts
@@ -28,6 +28,7 @@ export const findOriginalConfigurations = async (
     dependencies: FindOriginalConfigurationsDependencies,
     rawSettings: TSLintToESLintSettings,
 ): Promise<ResultWithDataStatus<OriginalConfigurations>> => {
+    // Simultaneously search for all required configuration types
     const [eslint, packages, tslint, typescript] = await Promise.all([
         dependencies.findESLintConfiguration(rawSettings),
         dependencies.findPackagesConfiguration(rawSettings.package),
@@ -35,6 +36,7 @@ export const findOriginalConfigurations = async (
         dependencies.findTypeScriptConfiguration(rawSettings.typescript),
     ]);
 
+    // Out of those configurations, only TSLint's is required to run
     if (tslint instanceof Error) {
         return {
             complaints: [tslint.message],
@@ -42,6 +44,19 @@ export const findOriginalConfigurations = async (
         };
     }
 
+    // Other configuration errors only halt the program if the user asked for them
+    const configurationErrors = ([
+        [eslint, rawSettings.eslint],
+        [packages, rawSettings.package],
+        [typescript, rawSettings.typescript],
+    ] as const).filter(configurationResultIsError);
+    if (configurationErrors.length !== 0) {
+        return {
+            complaints: configurationErrors.map(([configuration]) => configuration.message),
+            status: ResultStatus.ConfigurationError,
+        };
+    }
+
     return {
         data: {
             ...(!(eslint instanceof Error) && { eslint }),
@@ -52,3 +67,9 @@ export const findOriginalConfigurations = async (
         status: ResultStatus.Succeeded,
     };
 };
+
+const configurationResultIsError = (
+    result: readonly [{} | Error | undefined, string | undefined],
+): result is [Error, string] => {
+    return result[0] instanceof Error && typeof result[1] === "string";
+};


Test patch:
diff --git a/src/input/findOriginalConfigurations.test.ts b/src/input/findOriginalConfigurations.test.ts
index 267ca06..98a7939 100644
--- a/src/input/findOriginalConfigurations.test.ts
+++ b/src/input/findOriginalConfigurations.test.ts
@@ -2,15 +2,13 @@ import {
     findOriginalConfigurations,
     FindOriginalConfigurationsDependencies,
 } from "./findOriginalConfigurations";
-import { ResultStatus } from "../types";
+import { ResultStatus, TSLintToESLintSettings } from "../types";
 import { TSLintConfiguration } from "./findTSLintConfiguration";
 import { ESLintConfiguration } from "./findESLintConfiguration";
 
-const createRawSettings = () => ({
+const createRawSettings = (overrides: Partial<TSLintToESLintSettings> = {}) => ({
     config: "./eslintrc.js",
-    eslint: "",
-    tslint: "",
-    typescript: "",
+    ...overrides,
 });
 
 const createDependencies = (overrides: Partial<FindOriginalConfigurationsDependencies> = {}) => ({
@@ -38,7 +36,7 @@ const createDependencies = (overrides: Partial<FindOriginalConfigurationsDepende
 });
 
 describe("findOriginalConfigurations", () => {
-    it("returns an errors when the tslint finder returns an error", async () => {
+    it("returns errors when the tslint finder returns an error", async () => {
         // Arrange
         const complaint = "Complaint from TSLint";
         const dependencies = createDependencies({
@@ -78,6 +76,58 @@ describe("findOriginalConfigurations", () => {
         });
     });
 
+    it("returns an error when an optional configuration returns an error and the user asked for it", async () => {
+        // Arrange
+        const eslint = new Error("one");
+        const dependencies = createDependencies({
+            findESLintConfiguration: async () => eslint,
+        });
+
+        // Act
+        const result = await findOriginalConfigurations(
+            dependencies,
+            createRawSettings({
+                eslint: "./eslintrc.js",
+            }),
+        );
+
+        // Assert
+        expect(result).toEqual({
+            complaints: [eslint.message],
+            status: ResultStatus.ConfigurationError,
+        });
+    });
+
+    it("returns successful results when an optional configuration returns an error and the user didn't ask for it", async () => {
+        // Arrange
+        const dependencies = createDependencies({
+            findESLintConfiguration: async () => new Error("one"),
+        });
+
+        // Act
+        const result = await findOriginalConfigurations(dependencies, createRawSettings());
+
+        // Assert
+        expect(result).toEqual({
+            data: {
+                packages: {
+                    dependencies: {},
+                    devDependencies: {},
+                },
+                tslint: {
+                    rulesDirectory: [],
+                    rules: {},
+                },
+                typescript: {
+                    compilerOptions: {
+                        target: "es3",
+                    },
+                },
+            },
+            status: ResultStatus.Succeeded,
+        });
+    });
+
     it("returns successful results when all finders succeed", async () => {
         // Arrange
         const dependencies = createDependencies();