From 088a181a8c8c81881fc1778d4b27941818f0be7a Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 24 Jul 2023 11:55:23 -0700 Subject: [PATCH 1/3] Triage and fix some eslint rules --- .eslintrc.json | 17 +++++++++-------- src/compiler/debug.ts | 1 + src/compiler/watchPublic.ts | 1 - 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 30e6bb6ef2f65..735620c70806d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -57,6 +57,13 @@ "prefer-object-spread": "error", "unicode-bom": ["error", "never"], + // Enabled in eslint:recommended, but not applicable here + "no-case-declarations": "off", + "no-cond-assign": "off", + "no-constant-condition": ["error", { "checkLoops": false }], + "no-control-regex": "off", + "no-inner-declarations": "off", + // @typescript-eslint/eslint-plugin "@typescript-eslint/naming-convention": [ "error", @@ -79,22 +86,16 @@ "@typescript-eslint/no-namespace": "off", "@typescript-eslint/no-non-null-asserted-optional-chain": "off", "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-empty-interface": "off", + "@typescript-eslint/no-explicit-any": "off", // Todo: For each of these, investigate whether we want to enable them ✨ "@typescript-eslint/ban-types": "off", - "no-case-declarations": "off", - "no-cond-assign": "off", - "no-constant-condition": "off", - "no-control-regex": "off", - "no-debugger": "off", "no-extra-boolean-cast": "off", - "no-inner-declarations": "off", "no-useless-escape": "off", "prefer-rest-params": "off", "prefer-spread": "off", "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-vars": "off", // Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820 diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index 057323c788e00..79eac952ddc54 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -193,6 +193,7 @@ export namespace Debug { } export function fail(message?: string, stackCrawlMark?: AnyFunction): never { + // eslint-disable-next-line no-debugger debugger; const e = new Error(message ? `Debug Failure. ${message}` : "Debug Failure."); if ((Error as any).captureStackTrace) { diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index f5eb07f44dd62..b216c8cb75de0 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -604,7 +604,6 @@ export function createWatchProgram(host: WatchCompiler if (hasChangedCompilerOptions) { newLine = updateNewLine(); if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) { - debugger; resolutionCache.onChangesAffectModuleResolution(); } } From 21ffbe8b7851b95715c771301c451558004b2a91 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 24 Jul 2023 13:16:26 -0700 Subject: [PATCH 2/3] Add no-extra-boolean-cast after other PR broke --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 735620c70806d..0abc66b1ec364 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -58,6 +58,7 @@ "unicode-bom": ["error", "never"], // Enabled in eslint:recommended, but not applicable here + "no-extra-boolean-cast": "off", "no-case-declarations": "off", "no-cond-assign": "off", "no-constant-condition": ["error", { "checkLoops": false }], @@ -91,7 +92,6 @@ // Todo: For each of these, investigate whether we want to enable them ✨ "@typescript-eslint/ban-types": "off", - "no-extra-boolean-cast": "off", "no-useless-escape": "off", "prefer-rest-params": "off", "prefer-spread": "off", From 79c31bb1d3d76c4b915a46116ca3d443fd17c9bf Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 24 Jul 2023 13:23:48 -0700 Subject: [PATCH 3/3] Move lint rule out of the wrong section --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0abc66b1ec364..1483ba5933f97 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -34,6 +34,7 @@ "dot-notation": "error", "eqeqeq": "error", "no-caller": "error", + "no-constant-condition": ["error", { "checkLoops": false }], "no-eval": "error", "no-extra-bind": "error", "no-new-func": "error", @@ -61,7 +62,6 @@ "no-extra-boolean-cast": "off", "no-case-declarations": "off", "no-cond-assign": "off", - "no-constant-condition": ["error", { "checkLoops": false }], "no-control-regex": "off", "no-inner-declarations": "off",