diff --git a/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.23.1.json b/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.23.1.json index d23e2e3b173..40059c12365 100644 --- a/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.23.1.json +++ b/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.23.1.json @@ -5,11 +5,6 @@ "scopeId": ".", "rule": "prefer-const" }, - { - "file": "src/index.ts", - "scopeId": ".", - "rule": "prefer-const" - }, { "file": "src/index.ts", "scopeId": ".ExampleClass", @@ -50,11 +45,6 @@ "scopeId": ".exampleAnonymousClass", "rule": "@typescript-eslint/typedef" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass", - "rule": "@typescript-eslint/typedef" - }, { "file": "src/index.ts", "scopeId": ".exampleAnonymousClass", @@ -70,11 +60,6 @@ "scopeId": ".exampleAnonymousClass.exampleSetGet", "rule": "@typescript-eslint/ban-types" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass.exampleSetGet", - "rule": "@typescript-eslint/ban-types" - }, { "file": "src/index.ts", "scopeId": ".exampleAnonymousClass.exampleSetGet", @@ -85,11 +70,6 @@ "scopeId": ".exampleAnonymousClass.exampleSetGet", "rule": "@typescript-eslint/explicit-member-accessibility" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass.exampleSetGet", - "rule": "@typescript-eslint/explicit-member-accessibility" - }, { "file": "src/index.ts", "scopeId": ".exampleArrowFunction", @@ -120,11 +100,6 @@ "scopeId": ".exampleFunction", "rule": "@typescript-eslint/ban-types" }, - { - "file": "src/index.ts", - "scopeId": ".exampleFunction", - "rule": "@typescript-eslint/ban-types" - }, { "file": "src/index.ts", "scopeId": ".exampleFunction", diff --git a/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.6.0.json b/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.6.0.json index d23e2e3b173..40059c12365 100644 --- a/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.6.0.json +++ b/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.6.0.json @@ -5,11 +5,6 @@ "scopeId": ".", "rule": "prefer-const" }, - { - "file": "src/index.ts", - "scopeId": ".", - "rule": "prefer-const" - }, { "file": "src/index.ts", "scopeId": ".ExampleClass", @@ -50,11 +45,6 @@ "scopeId": ".exampleAnonymousClass", "rule": "@typescript-eslint/typedef" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass", - "rule": "@typescript-eslint/typedef" - }, { "file": "src/index.ts", "scopeId": ".exampleAnonymousClass", @@ -70,11 +60,6 @@ "scopeId": ".exampleAnonymousClass.exampleSetGet", "rule": "@typescript-eslint/ban-types" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass.exampleSetGet", - "rule": "@typescript-eslint/ban-types" - }, { "file": "src/index.ts", "scopeId": ".exampleAnonymousClass.exampleSetGet", @@ -85,11 +70,6 @@ "scopeId": ".exampleAnonymousClass.exampleSetGet", "rule": "@typescript-eslint/explicit-member-accessibility" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass.exampleSetGet", - "rule": "@typescript-eslint/explicit-member-accessibility" - }, { "file": "src/index.ts", "scopeId": ".exampleArrowFunction", @@ -120,11 +100,6 @@ "scopeId": ".exampleFunction", "rule": "@typescript-eslint/ban-types" }, - { - "file": "src/index.ts", - "scopeId": ".exampleFunction", - "rule": "@typescript-eslint/ban-types" - }, { "file": "src/index.ts", "scopeId": ".exampleFunction", diff --git a/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.7.0.json b/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.7.0.json index d23e2e3b173..40059c12365 100644 --- a/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.7.0.json +++ b/build-tests/eslint-bulk-suppressions-test/client/.eslint-bulk-suppressions-8.7.0.json @@ -5,11 +5,6 @@ "scopeId": ".", "rule": "prefer-const" }, - { - "file": "src/index.ts", - "scopeId": ".", - "rule": "prefer-const" - }, { "file": "src/index.ts", "scopeId": ".ExampleClass", @@ -50,11 +45,6 @@ "scopeId": ".exampleAnonymousClass", "rule": "@typescript-eslint/typedef" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass", - "rule": "@typescript-eslint/typedef" - }, { "file": "src/index.ts", "scopeId": ".exampleAnonymousClass", @@ -70,11 +60,6 @@ "scopeId": ".exampleAnonymousClass.exampleSetGet", "rule": "@typescript-eslint/ban-types" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass.exampleSetGet", - "rule": "@typescript-eslint/ban-types" - }, { "file": "src/index.ts", "scopeId": ".exampleAnonymousClass.exampleSetGet", @@ -85,11 +70,6 @@ "scopeId": ".exampleAnonymousClass.exampleSetGet", "rule": "@typescript-eslint/explicit-member-accessibility" }, - { - "file": "src/index.ts", - "scopeId": ".exampleAnonymousClass.exampleSetGet", - "rule": "@typescript-eslint/explicit-member-accessibility" - }, { "file": "src/index.ts", "scopeId": ".exampleArrowFunction", @@ -120,11 +100,6 @@ "scopeId": ".exampleFunction", "rule": "@typescript-eslint/ban-types" }, - { - "file": "src/index.ts", - "scopeId": ".exampleFunction", - "rule": "@typescript-eslint/ban-types" - }, { "file": "src/index.ts", "scopeId": ".exampleFunction", diff --git a/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts b/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts index cff8f5d0d64..8772904b494 100644 --- a/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts +++ b/eslint/eslint-patch/src/eslint-bulk-suppressions/bulk-suppressions-patch.ts @@ -324,6 +324,12 @@ export function patchClass(originalClass: new () => T, patchedCl } } +/** + * This returns a wrapped version of the "verify" function from ESLint's Linter class + * that postprocesses rule violations that weren't suppressed by comments. This postprocessing + * records suppressions that weren't otherwise suppressed by comments to be used + * by the "suppress" and "prune" commands. + */ export function extendVerifyFunction( originalFn: (this: unknown, ...args: unknown[]) => IProblem[] | undefined ): (this: unknown, ...args: unknown[]) => IProblem[] | undefined { @@ -341,9 +347,11 @@ export function extendVerifyFunction( newJsonObject: { suppressions: newSuppressions } } } = problem[SUPPRESSION_SYMBOL]; - newSerializedSuppressions.add(serializedSuppression); - suppressions.push(suppression); - newSuppressions.push(suppression); + if (!newSerializedSuppressions.has(serializedSuppression)) { + newSerializedSuppressions.add(serializedSuppression); + newSuppressions.push(suppression); + suppressions.push(suppression); + } } } }