Skip to content

Commit b00e0c7

Browse files
committed
[compiler] Handle empty list of eslint suppression rules (#34323)
--- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/34323). * #34276 * __->__ #34323 DiffTrain build for [3f2a42a](3f2a42a)
1 parent 8aa9685 commit b00e0c7

35 files changed

+100
-92
lines changed

compiled/eslint-plugin-react-hooks/index.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52206,16 +52206,22 @@ function findProgramSuppressions(programComments, ruleNames, flowSuppressions) {
5220652206
let disableComment = null;
5220752207
let enableComment = null;
5220852208
let source = null;
52209-
const rulePattern = `(${ruleNames.join('|')})`;
52210-
const disableNextLinePattern = new RegExp(`eslint-disable-next-line ${rulePattern}`);
52211-
const disablePattern = new RegExp(`eslint-disable ${rulePattern}`);
52212-
const enablePattern = new RegExp(`eslint-enable ${rulePattern}`);
52209+
let disableNextLinePattern = null;
52210+
let disablePattern = null;
52211+
let enablePattern = null;
52212+
if (ruleNames.length !== 0) {
52213+
const rulePattern = `(${ruleNames.join('|')})`;
52214+
disableNextLinePattern = new RegExp(`eslint-disable-next-line ${rulePattern}`);
52215+
disablePattern = new RegExp(`eslint-disable ${rulePattern}`);
52216+
enablePattern = new RegExp(`eslint-enable ${rulePattern}`);
52217+
}
5221352218
const flowSuppressionPattern = new RegExp('\\$(FlowFixMe\\w*|FlowExpectedError|FlowIssue)\\[react\\-rule');
5221452219
for (const comment of programComments) {
5221552220
if (comment.start == null || comment.end == null) {
5221652221
continue;
5221752222
}
5221852223
if (disableComment == null &&
52224+
disableNextLinePattern != null &&
5221952225
disableNextLinePattern.test(comment.value)) {
5222052226
disableComment = comment;
5222152227
enableComment = comment;
@@ -52228,11 +52234,13 @@ function findProgramSuppressions(programComments, ruleNames, flowSuppressions) {
5222852234
enableComment = comment;
5222952235
source = 'Flow';
5223052236
}
52231-
if (disablePattern.test(comment.value)) {
52237+
if (disablePattern != null && disablePattern.test(comment.value)) {
5223252238
disableComment = comment;
5223352239
source = 'Eslint';
5223452240
}
52235-
if (enablePattern.test(comment.value) && source === 'Eslint') {
52241+
if (enablePattern != null &&
52242+
enablePattern.test(comment.value) &&
52243+
source === 'Eslint') {
5223652244
enableComment = comment;
5223752245
}
5223852246
if (disableComment != null && source != null) {

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f5e96b974073d3ba80dc844d095c49d5b019afe0
1+
3f2a42a5decc88551d34c96f3d031c316ac34f6a
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f5e96b974073d3ba80dc844d095c49d5b019afe0
1+
3f2a42a5decc88551d34c96f3d031c316ac34f6a

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ __DEV__ &&
14181418
exports.useTransition = function () {
14191419
return resolveDispatcher().useTransition();
14201420
};
1421-
exports.version = "19.2.0-www-classic-f5e96b97-20250906";
1421+
exports.version = "19.2.0-www-classic-3f2a42a5-20250908";
14221422
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14231423
"function" ===
14241424
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ __DEV__ &&
14181418
exports.useTransition = function () {
14191419
return resolveDispatcher().useTransition();
14201420
};
1421-
exports.version = "19.2.0-www-modern-f5e96b97-20250906";
1421+
exports.version = "19.2.0-www-modern-3f2a42a5-20250908";
14221422
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14231423
"function" ===
14241424
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,4 +600,4 @@ exports.useSyncExternalStore = function (
600600
exports.useTransition = function () {
601601
return ReactSharedInternals.H.useTransition();
602602
};
603-
exports.version = "19.2.0-www-classic-f5e96b97-20250906";
603+
exports.version = "19.2.0-www-classic-3f2a42a5-20250908";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,4 +600,4 @@ exports.useSyncExternalStore = function (
600600
exports.useTransition = function () {
601601
return ReactSharedInternals.H.useTransition();
602602
};
603-
exports.version = "19.2.0-www-modern-f5e96b97-20250906";
603+
exports.version = "19.2.0-www-modern-3f2a42a5-20250908";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ exports.useSyncExternalStore = function (
604604
exports.useTransition = function () {
605605
return ReactSharedInternals.H.useTransition();
606606
};
607-
exports.version = "19.2.0-www-classic-f5e96b97-20250906";
607+
exports.version = "19.2.0-www-classic-3f2a42a5-20250908";
608608
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
609609
"function" ===
610610
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ exports.useSyncExternalStore = function (
604604
exports.useTransition = function () {
605605
return ReactSharedInternals.H.useTransition();
606606
};
607-
exports.version = "19.2.0-www-modern-f5e96b97-20250906";
607+
exports.version = "19.2.0-www-modern-3f2a42a5-20250908";
608608
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
609609
"function" ===
610610
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19708,10 +19708,10 @@ __DEV__ &&
1970819708
(function () {
1970919709
var internals = {
1971019710
bundleType: 1,
19711-
version: "19.2.0-www-classic-f5e96b97-20250906",
19711+
version: "19.2.0-www-classic-3f2a42a5-20250908",
1971219712
rendererPackageName: "react-art",
1971319713
currentDispatcherRef: ReactSharedInternals,
19714-
reconcilerVersion: "19.2.0-www-classic-f5e96b97-20250906"
19714+
reconcilerVersion: "19.2.0-www-classic-3f2a42a5-20250908"
1971519715
};
1971619716
internals.overrideHookState = overrideHookState;
1971719717
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19745,7 +19745,7 @@ __DEV__ &&
1974519745
exports.Shape = Shape;
1974619746
exports.Surface = Surface;
1974719747
exports.Text = Text;
19748-
exports.version = "19.2.0-www-classic-f5e96b97-20250906";
19748+
exports.version = "19.2.0-www-classic-3f2a42a5-20250908";
1974919749
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1975019750
"function" ===
1975119751
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)