Skip to content

Commit 550aa86

Browse files
authored
Fix an issue where suppressed rule violations still show up in the report in ESLint >=9.37.0. (#5422)
* Fix an issue where suppressed rule violations still show up in the report in ESLint >=9.37.0. * Fix an issue where the ESLint process will crash when running in the ESLint VSCode extension in ESLint >=9.37.0.
1 parent ba47844 commit 550aa86

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/eslint-patch",
5+
"comment": "Fix an issue where suppressed rule violations still show up in the report in ESLint >=9.37.0.",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@rushstack/eslint-patch"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/eslint-patch",
5+
"comment": "Fix an issue where the ESLint process will crash when running in the ESLint VSCode extension in ESLint >=9.37.0.",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@rushstack/eslint-patch"
10+
}

eslint/eslint-patch/src/eslint-bulk-suppressions/generate-patched-file.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,19 @@ const requireFromPathToLinterJS = bulkSuppressionsPatch.requireFromPathToLinterJ
273273
}
274274

275275
outputFile += `
276-
// --- BEGIN MONKEY PATCH ---
277-
if (bulkSuppressionsPatch.shouldBulkSuppress({ filename, currentNode: args[0]?.node ?? currentNode, ruleId, problem })) return;
276+
// --- BEGIN MONKEY PATCH ---`;
277+
if (majorVersion >= 9 && minorVersion >= 37) {
278+
outputFile += `
279+
if (bulkSuppressionsPatch.shouldBulkSuppress({ filename, currentNode: args[0]?.node ?? currentNode, ruleId, problem })) {
280+
report.messages.splice(report.messages.indexOf(problem), 1);
281+
return;
282+
}`;
283+
} else {
284+
outputFile += `
285+
if (bulkSuppressionsPatch.shouldBulkSuppress({ filename, currentNode: args[0]?.node ?? currentNode, ruleId, problem })) return;`;
286+
}
287+
288+
outputFile += `
278289
// --- END MONKEY PATCH ---`;
279290

280291
//
@@ -332,6 +343,7 @@ const requireFromPathToLinterJS = bulkSuppressionsPatch.requireFromPathToLinterJ
332343
if (internalSlotsMap.get(this) === undefined) {
333344
internalSlotsMap.set(this, {
334345
cwd: normalizeCwd(cwd),
346+
flags: [],
335347
lastConfigArray: null,
336348
lastSourceCode: null,
337349
lastSuppressedMessages: [],

0 commit comments

Comments
 (0)