@@ -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) {
0 commit comments