@samitouri / QOS-React / commits / 82c7ca4cca

Add component stacks to some warnings (#13218)

Dan Abramov committed Jul 17, 2018 at 20:15 UTC 82c7ca4cca90976cd1230e03ea1a4372a4276e67
17 files changed +65 -110
packages/react-dom/src/__tests__/ReactDOMComponent-test.js
+8 -32
@@ -567,7 +567,6 @@ describe('ReactDOMComponent', () => {
567 }
568 }).toWarnDev(
569 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
570 - {withoutStack: true}, // TODO: add a stack
570 );
571 });
572
@@ -587,7 +586,6 @@ describe('ReactDOMComponent', () => {
586 }
587 }).toWarnDev(
588 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
590 - {withoutStack: true}, // TODO: add a stack
589 );
590 });
591
@@ -1006,7 +1004,6 @@ describe('ReactDOMComponent', () => {
1004 '<BR /> is using incorrect casing. ' +
1005 'Use PascalCase for React components, ' +
1006 'or lowercase for HTML elements.',
1009 - {withoutStack: true}, // TODO: add a stack
1007 );
1008 expect(returnedValue).not.toContain('</BR>');
1009 });
@@ -1023,7 +1020,6 @@ describe('ReactDOMComponent', () => {
1020 '<IMG /> is using incorrect casing. ' +
1021 'Use PascalCase for React components, ' +
1022 'or lowercase for HTML elements.',
1026 - {withoutStack: true}, // TODO: add a stack
1023 );
1024 });
1025
@@ -1033,7 +1029,6 @@ describe('ReactDOMComponent', () => {
1029 ).toWarnDev(
1030 'The `aria` attribute is reserved for future use in React. ' +
1031 'Pass individual `aria-` attributes instead.',
1036 - {withoutStack: true}, // TODO: add a stack
1032 );
1033 });
1034
@@ -1056,12 +1051,10 @@ describe('ReactDOMComponent', () => {
1051
1052 expect(() => ReactTestUtils.renderIntoDocument(<bar />)).toWarnDev(
1053 'The tag <bar> is unrecognized in this browser',
1059 - {withoutStack: true}, // TODO: add a stack
1054 );
1055 // Test deduplication
1056 expect(() => ReactTestUtils.renderIntoDocument(<foo />)).toWarnDev(
1057 'The tag <foo> is unrecognized in this browser',
1064 - {withoutStack: true}, // TODO: add a stack
1058 );
1059 ReactTestUtils.renderIntoDocument(<foo />);
1060 // This is a funny case.
@@ -1073,15 +1066,12 @@ describe('ReactDOMComponent', () => {
1066 // Corner case. Make sure out deduplication logic doesn't break with weird tag.
1067 expect(() =>
1068 ReactTestUtils.renderIntoDocument(<hasOwnProperty />),
1076 - ).toWarnDev(
1077 - [
1078 - '<hasOwnProperty /> is using incorrect casing. ' +
1079 - 'Use PascalCase for React components, ' +
1080 - 'or lowercase for HTML elements.',
1081 - 'The tag <hasOwnProperty> is unrecognized in this browser',
1082 - ],
1083 - {withoutStack: true}, // TODO: add a stack
1084 - );
1069 + ).toWarnDev([
1070 + '<hasOwnProperty /> is using incorrect casing. ' +
1071 + 'Use PascalCase for React components, ' +
1072 + 'or lowercase for HTML elements.',
1073 + 'The tag <hasOwnProperty> is unrecognized in this browser',
1074 + ]);
1075 } finally {
1076 Object.prototype.toString = realToString; // eslint-disable-line no-extend-native
1077 }
@@ -1140,7 +1130,6 @@ describe('ReactDOMComponent', () => {
1130 expect(() => ReactDOM.render(<ShadyComponent />, node)).toWarnDev(
1131 'ShadyComponent is using shady DOM. Using shady DOM with React can ' +
1132 'cause things to break subtly.',
1143 - {withoutStack: true}, // TODO: add a stack
1133 );
1134 mountComponent({is: 'custom-shady-div2'});
1135 } finally {
@@ -1161,7 +1150,6 @@ describe('ReactDOMComponent', () => {
1150 expect(() => mountComponent({is: 'custom-shady-div'})).toWarnDev(
1151 'A component is using shady DOM. Using shady DOM with React can ' +
1152 'cause things to break subtly.',
1164 - {withoutStack: true}, // TODO: add a stack
1153 );
1154
1155 // No additional warnings are expected
@@ -1209,17 +1197,13 @@ describe('ReactDOMComponent', () => {
1197 it('should validate against use of innerHTML', () => {
1198 expect(() =>
1199 mountComponent({innerHTML: '<span>Hi Jim!</span>'}),
1212 - ).toWarnDev('Directly setting property `innerHTML` is not permitted. ', {
1213 - withoutStack: true, // TODO: add a stack
1214 - });
1200 + ).toWarnDev('Directly setting property `innerHTML` is not permitted. ');
1201 });
1202
1203 it('should validate against use of innerHTML without case sensitivity', () => {
1204 expect(() =>
1205 mountComponent({innerhtml: '<span>Hi Jim!</span>'}),
1220 - ).toWarnDev('Directly setting property `innerHTML` is not permitted. ', {
1221 - withoutStack: true, // TODO: add a stack
1222 - });
1206 + ).toWarnDev('Directly setting property `innerHTML` is not permitted. ');
1207 });
1208
1209 it('should validate use of dangerouslySetInnerHTML', () => {
@@ -1812,13 +1796,11 @@ describe('ReactDOMComponent', () => {
1796 ReactTestUtils.renderIntoDocument(<div onFocusIn={() => {}} />),
1797 ).toWarnDev(
1798 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1815 - {withoutStack: true}, // TODO: add a stack
1799 );
1800 expect(() =>
1801 ReactTestUtils.renderIntoDocument(<div onFocusOut={() => {}} />),
1802 ).toWarnDev(
1803 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1821 - {withoutStack: true}, // TODO: add a stack
1804 );
1805 });
1806
@@ -1828,13 +1810,11 @@ describe('ReactDOMComponent', () => {
1810 ReactTestUtils.renderIntoDocument(<div onfocusin={() => {}} />),
1811 ).toWarnDev(
1812 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1831 - {withoutStack: true}, // TODO: add a stack
1813 );
1814 expect(() =>
1815 ReactTestUtils.renderIntoDocument(<div onfocusout={() => {}} />),
1816 ).toWarnDev(
1817 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1837 - {withoutStack: true}, // TODO: add a stack
1818 );
1819 });
1820
@@ -1844,13 +1824,11 @@ describe('ReactDOMComponent', () => {
1824 ReactDOMServer.renderToString(<div onFocusIn={() => {}} />),
1825 ).toWarnDev(
1826 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1847 - {withoutStack: true}, // TODO: add a stack
1827 );
1828 expect(() =>
1829 ReactDOMServer.renderToString(<div onFocusOut={() => {}} />),
1830 ).toWarnDev(
1831 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1853 - {withoutStack: true}, // TODO: add a stack
1832 );
1833 });
1834
@@ -1860,13 +1838,11 @@ describe('ReactDOMComponent', () => {
1838 ReactDOMServer.renderToString(<div onfocusin={() => {}} />),
1839 ).toWarnDev(
1840 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1863 - {withoutStack: true}, // TODO: add a stack
1841 );
1842 expect(() =>
1843 ReactDOMServer.renderToString(<div onfocusout={() => {}} />),
1844 ).toWarnDev(
1845 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1869 - {withoutStack: true}, // TODO: add a stack
1846 );
1847 });
1848
packages/react-dom/src/__tests__/ReactDOMInput-test.js
-2
@@ -930,7 +930,6 @@ describe('ReactDOMInput', () => {
930 'both). Decide between using a controlled or uncontrolled input ' +
931 'element and remove one of these props. More info: ' +
932 'https://fb.me/react-controlled-components',
933 - {withoutStack: true}, // TODO: add a stack
933 );
934 ReactDOM.unmountComponentAtNode(container);
935
@@ -958,7 +957,6 @@ describe('ReactDOMInput', () => {
957 'both). Decide between using a controlled or uncontrolled input ' +
958 'element and remove one of these props. More info: ' +
959 'https://fb.me/react-controlled-components',
961 - {withoutStack: true}, // TODO: add a stack
960 );
961 ReactDOM.unmountComponentAtNode(container);
962
packages/react-dom/src/__tests__/ReactDOMSelect-test.js
+8 -13
@@ -566,25 +566,21 @@ describe('ReactDOMSelect', () => {
566 });
567
568 it('should warn if selected is set on <option>', () => {
569 - expect(() =>
570 - ReactTestUtils.renderIntoDocument(
569 + function App() {
570 + return (
571 <select>
572 <option selected={true} />
573 <option selected={true} />
574 - </select>,
575 - ),
576 - ).toWarnDev(
574 + </select>
575 + );
576 + }
577 +
578 + expect(() => ReactTestUtils.renderIntoDocument(<App />)).toWarnDev(
579 'Use the `defaultValue` or `value` props on <select> instead of ' +
580 'setting `selected` on <option>.',
579 - {withoutStack: true}, // TODO: add a stack
581 );
582
582 - ReactTestUtils.renderIntoDocument(
583 - <select>
584 - <option selected={true} />
585 - <option selected={true} />
586 - </select>,
587 - );
583 + ReactTestUtils.renderIntoDocument(<App />);
584 });
585
586 it('should warn if value is null and multiple is true', () => {
@@ -647,7 +643,6 @@ describe('ReactDOMSelect', () => {
643 'both). Decide between using a controlled or uncontrolled select ' +
644 'element and remove one of these props. More info: ' +
645 'https://fb.me/react-controlled-components',
650 - {withoutStack: true}, // TODO: add a stack
646 );
647
648 ReactTestUtils.renderIntoDocument(
packages/react-dom/src/__tests__/ReactDOMServerIntegrationAttributes-test.js
+1 -3
@@ -598,9 +598,7 @@ describe('ReactDOMServerIntegration', () => {
598 // so that it gets deduplicated later, and doesn't fail the test.
599 expect(() => {
600 ReactDOM.render(<nonstandard />, document.createElement('div'));
601 - }).toWarnDev('The tag <nonstandard> is unrecognized in this browser.', {
602 - withoutStack: true, // TODO: add a stack
603 - });
601 + }).toWarnDev('The tag <nonstandard> is unrecognized in this browser.');
602
603 const e = await render(<nonstandard foo="bar" />);
604 expect(e.getAttribute('foo')).toBe('bar');
packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js
+1 -3
@@ -142,9 +142,7 @@ describe('ReactDOMServerIntegration', () => {
142 // so that it gets deduplicated later, and doesn't fail the test.
143 expect(() => {
144 ReactDOM.render(<nonstandard />, document.createElement('div'));
145 - }).toWarnDev('The tag <nonstandard> is unrecognized in this browser.', {
146 - withoutStack: true, // TODO: add a stack
147 - });
145 + }).toWarnDev('The tag <nonstandard> is unrecognized in this browser.');
146
147 const e = await render(<nonstandard>Text</nonstandard>);
148 expect(e.tagName).toBe('NONSTANDARD');
packages/react-dom/src/__tests__/ReactDOMTextarea-test.js
-7
@@ -267,7 +267,6 @@ describe('ReactDOMTextarea', () => {
267 node = renderTextarea(stub, container);
268 }).toWarnDev(
269 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
270 - {withoutStack: true}, // TODO: add a stack
270 );
271
272 expect(node.value).toBe('giraffe');
@@ -320,7 +319,6 @@ describe('ReactDOMTextarea', () => {
319 node = renderTextarea(<textarea>{17}</textarea>);
320 }).toWarnDev(
321 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
323 - {withoutStack: true}, // TODO: add a stack
322 );
323 expect(node.value).toBe('17');
324 });
@@ -331,7 +329,6 @@ describe('ReactDOMTextarea', () => {
329 node = renderTextarea(<textarea>{false}</textarea>);
330 }).toWarnDev(
331 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
334 - {withoutStack: true}, // TODO: add a stack
332 );
333 expect(node.value).toBe('false');
334 });
@@ -347,7 +344,6 @@ describe('ReactDOMTextarea', () => {
344 node = renderTextarea(<textarea>{obj}</textarea>);
345 }).toWarnDev(
346 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
350 - {withoutStack: true}, // TODO: add a stack
347 );
348 expect(node.value).toBe('sharkswithlasers');
349 });
@@ -363,7 +359,6 @@ describe('ReactDOMTextarea', () => {
359 ),
360 ).toWarnDev(
361 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
366 - {withoutStack: true}, // TODO: add a stack
362 );
363 }).toThrow();
364
@@ -378,7 +373,6 @@ describe('ReactDOMTextarea', () => {
373 )),
374 ).toWarnDev(
375 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
381 - {withoutStack: true}, // TODO: add a stack
376 );
377 }).not.toThrow();
378
@@ -415,7 +409,6 @@ describe('ReactDOMTextarea', () => {
409 'both). Decide between using a controlled or uncontrolled textarea ' +
410 'and remove one of these props. More info: ' +
411 'https://fb.me/react-controlled-components',
418 - {withoutStack: true}, // TODO: add a stack
412 );
413
414 // No additional warnings are expected
packages/react-dom/src/__tests__/ReactServerRendering-test.js
+9 -12
@@ -601,18 +601,15 @@ describe('ReactDOMServer', () => {
601 </svg>
602 </div>,
603 ),
604 - ).toWarnDev(
605 - [
606 - 'Warning: <inPUT /> is using incorrect casing. ' +
607 - 'Use PascalCase for React components, ' +
608 - 'or lowercase for HTML elements.',
609 - // linearGradient doesn't warn
610 - 'Warning: <iFrame /> is using incorrect casing. ' +
611 - 'Use PascalCase for React components, ' +
612 - 'or lowercase for HTML elements.',
613 - ],
614 - {withoutStack: true},
615 - );
604 + ).toWarnDev([
605 + 'Warning: <inPUT /> is using incorrect casing. ' +
606 + 'Use PascalCase for React components, ' +
607 + 'or lowercase for HTML elements.',
608 + // linearGradient doesn't warn
609 + 'Warning: <iFrame /> is using incorrect casing. ' +
610 + 'Use PascalCase for React components, ' +
611 + 'or lowercase for HTML elements.',
612 + ]);
613 });
614
615 it('should warn about contentEditable and children', () => {
packages/react-dom/src/client/ReactDOMFiberComponent.js
+4 -4
@@ -353,7 +353,7 @@ export function createElement(
353 isCustomComponentTag = isCustomComponent(type, props);
354 // Should this check be gated by parent namespace? Not sure we want to
355 // allow <SVG> or <mATH>.
356 - warningWithoutStack(
356 + warning(
357 isCustomComponentTag || type === type.toLowerCase(),
358 '<%s /> is using incorrect casing. ' +
359 'Use PascalCase for React components, ' +
@@ -392,7 +392,7 @@ export function createElement(
392 !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)
393 ) {
394 warnedUnknownTags[type] = true;
395 - warningWithoutStack(
395 + warning(
396 false,
397 'The tag <%s> is unrecognized in this browser. ' +
398 'If you meant to render a React component, start its name with ' +
@@ -429,7 +429,7 @@ export function setInitialProperties(
429 !didWarnShadyDOM &&
430 (domElement: any).shadyRoot
431 ) {
432 - warningWithoutStack(
432 + warning(
433 false,
434 '%s is using shady DOM. Using shady DOM with React can ' +
435 'cause things to break subtly.',
@@ -821,7 +821,7 @@ export function diffHydratedProperties(
821 !didWarnShadyDOM &&
822 (domElement: any).shadyRoot
823 ) {
824 - warningWithoutStack(
824 + warning(
825 false,
826 '%s is using shady DOM. Using shady DOM with React can ' +
827 'cause things to break subtly.',
packages/react-dom/src/client/ReactDOMFiberInput.js
+2 -3
@@ -11,7 +11,6 @@
11 import {getCurrentFiberOwnerNameInDevOrNull} from 'react-reconciler/src/ReactCurrentFiber';
12 import invariant from 'shared/invariant';
13 import warning from 'shared/warning';
14 -import warningWithoutStack from 'shared/warningWithoutStack';
14
15 import * as DOMPropertyOperations from './DOMPropertyOperations';
16 import {getFiberCurrentPropsFromNode} from './ReactDOMComponentTree';
@@ -76,7 +75,7 @@ export function initWrapperState(element: Element, props: Object) {
75 props.defaultChecked !== undefined &&
76 !didWarnCheckedDefaultChecked
77 ) {
79 - warningWithoutStack(
78 + warning(
79 false,
80 '%s contains an input of type %s with both checked and defaultChecked props. ' +
81 'Input elements must be either controlled or uncontrolled ' +
@@ -94,7 +93,7 @@ export function initWrapperState(element: Element, props: Object) {
93 props.defaultValue !== undefined &&
94 !didWarnValueDefaultValue
95 ) {
97 - warningWithoutStack(
96 + warning(
97 false,
98 '%s contains an input of type %s with both value and defaultValue props. ' +
99 'Input elements must be either controlled or uncontrolled ' +
packages/react-dom/src/client/ReactDOMFiberOption.js
+2 -2
@@ -8,7 +8,7 @@
8 */
9
10 import React from 'react';
11 -import warningWithoutStack from 'shared/warningWithoutStack';
11 +import warning from 'shared/warning';
12
13 let didWarnSelectedSetOnOption = false;
14
@@ -39,7 +39,7 @@ export function validateProps(element: Element, props: Object) {
39 // TODO (yungsters): Remove support for `selected` in <option>.
40 if (__DEV__) {
41 if (props.selected != null && !didWarnSelectedSetOnOption) {
42 - warningWithoutStack(
42 + warning(
43 false,
44 'Use the `defaultValue` or `value` props on <select> instead of ' +
45 'setting `selected` on <option>.',
packages/react-dom/src/client/ReactDOMFiberSelect.js
+4 -4
@@ -9,7 +9,7 @@
9
10 // TODO: direct imports like some-package/src/* are bad. Fix me.
11 import {getCurrentFiberOwnerNameInDevOrNull} from 'react-reconciler/src/ReactCurrentFiber';
12 -import warningWithoutStack from 'shared/warningWithoutStack';
12 +import warning from 'shared/warning';
13
14 import ReactControlledValuePropTypes from '../shared/ReactControlledValuePropTypes';
15
@@ -49,7 +49,7 @@ function checkSelectPropTypes(props) {
49 }
50 const isArray = Array.isArray(props[propName]);
51 if (props.multiple && !isArray) {
52 - warningWithoutStack(
52 + warning(
53 false,
54 'The `%s` prop supplied to <select> must be an array if ' +
55 '`multiple` is true.%s',
@@ -57,7 +57,7 @@ function checkSelectPropTypes(props) {
57 getDeclarationErrorAddendum(),
58 );
59 } else if (!props.multiple && isArray) {
60 - warningWithoutStack(
60 + warning(
61 false,
62 'The `%s` prop supplied to <select> must be a scalar ' +
63 'value if `multiple` is false.%s',
@@ -158,7 +158,7 @@ export function initWrapperState(element: Element, props: Object) {
158 props.defaultValue !== undefined &&
159 !didWarnValueDefaultValue
160 ) {
161 - warningWithoutStack(
161 + warning(
162 false,
163 'Select elements must be either controlled or uncontrolled ' +
164 '(specify either the value prop, or the defaultValue prop, but not ' +
packages/react-dom/src/client/ReactDOMFiberTextarea.js
+3 -3
@@ -8,7 +8,7 @@
8 */
9
10 import invariant from 'shared/invariant';
11 -import warningWithoutStack from 'shared/warningWithoutStack';
11 +import warning from 'shared/warning';
12
13 import ReactControlledValuePropTypes from '../shared/ReactControlledValuePropTypes';
14
@@ -68,7 +68,7 @@ export function initWrapperState(element: Element, props: Object) {
68 props.defaultValue !== undefined &&
69 !didWarnValDefaultVal
70 ) {
71 - warningWithoutStack(
71 + warning(
72 false,
73 'Textarea elements must be either controlled or uncontrolled ' +
74 '(specify either the value prop, or the defaultValue prop, but not ' +
@@ -89,7 +89,7 @@ export function initWrapperState(element: Element, props: Object) {
89 let children = props.children;
90 if (children != null) {
91 if (__DEV__) {
92 - warningWithoutStack(
92 + warning(
93 false,
94 'Use the `defaultValue` or `value` props instead of setting ' +
95 'children on <textarea>.',
packages/react-dom/src/server/ReactPartialRenderer.js
+11 -12
@@ -18,6 +18,7 @@ import React from 'react';
18 import invariant from 'shared/invariant';
19 import getComponentName from 'shared/getComponentName';
20 import lowPriorityWarning from 'shared/lowPriorityWarning';
21 +import warning from 'shared/warning';
22 import warningWithoutStack from 'shared/warningWithoutStack';
23 import checkPropTypes from 'prop-types/checkPropTypes';
24 import describeComponentFrame from 'shared/describeComponentFrame';
@@ -1022,7 +1023,7 @@ class ReactDOMServerRenderer {
1023 if (namespace === Namespaces.html) {
1024 // Should this check be gated by parent namespace? Not sure we want to
1025 // allow <SVG> or <mATH>.
1025 - warningWithoutStack(
1026 + warning(
1027 tag === element.type,
1028 '<%s /> is using incorrect casing. ' +
1029 'Use PascalCase for React components, ' +
@@ -1044,7 +1045,7 @@ class ReactDOMServerRenderer {
1045 props.defaultChecked !== undefined &&
1046 !didWarnDefaultChecked
1047 ) {
1047 - warningWithoutStack(
1048 + warning(
1049 false,
1050 '%s contains an input of type %s with both checked and defaultChecked props. ' +
1051 'Input elements must be either controlled or uncontrolled ' +
@@ -1062,7 +1063,7 @@ class ReactDOMServerRenderer {
1063 props.defaultValue !== undefined &&
1064 !didWarnDefaultInputValue
1065 ) {
1065 - warningWithoutStack(
1066 + warning(
1067 false,
1068 '%s contains an input of type %s with both value and defaultValue props. ' +
1069 'Input elements must be either controlled or uncontrolled ' +
@@ -1097,7 +1098,7 @@ class ReactDOMServerRenderer {
1098 props.defaultValue !== undefined &&
1099 !didWarnDefaultTextareaValue
1100 ) {
1100 - warningWithoutStack(
1101 + warning(
1102 false,
1103 'Textarea elements must be either controlled or uncontrolled ' +
1104 '(specify either the value prop, or the defaultValue prop, but not ' +
@@ -1116,7 +1117,7 @@ class ReactDOMServerRenderer {
1117 let textareaChildren = props.children;
1118 if (textareaChildren != null) {
1119 if (__DEV__) {
1119 - warningWithoutStack(
1120 + warning(
1121 false,
1122 'Use the `defaultValue` or `value` props instead of setting ' +
1123 'children on <textarea>.',
@@ -1157,20 +1158,18 @@ class ReactDOMServerRenderer {
1158 }
1159 const isArray = Array.isArray(props[propName]);
1160 if (props.multiple && !isArray) {
1160 - warningWithoutStack(
1161 + warning(
1162 false,
1163 'The `%s` prop supplied to <select> must be an array if ' +
1163 - '`multiple` is true.%s',
1164 + '`multiple` is true.',
1165 propName,
1165 - '', // getDeclarationErrorAddendum(),
1166 );
1167 } else if (!props.multiple && isArray) {
1168 - warningWithoutStack(
1168 + warning(
1169 false,
1170 'The `%s` prop supplied to <select> must be a scalar ' +
1171 - 'value if `multiple` is false.%s',
1171 + 'value if `multiple` is false.',
1172 propName,
1173 - '', // getDeclarationErrorAddendum(),
1173 );
1174 }
1175 }
@@ -1180,7 +1179,7 @@ class ReactDOMServerRenderer {
1179 props.defaultValue !== undefined &&
1180 !didWarnDefaultSelectValue
1181 ) {
1183 - warningWithoutStack(
1182 + warning(
1183 false,
1184 'Select elements must be either controlled or uncontrolled ' +
1185 '(specify either the value prop, or the defaultValue prop, but not ' +
packages/react-dom/src/shared/DOMProperty.js
+2 -2
@@ -7,7 +7,7 @@
7 * @flow
8 */
9
10 -import warningWithoutStack from 'shared/warningWithoutStack';
10 +import warning from 'shared/warning';
11
12 type PropertyType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
13
@@ -82,7 +82,7 @@ export function isAttributeNameSafe(attributeName: string): boolean {
82 }
83 illegalAttributeNameCache[attributeName] = true;
84 if (__DEV__) {
85 - warningWithoutStack(false, 'Invalid attribute name: `%s`', attributeName);
85 + warning(false, 'Invalid attribute name: `%s`', attributeName);
86 }
87 return false;
88 }
packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.js
+3 -4
@@ -10,7 +10,6 @@ import {
10 possibleRegistrationNames,
11 } from 'events/EventPluginRegistry';
12 import warning from 'shared/warning';
13 -import warningWithoutStack from 'shared/warningWithoutStack';
13
14 import {
15 ATTRIBUTE_NAME_CHAR,
@@ -38,7 +37,7 @@ if (__DEV__) {
37
38 const lowerCasedName = name.toLowerCase();
39 if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
41 - warningWithoutStack(
40 + warning(
41 false,
42 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' +
43 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' +
@@ -99,7 +98,7 @@ if (__DEV__) {
98 }
99
100 if (lowerCasedName === 'innerhtml') {
102 - warningWithoutStack(
101 + warning(
102 false,
103 'Directly setting property `innerHTML` is not permitted. ' +
104 'For more information, lookup documentation on `dangerouslySetInnerHTML`.',
@@ -109,7 +108,7 @@ if (__DEV__) {
108 }
109
110 if (lowerCasedName === 'aria') {
112 - warningWithoutStack(
111 + warning(
112 false,
113 'The `aria` attribute is reserved for future use in React. ' +
114 'Pass individual `aria-` attributes instead.',
packages/react-reconciler/src/ReactFiberBeginWork.js
+1 -1
@@ -976,7 +976,7 @@ function updateContextProvider(current, workInProgress, renderExpirationTime) {
976 ? context._calculateChangedBits(oldValue, newValue)
977 : MAX_SIGNED_31_BIT_INT;
978 if (__DEV__) {
979 - warningWithoutStack(
979 + warning(
980 (changedBits & MAX_SIGNED_31_BIT_INT) === changedBits,
981 'calculateChangedBits: Expected the return value to be a ' +
982 '31-bit integer. Instead received: %s',
packages/react-reconciler/src/__tests__/ReactNewContext-test.internal.js
+6 -3
@@ -706,15 +706,18 @@ describe('ReactNewContext', () => {
706 (a, b) => Math.pow(2, 32) - 1, // Return 32 bit int
707 );
708
709 - ReactNoop.render(<Context.Provider value={1} />);
709 + function App(props) {
710 + return <Context.Provider value={props.value} />;
711 + }
712 +
713 + ReactNoop.render(<App value={1} />);
714 ReactNoop.flush();
715
716 // Update
713 - ReactNoop.render(<Context.Provider value={2} />);
717 + ReactNoop.render(<App value={2} />);
718 expect(ReactNoop.flush).toWarnDev(
719 'calculateChangedBits: Expected the return value to be a 31-bit ' +
720 'integer. Instead received: 4294967295',
717 - {withoutStack: true}, // TODO: add a stack
721 );
722 });
723