Skip to content

Commit 782c7b6

Browse files
committed
Replace all warning/lowPriWarning with console calls
1 parent b15bf36 commit 782c7b6

File tree

77 files changed

+334
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+334
-403
lines changed

packages/create-subscription/src/createSubscription.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import React from 'react';
1111
import invariant from 'shared/invariant';
12-
import warning from 'shared/warning';
1312

1413
type Unsubscribe = () => void;
1514

@@ -38,10 +37,10 @@ export function createSubscription<Property, Value>(
3837

3938
if (__DEV__) {
4039
if (typeof getCurrentValue !== 'function') {
41-
warning('Subscription must specify a getCurrentValue function');
40+
console.error('Subscription must specify a getCurrentValue function');
4241
}
4342
if (typeof subscribe !== 'function') {
44-
warning('Subscription must specify a subscribe function');
43+
console.error('Subscription must specify a subscribe function');
4544
}
4645
}
4746

packages/legacy-events/EventPluginUtils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import {invokeGuardedCallbackAndCatchFirstError} from 'shared/ReactErrorUtils';
99
import invariant from 'shared/invariant';
10-
import warning from 'shared/warning';
1110

1211
export let getFiberCurrentPropsFromNode = null;
1312
export let getInstanceFromNode = null;
@@ -23,7 +22,7 @@ export function setComponentTree(
2322
getNodeFromInstance = getNodeFromInstanceImpl;
2423
if (__DEV__) {
2524
if (!getNodeFromInstance || !getInstanceFromNode) {
26-
warning(
25+
console.error(
2726
'EventPluginUtils.setComponentTree(...): Injected ' +
2827
'module is missing getNodeFromInstance or getInstanceFromNode.',
2928
);
@@ -52,7 +51,7 @@ if (__DEV__) {
5251
: 0;
5352

5453
if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
55-
warning('EventPluginUtils: Invalid `event`.');
54+
console.error('EventPluginUtils: Invalid `event`.');
5655
}
5756
};
5857
}

packages/legacy-events/EventPropagators.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
traverseTwoPhase,
1111
traverseEnterLeave,
1212
} from 'shared/ReactTreeTraversal';
13-
import warning from 'shared/warning';
1413

1514
import {getListener} from './EventPluginHub';
1615
import accumulateInto from './accumulateInto';
@@ -47,7 +46,7 @@ function listenerAtPhase(inst, event, propagationPhase: PropagationPhases) {
4746
function accumulateDirectionalDispatches(inst, phase, event) {
4847
if (__DEV__) {
4948
if (!inst) {
50-
warning('Dispatching inst must not be null');
49+
console.error('Dispatching inst must not be null');
5150
}
5251
}
5352
const listener = listenerAtPhase(inst, event, phase);

packages/legacy-events/ResponderTouchHistoryStore.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
import invariant from 'shared/invariant';
11-
import warning from 'shared/warning';
1211

1312
import {isStartish, isMoveish, isEndish} from './ResponderTopLevelEventTypes';
1413

@@ -96,7 +95,7 @@ function getTouchIdentifier({identifier}: Touch): number {
9695
invariant(identifier != null, 'Touch object is missing identifier.');
9796
if (__DEV__) {
9897
if (identifier > MAX_TOUCH_BANK) {
99-
warning(
98+
console.error(
10099
'Touch identifier %s is greater than maximum supported %s which causes ' +
101100
'performance issues backfilling array locations for all of the indices.',
102101
identifier,
@@ -202,7 +201,7 @@ const ResponderTouchHistoryStore = {
202201
if (__DEV__) {
203202
const activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
204203
if (activeRecord == null || !activeRecord.touchActive) {
205-
warning('Cannot find single active touch.');
204+
console.error('Cannot find single active touch.');
206205
}
207206
}
208207
}

packages/legacy-events/SyntheticEvent.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
/* eslint valid-typeof: 0 */
99

1010
import invariant from 'shared/invariant';
11-
import warning from 'shared/warning';
1211

1312
const EVENT_POOL_SIZE = 10;
1413

@@ -284,7 +283,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
284283

285284
function warn(action, result) {
286285
if (__DEV__) {
287-
warning(
286+
console.error(
288287
"This synthetic event is reused for performance reasons. If you're seeing this, " +
289288
"you're %s `%s` on a released/nullified synthetic event. %s. " +
290289
'If you must keep the original synthetic event around, use event.persist(). ' +

packages/react-cache/src/ReactCache.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
import React from 'react';
11-
import warning from 'shared/warning';
1211

1312
import {createLRU} from './LRU';
1413

@@ -71,7 +70,7 @@ function identityHashFn(input) {
7170
input !== undefined &&
7271
input !== null
7372
) {
74-
warning(
73+
console.error(
7574
'Invalid key type. Expected a string, number, symbol, or boolean, ' +
7675
'but instead received: %s' +
7776
'\n\nTo use non-primitive values as keys, you must pass a hash ' +

packages/react-dom/src/client/ReactDOM.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ import {
5353
} from 'legacy-events/EventPropagators';
5454
import ReactVersion from 'shared/ReactVersion';
5555
import invariant from 'shared/invariant';
56-
import lowPriorityWarning from 'shared/lowPriorityWarning';
57-
import warning from 'shared/warning';
5856
import {exposeConcurrentModeAPIs} from 'shared/ReactFeatureFlags';
5957

6058
import {
@@ -92,7 +90,7 @@ if (__DEV__) {
9290
typeof Set.prototype.clear !== 'function' ||
9391
typeof Set.prototype.forEach !== 'function'
9492
) {
95-
warning(
93+
console.error(
9694
'React depends on Map and Set built-in types. Make sure that you load a ' +
9795
'polyfill in older browsers. https://fb.me/react-polyfills',
9896
);
@@ -144,7 +142,7 @@ const ReactDOM: Object = {
144142
if (__DEV__) {
145143
if (!didWarnAboutUnstableCreatePortal) {
146144
didWarnAboutUnstableCreatePortal = true;
147-
lowPriorityWarning(
145+
console.warn(
148146
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
149147
'and will be removed in React 17+. Update your code to use ' +
150148
'ReactDOM.createPortal() instead. It has the exact same API, ' +

packages/react-dom/src/client/ReactDOMComponent.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import {getCurrentFiberOwnerNameInDevOrNull} from 'react-reconciler/src/ReactCurrentFiber';
1212
import {registrationNameModules} from 'legacy-events/EventPluginRegistry';
1313
import {canUseDOM} from 'shared/ExecutionEnvironment';
14-
import warning from 'shared/warning';
1514
import endsWith from 'shared/endsWith';
1615
import {setListenToResponderEventTypes} from '../events/DOMEventResponderSystem';
1716

@@ -183,7 +182,7 @@ if (__DEV__) {
183182
return;
184183
}
185184
didWarnInvalidHydration = true;
186-
warning(
185+
console.error(
187186
'Text content did not match. Server: "%s" Client: "%s"',
188187
normalizedServerText,
189188
normalizedClientText,
@@ -208,7 +207,7 @@ if (__DEV__) {
208207
return;
209208
}
210209
didWarnInvalidHydration = true;
211-
warning(
210+
console.error(
212211
'Prop `%s` did not match. Server: %s Client: %s',
213212
propName,
214213
JSON.stringify(normalizedServerValue),
@@ -225,12 +224,12 @@ if (__DEV__) {
225224
attributeNames.forEach(function(name) {
226225
names.push(name);
227226
});
228-
warning('Extra attributes from the server: %s', names);
227+
console.error('Extra attributes from the server: %s', names);
229228
};
230229

231230
warnForInvalidEventListener = function(registrationName, listener) {
232231
if (listener === false) {
233-
warning(
232+
console.error(
234233
'Expected `%s` listener to be a function, instead got `false`.\n\n' +
235234
'If you used to conditionally omit it with %s={condition && value}, ' +
236235
'pass %s={condition ? value : undefined} instead.',
@@ -239,7 +238,7 @@ if (__DEV__) {
239238
registrationName,
240239
);
241240
} else {
242-
warning(
241+
console.error(
243242
'Expected `%s` listener to be a function, instead got a value of `%s` type.',
244243
registrationName,
245244
typeof listener,
@@ -412,7 +411,7 @@ export function createElement(
412411
// Should this check be gated by parent namespace? Not sure we want to
413412
// allow <SVG> or <mATH>.
414413
if (!isCustomComponentTag && type !== type.toLowerCase()) {
415-
warning(
414+
console.error(
416415
'<%s /> is using incorrect casing. ' +
417416
'Use PascalCase for React components, ' +
418417
'or lowercase for HTML elements.',
@@ -427,7 +426,7 @@ export function createElement(
427426
const div = ownerDocument.createElement('div');
428427
if (__DEV__) {
429428
if (enableTrustedTypesIntegration && !didWarnScriptTags) {
430-
warning(
429+
console.error(
431430
'Encountered a script tag while rendering React component. ' +
432431
'Scripts inside React components are never executed when rendering ' +
433432
'on the client. Consider using template tag instead ' +
@@ -482,7 +481,7 @@ export function createElement(
482481
!Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)
483482
) {
484483
warnedUnknownTags[type] = true;
485-
warning(
484+
console.error(
486485
'The tag <%s> is unrecognized in this browser. ' +
487486
'If you meant to render a React component, start its name with ' +
488487
'an uppercase letter.',
@@ -518,7 +517,7 @@ export function setInitialProperties(
518517
!didWarnShadyDOM &&
519518
(domElement: any).shadyRoot
520519
) {
521-
warning(
520+
console.error(
522521
'%s is using shady DOM. Using shady DOM with React can ' +
523522
'cause things to break subtly.',
524523
getCurrentFiberOwnerNameInDevOrNull() || 'A component',
@@ -918,7 +917,7 @@ export function diffHydratedProperties(
918917
!didWarnShadyDOM &&
919918
(domElement: any).shadyRoot
920919
) {
921-
warning(
920+
console.error(
922921
'%s is using shady DOM. Using shady DOM with React can ' +
923922
'cause things to break subtly.',
924923
getCurrentFiberOwnerNameInDevOrNull() || 'A component',
@@ -1210,7 +1209,7 @@ export function warnForDeletedHydratableElement(
12101209
return;
12111210
}
12121211
didWarnInvalidHydration = true;
1213-
warning(
1212+
console.error(
12141213
'Did not expect server HTML to contain a <%s> in <%s>.',
12151214
child.nodeName.toLowerCase(),
12161215
parentNode.nodeName.toLowerCase(),
@@ -1227,7 +1226,7 @@ export function warnForDeletedHydratableText(
12271226
return;
12281227
}
12291228
didWarnInvalidHydration = true;
1230-
warning(
1229+
console.error(
12311230
'Did not expect server HTML to contain the text node "%s" in <%s>.',
12321231
child.nodeValue,
12331232
parentNode.nodeName.toLowerCase(),
@@ -1245,7 +1244,7 @@ export function warnForInsertedHydratedElement(
12451244
return;
12461245
}
12471246
didWarnInvalidHydration = true;
1248-
warning(
1247+
console.error(
12491248
'Expected server HTML to contain a matching <%s> in <%s>.',
12501249
tag,
12511250
parentNode.nodeName.toLowerCase(),
@@ -1269,7 +1268,7 @@ export function warnForInsertedHydratedText(
12691268
return;
12701269
}
12711270
didWarnInvalidHydration = true;
1272-
warning(
1271+
console.error(
12731272
'Expected server HTML to contain a matching text node for "%s" in <%s>.',
12741273
text,
12751274
parentNode.nodeName.toLowerCase(),

packages/react-dom/src/client/ReactDOMInput.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// TODO: direct imports like some-package/src/* are bad. Fix me.
1111
import {getCurrentFiberOwnerNameInDevOrNull} from 'react-reconciler/src/ReactCurrentFiber';
1212
import invariant from 'shared/invariant';
13-
import warning from 'shared/warning';
1413

1514
import {setValueForProperty} from './DOMPropertyOperations';
1615
import {getFiberCurrentPropsFromNode} from './ReactDOMComponentTree';
@@ -79,7 +78,7 @@ export function initWrapperState(element: Element, props: Object) {
7978
props.defaultChecked !== undefined &&
8079
!didWarnCheckedDefaultChecked
8180
) {
82-
warning(
81+
console.error(
8382
'%s contains an input of type %s with both checked and defaultChecked props. ' +
8483
'Input elements must be either controlled or uncontrolled ' +
8584
'(specify either the checked prop, or the defaultChecked prop, but not ' +
@@ -96,7 +95,7 @@ export function initWrapperState(element: Element, props: Object) {
9695
props.defaultValue !== undefined &&
9796
!didWarnValueDefaultValue
9897
) {
99-
warning(
98+
console.error(
10099
'%s contains an input of type %s with both value and defaultValue props. ' +
101100
'Input elements must be either controlled or uncontrolled ' +
102101
'(specify either the value prop, or the defaultValue prop, but not ' +
@@ -141,7 +140,7 @@ export function updateWrapper(element: Element, props: Object) {
141140
controlled &&
142141
!didWarnUncontrolledToControlled
143142
) {
144-
warning(
143+
console.error(
145144
'A component is changing an uncontrolled input of type %s to be controlled. ' +
146145
'Input elements should not switch from uncontrolled to controlled (or vice versa). ' +
147146
'Decide between using a controlled or uncontrolled input ' +
@@ -155,7 +154,7 @@ export function updateWrapper(element: Element, props: Object) {
155154
!controlled &&
156155
!didWarnControlledToUncontrolled
157156
) {
158-
warning(
157+
console.error(
159158
'A component is changing a controlled input of type %s to be uncontrolled. ' +
160159
'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
161160
'Decide between using a controlled or uncontrolled input ' +

0 commit comments

Comments
 (0)