Skip to content

Commit df6ba3f

Browse files
marcoww6facebook-github-bot
authored andcommitted
Pre-suppress errors for boolean literals for xplat js (#52482)
Summary: Pull Request resolved: #52482 Changelog: [Internal] Reviewed By: panagosg7 Differential Revision: D77915593 fbshipit-source-id: 9238b89e92410cea350c6057044167727de3601a
1 parent 5baf1e6 commit df6ba3f

7 files changed

Lines changed: 64 additions & 0 deletions

File tree

packages/react-native/Libraries/Core/ExceptionsManager.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ function reactConsoleErrorHandler(...args) {
242242
if (__DEV__) {
243243
// If we're not reporting to the console in reportException,
244244
// we need to report it as a console.error here.
245+
/* $FlowFixMe[constant-condition] Error discovered during Constant
246+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
245247
if (!reportToConsole) {
246248
require('../LogBox/LogBox').default.addConsoleLog('error', ...args);
247249
}

packages/react-native/Libraries/Interaction/InteractionManager.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ const InteractionManagerImpl = {
7373
* Notify manager that an interaction has started.
7474
*/
7575
createInteractionHandle(): Handle {
76+
/* $FlowFixMe[constant-condition] Error discovered during Constant
77+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
7678
DEBUG && console.log('InteractionManager: create interaction handle');
7779
_scheduleUpdate();
7880
const handle = ++_inc;
@@ -84,6 +86,8 @@ const InteractionManagerImpl = {
8486
* Notify manager that an interaction has completed.
8587
*/
8688
clearInteractionHandle(handle: Handle) {
89+
/* $FlowFixMe[constant-condition] Error discovered during Constant
90+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
8791
DEBUG && console.log('InteractionManager: clear interaction handle');
8892
invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
8993
_scheduleUpdate();

packages/react-native/Libraries/Interaction/TaskQueue.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ class TaskQueue {
9999
const task = queue.shift();
100100
try {
101101
if (typeof task === 'object' && task.gen) {
102+
/* $FlowFixMe[constant-condition] Error discovered during Constant
103+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
102104
DEBUG && console.log('TaskQueue: genPromise for task ' + task.name);
103105
this._genPromise(task);
104106
} else if (typeof task === 'object' && task.run) {
107+
/* $FlowFixMe[constant-condition] Error discovered during Constant
108+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
105109
DEBUG && console.log('TaskQueue: run task ' + task.name);
106110
task.run();
107111
} else {
@@ -110,6 +114,8 @@ class TaskQueue {
110114
'Expected Function, SimpleTask, or PromiseTask, but got:\n' +
111115
JSON.stringify(task, null, 2),
112116
);
117+
/* $FlowFixMe[constant-condition] Error discovered during Constant
118+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
113119
DEBUG && console.log('TaskQueue: run anonymous task');
114120
task();
115121
}
@@ -139,6 +145,8 @@ class TaskQueue {
139145
this._queueStack.length > 1
140146
) {
141147
this._queueStack.pop();
148+
/* $FlowFixMe[constant-condition] Error discovered during Constant
149+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
142150
DEBUG &&
143151
console.log('TaskQueue: popped queue: ', {
144152
stackIdx,
@@ -158,11 +166,17 @@ class TaskQueue {
158166
this._queueStack.push({tasks: [], popable: false});
159167
const stackIdx = this._queueStack.length - 1;
160168
const stackItem = this._queueStack[stackIdx];
169+
/* $FlowFixMe[constant-condition] Error discovered during Constant
170+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
161171
DEBUG && console.log('TaskQueue: push new queue: ', {stackIdx});
172+
/* $FlowFixMe[constant-condition] Error discovered during Constant
173+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
162174
DEBUG && console.log('TaskQueue: exec gen task ' + task.name);
163175
task
164176
.gen()
165177
.then(() => {
178+
/* $FlowFixMe[constant-condition] Error discovered during Constant
179+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
166180
DEBUG &&
167181
console.log('TaskQueue: onThen for gen task ' + task.name, {
168182
stackIdx,

packages/react-native/Libraries/Network/XMLHttpRequest.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ class XMLHttpRequest extends EventTarget {
646646
this.withCredentials,
647647
);
648648
};
649+
/* $FlowFixMe[constant-condition] Error discovered during Constant
650+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
649651
if (DEBUG_NETWORK_SEND_DELAY) {
650652
setTimeout(doSend, DEBUG_NETWORK_SEND_DELAY);
651653
} else {

packages/react-native/Libraries/Utilities/createPerformanceLogger.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class PerformanceLogger implements IPerformanceLogger {
3535
endExtras?: Extras,
3636
) {
3737
if (this._closed) {
38+
/* $FlowFixMe[constant-condition] Error discovered during Constant
39+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
3840
if (PRINT_TO_CONSOLE && __DEV__) {
3941
console.log(
4042
'PerformanceLogger: addTimespan - has closed ignoring: ',
@@ -44,6 +46,8 @@ class PerformanceLogger implements IPerformanceLogger {
4446
return;
4547
}
4648
if (this._timespans[key]) {
49+
/* $FlowFixMe[constant-condition] Error discovered during Constant
50+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
4751
if (PRINT_TO_CONSOLE && __DEV__) {
4852
console.log(
4953
'PerformanceLogger: Attempting to add a timespan that already exists ',
@@ -79,6 +83,8 @@ class PerformanceLogger implements IPerformanceLogger {
7983
this._timespans = {};
8084
this._extras = {};
8185
this._points = {};
86+
/* $FlowFixMe[constant-condition] Error discovered during Constant
87+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
8288
if (PRINT_TO_CONSOLE) {
8389
console.log('PerformanceLogger.js', 'clear');
8490
}
@@ -92,6 +98,8 @@ class PerformanceLogger implements IPerformanceLogger {
9298
}
9399
this._extras = {};
94100
this._points = {};
101+
/* $FlowFixMe[constant-condition] Error discovered during Constant
102+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
95103
if (PRINT_TO_CONSOLE) {
96104
console.log('PerformanceLogger.js', 'clearCompleted');
97105
}
@@ -130,6 +138,8 @@ class PerformanceLogger implements IPerformanceLogger {
130138
}
131139

132140
logEverything() {
141+
/* $FlowFixMe[constant-condition] Error discovered during Constant
142+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
133143
if (PRINT_TO_CONSOLE) {
134144
// log timespans
135145
for (const key in this._timespans) {
@@ -156,6 +166,8 @@ class PerformanceLogger implements IPerformanceLogger {
156166
extras?: Extras,
157167
) {
158168
if (this._closed) {
169+
/* $FlowFixMe[constant-condition] Error discovered during Constant
170+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
159171
if (PRINT_TO_CONSOLE && __DEV__) {
160172
console.log(
161173
'PerformanceLogger: markPoint - has closed ignoring: ',
@@ -165,6 +177,8 @@ class PerformanceLogger implements IPerformanceLogger {
165177
return;
166178
}
167179
if (this._points[key] != null) {
180+
/* $FlowFixMe[constant-condition] Error discovered during Constant
181+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
168182
if (PRINT_TO_CONSOLE && __DEV__) {
169183
console.log(
170184
'PerformanceLogger: Attempting to mark a point that has been already logged ',
@@ -187,13 +201,17 @@ class PerformanceLogger implements IPerformanceLogger {
187201

188202
setExtra(key: string, value: ExtraValue) {
189203
if (this._closed) {
204+
/* $FlowFixMe[constant-condition] Error discovered during Constant
205+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
190206
if (PRINT_TO_CONSOLE && __DEV__) {
191207
console.log('PerformanceLogger: setExtra - has closed ignoring: ', key);
192208
}
193209
return;
194210
}
195211

196212
if (this._extras.hasOwnProperty(key)) {
213+
/* $FlowFixMe[constant-condition] Error discovered during Constant
214+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
197215
if (PRINT_TO_CONSOLE && __DEV__) {
198216
console.log(
199217
'PerformanceLogger: Attempting to set an extra that already exists ',
@@ -211,6 +229,8 @@ class PerformanceLogger implements IPerformanceLogger {
211229
extras?: Extras,
212230
) {
213231
if (this._closed) {
232+
/* $FlowFixMe[constant-condition] Error discovered during Constant
233+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
214234
if (PRINT_TO_CONSOLE && __DEV__) {
215235
console.log(
216236
'PerformanceLogger: startTimespan - has closed ignoring: ',
@@ -221,6 +241,8 @@ class PerformanceLogger implements IPerformanceLogger {
221241
}
222242

223243
if (this._timespans[key]) {
244+
/* $FlowFixMe[constant-condition] Error discovered during Constant
245+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
224246
if (PRINT_TO_CONSOLE && __DEV__) {
225247
console.log(
226248
'PerformanceLogger: Attempting to start a timespan that already exists ',
@@ -234,6 +256,8 @@ class PerformanceLogger implements IPerformanceLogger {
234256
startTime: timestamp,
235257
startExtras: extras,
236258
};
259+
/* $FlowFixMe[constant-condition] Error discovered during Constant
260+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
237261
if (PRINT_TO_CONSOLE) {
238262
console.log('PerformanceLogger.js', 'start: ' + key);
239263
}
@@ -245,6 +269,8 @@ class PerformanceLogger implements IPerformanceLogger {
245269
extras?: Extras,
246270
) {
247271
if (this._closed) {
272+
/* $FlowFixMe[constant-condition] Error discovered during Constant
273+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
248274
if (PRINT_TO_CONSOLE && __DEV__) {
249275
console.log(
250276
'PerformanceLogger: stopTimespan - has closed ignoring: ',
@@ -256,6 +282,8 @@ class PerformanceLogger implements IPerformanceLogger {
256282

257283
const timespan = this._timespans[key];
258284
if (!timespan || timespan.startTime == null) {
285+
/* $FlowFixMe[constant-condition] Error discovered during Constant
286+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
259287
if (PRINT_TO_CONSOLE && __DEV__) {
260288
console.log(
261289
'PerformanceLogger: Attempting to end a timespan that has not started ',
@@ -265,6 +293,8 @@ class PerformanceLogger implements IPerformanceLogger {
265293
return;
266294
}
267295
if (timespan.endTime != null) {
296+
/* $FlowFixMe[constant-condition] Error discovered during Constant
297+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
268298
if (PRINT_TO_CONSOLE && __DEV__) {
269299
console.log(
270300
'PerformanceLogger: Attempting to end a timespan that has already ended ',
@@ -277,6 +307,8 @@ class PerformanceLogger implements IPerformanceLogger {
277307
timespan.endExtras = extras;
278308
timespan.endTime = timestamp;
279309
timespan.totalTime = timespan.endTime - (timespan.startTime || 0);
310+
/* $FlowFixMe[constant-condition] Error discovered during Constant
311+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
280312
if (PRINT_TO_CONSOLE) {
281313
console.log('PerformanceLogger.js', 'end: ' + key);
282314
}

packages/virtualized-lists/Lists/FillRateHelper.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const DEBUG = false;
3333

3434
let _listeners: Array<(Info) => void> = [];
3535
let _minSampleCount = 10;
36+
/* $FlowFixMe[constant-condition] Error discovered during Constant Condition
37+
* roll out. See https://fburl.com/workplace/1v97vimq. */
3638
let _sampleRate = DEBUG ? 1 : null;
3739

3840
/**
@@ -82,6 +84,8 @@ class FillRateHelper {
8284

8385
activate() {
8486
if (this._enabled && this._samplesStartTime == null) {
87+
/* $FlowFixMe[constant-condition] Error discovered during Constant
88+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
8589
DEBUG && console.debug('FillRateHelper: activate');
8690
this._samplesStartTime = global.performance.now();
8791
}
@@ -93,6 +97,8 @@ class FillRateHelper {
9397
}
9498
const start = this._samplesStartTime; // const for flow
9599
if (start == null) {
100+
/* $FlowFixMe[constant-condition] Error discovered during Constant
101+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
96102
DEBUG &&
97103
console.debug('FillRateHelper: bail on deactivate with no start time');
98104
return;
@@ -107,6 +113,8 @@ class FillRateHelper {
107113
...this._info,
108114
total_time_spent,
109115
};
116+
/* $FlowFixMe[constant-condition] Error discovered during Constant
117+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
110118
if (DEBUG) {
111119
const derived = {
112120
avg_blankness: this._info.pixels_blank / this._info.pixels_sampled,

packages/virtualized-lists/Lists/VirtualizedList.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ class VirtualizedList extends StateSafePureComponent<
279279
const cartOffset = this._listMetrics.cartesianOffset(
280280
offset + this._scrollMetrics.visibleLength,
281281
);
282+
/* $FlowFixMe[constant-condition] Error discovered during Constant
283+
* Condition roll out. See https://fburl.com/workplace/1v97vimq. */
282284
return horizontal ? {x: cartOffset} : {y: cartOffset};
283285
} else {
284286
return horizontal ? {x: offset} : {y: offset};

0 commit comments

Comments
 (0)