@samitouri / QOS-React-1 / commits / 67cc9ba878

Fix: error messages (#27523)

<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. Before submitting a pull request, please make sure the following is done: 1. Fork [the repository](https://github.com/facebook/react) and create your branch from `main`. 2. Run `yarn` in the repository root. 3. If you've fixed a bug or added code that should be tested, add tests! 4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development. 5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`. 6. If you need a debugger, run `yarn test --debug --watch TestName`, open `chrome://inspect`, and press "Inspect". 7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`). 8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files. 9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`). 10. If you haven't already, complete the CLA. Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html --> ## Summary Changes `before before` to `before` in error messages. <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> I want to improve error logs ## How did you test this change? <!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. How exactly did you verify that your PR solves the issue you wanted to solve? If you leave this empty, your PR will very likely be closed. -->

Asan Azimkulov committed Oct 16, 2023 at 20:05 UTC 67cc9ba8789335b9da0838a446137c1be62adbcd
7 files changed +25 -25
packages/react-dom/src/__tests__/ReactDOMAttribute-test.js
+1 -1
@@ -106,7 +106,7 @@ describe('ReactDOM unknown attribute', () => {
106 expect(test).toThrowError(new TypeError('prod message')),
107 ).toErrorDev(
108 'Warning: The provided `unknown` attribute is an unsupported type TemporalLike.' +
109 - ' This value must be coerced to a string before before using it here.',
109 + ' This value must be coerced to a string before using it here.',
110 );
111 });
112
packages/react-dom/src/__tests__/ReactDOMComponent-test.js
+1 -1
@@ -276,7 +276,7 @@ describe('ReactDOMComponent', () => {
276 expect(test).toThrowError(new TypeError('prod message')),
277 ).toErrorDev(
278 'Warning: The provided `fontSize` CSS property is an unsupported type TemporalLike.' +
279 - ' This value must be coerced to a string before before using it here.',
279 + ' This value must be coerced to a string before using it here.',
280 );
281 });
282
packages/react-dom/src/__tests__/ReactDOMInput-test.js
+4 -4
@@ -631,7 +631,7 @@ describe('ReactDOMInput', () => {
631 expect(test).toThrowError(new TypeError('prod message')),
632 ).toErrorDev(
633 'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
634 - 'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
634 + 'strings, not TemporalLike. This value must be coerced to a string before using it here.',
635 );
636 });
637
@@ -655,7 +655,7 @@ describe('ReactDOMInput', () => {
655 expect(test).toThrowError(new TypeError('prod message')),
656 ).toErrorDev(
657 'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
658 - 'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
658 + 'strings, not TemporalLike. This value must be coerced to a string before using it here.',
659 );
660 });
661
@@ -679,7 +679,7 @@ describe('ReactDOMInput', () => {
679 expect(test).toThrowError(new TypeError('prod message')),
680 ).toErrorDev(
681 'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
682 - 'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
682 + 'strings, not TemporalLike. This value must be coerced to a string before using it here.',
683 );
684 });
685
@@ -703,7 +703,7 @@ describe('ReactDOMInput', () => {
703 expect(test).toThrowError(new TypeError('prod message')),
704 ).toErrorDev(
705 'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
706 - 'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
706 + 'strings, not TemporalLike. This value must be coerced to a string before using it here.',
707 );
708 });
709
packages/react-dom/src/__tests__/ReactDOMSelect-test.js
+11 -11
@@ -1054,7 +1054,7 @@ describe('ReactDOMSelect', () => {
1054 ).toErrorDev(
1055 'Form field values (value, checked, defaultValue, or defaultChecked props)' +
1056 ' must be strings, not TemporalLike. ' +
1057 - 'This value must be coerced to a string before before using it here.',
1057 + 'This value must be coerced to a string before using it here.',
1058 );
1059 });
1060
@@ -1074,7 +1074,7 @@ describe('ReactDOMSelect', () => {
1074 expect(test).toThrowError(new TypeError('prod message')),
1075 ).toErrorDev(
1076 'The provided `value` attribute is an unsupported type TemporalLike.' +
1077 - ' This value must be coerced to a string before before using it here.',
1077 + ' This value must be coerced to a string before using it here.',
1078 );
1079 });
1080
@@ -1094,7 +1094,7 @@ describe('ReactDOMSelect', () => {
1094 expect(test).toThrowError(new TypeError('prod message')),
1095 ).toErrorDev(
1096 'The provided `value` attribute is an unsupported type TemporalLike.' +
1097 - ' This value must be coerced to a string before before using it here.',
1097 + ' This value must be coerced to a string before using it here.',
1098 );
1099 });
1100
@@ -1120,7 +1120,7 @@ describe('ReactDOMSelect', () => {
1120 ).toErrorDev(
1121 'Form field values (value, checked, defaultValue, or defaultChecked props)' +
1122 ' must be strings, not TemporalLike. ' +
1123 - 'This value must be coerced to a string before before using it here.',
1123 + 'This value must be coerced to a string before using it here.',
1124 );
1125 });
1126
@@ -1147,7 +1147,7 @@ describe('ReactDOMSelect', () => {
1147 expect(test).toThrowError(new TypeError('prod message')),
1148 ).toErrorDev(
1149 'The provided `value` attribute is an unsupported type TemporalLike.' +
1150 - ' This value must be coerced to a string before before using it here.',
1150 + ' This value must be coerced to a string before using it here.',
1151 );
1152 });
1153
@@ -1174,7 +1174,7 @@ describe('ReactDOMSelect', () => {
1174 expect(test).toThrowError(new TypeError('prod message')),
1175 ).toErrorDev(
1176 'The provided `value` attribute is an unsupported type TemporalLike.' +
1177 - ' This value must be coerced to a string before before using it here.',
1177 + ' This value must be coerced to a string before using it here.',
1178 );
1179 });
1180
@@ -1193,7 +1193,7 @@ describe('ReactDOMSelect', () => {
1193 ).toErrorDev(
1194 'Form field values (value, checked, defaultValue, or defaultChecked props)' +
1195 ' must be strings, not TemporalLike. ' +
1196 - 'This value must be coerced to a string before before using it here.',
1196 + 'This value must be coerced to a string before using it here.',
1197 );
1198 });
1199
@@ -1213,7 +1213,7 @@ describe('ReactDOMSelect', () => {
1213 expect(test).toThrowError(new TypeError('prod message')),
1214 ).toErrorDev(
1215 'The provided `value` attribute is an unsupported type TemporalLike.' +
1216 - ' This value must be coerced to a string before before using it here.',
1216 + ' This value must be coerced to a string before using it here.',
1217 );
1218 });
1219
@@ -1233,7 +1233,7 @@ describe('ReactDOMSelect', () => {
1233 expect(test).toThrowError(new TypeError('prod message')),
1234 ).toErrorDev(
1235 'The provided `value` attribute is an unsupported type TemporalLike.' +
1236 - ' This value must be coerced to a string before before using it here.',
1236 + ' This value must be coerced to a string before using it here.',
1237 );
1238 });
1239
@@ -1259,7 +1259,7 @@ describe('ReactDOMSelect', () => {
1259 ).toErrorDev(
1260 'Form field values (value, checked, defaultValue, or defaultChecked props)' +
1261 ' must be strings, not TemporalLike. ' +
1262 - 'This value must be coerced to a string before before using it here.',
1262 + 'This value must be coerced to a string before using it here.',
1263 );
1264 });
1265
@@ -1286,7 +1286,7 @@ describe('ReactDOMSelect', () => {
1286 expect(test).toThrowError(new TypeError('prod message')),
1287 ).toErrorDev(
1288 'The provided `value` attribute is an unsupported type TemporalLike.' +
1289 - ' This value must be coerced to a string before before using it here.',
1289 + ' This value must be coerced to a string before using it here.',
1290 );
1291 });
1292 });
packages/react-dom/src/__tests__/ReactDOMTextarea-test.js
+1 -1
@@ -251,7 +251,7 @@ describe('ReactDOMTextarea', () => {
251 expect(test).toThrowError(new TypeError('prod message')),
252 ).toErrorDev(
253 'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
254 - 'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
254 + 'strings, not TemporalLike. This value must be coerced to a string before using it here.',
255 );
256 });
257
packages/react-dom/src/__tests__/ReactIdentity-test.js
+1 -1
@@ -288,7 +288,7 @@ describe('ReactIdentity', () => {
288 expect(test).toThrowError(new TypeError('prod message')),
289 ).toErrorDev(
290 'The provided key is an unsupported type TemporalLike.' +
291 - ' This value must be coerced to a string before before using it here.',
291 + ' This value must be coerced to a string before using it here.',
292 {withoutStack: true},
293 );
294 });
packages/shared/CheckStringCoercion.js
+6 -6
@@ -78,7 +78,7 @@ export function checkAttributeStringCoercion(
78 if (willCoercionThrow(value)) {
79 console.error(
80 'The provided `%s` attribute is an unsupported type %s.' +
81 - ' This value must be coerced to a string before before using it here.',
81 + ' This value must be coerced to a string before using it here.',
82 attributeName,
83 typeName(value),
84 );
@@ -92,7 +92,7 @@ export function checkKeyStringCoercion(value: mixed): void | string {
92 if (willCoercionThrow(value)) {
93 console.error(
94 'The provided key is an unsupported type %s.' +
95 - ' This value must be coerced to a string before before using it here.',
95 + ' This value must be coerced to a string before using it here.',
96 typeName(value),
97 );
98 return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
@@ -108,7 +108,7 @@ export function checkPropStringCoercion(
108 if (willCoercionThrow(value)) {
109 console.error(
110 'The provided `%s` prop is an unsupported type %s.' +
111 - ' This value must be coerced to a string before before using it here.',
111 + ' This value must be coerced to a string before using it here.',
112 propName,
113 typeName(value),
114 );
@@ -125,7 +125,7 @@ export function checkCSSPropertyStringCoercion(
125 if (willCoercionThrow(value)) {
126 console.error(
127 'The provided `%s` CSS property is an unsupported type %s.' +
128 - ' This value must be coerced to a string before before using it here.',
128 + ' This value must be coerced to a string before using it here.',
129 propName,
130 typeName(value),
131 );
@@ -139,7 +139,7 @@ export function checkHtmlStringCoercion(value: mixed): void | string {
139 if (willCoercionThrow(value)) {
140 console.error(
141 'The provided HTML markup uses a value of unsupported type %s.' +
142 - ' This value must be coerced to a string before before using it here.',
142 + ' This value must be coerced to a string before using it here.',
143 typeName(value),
144 );
145 return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
@@ -153,7 +153,7 @@ export function checkFormFieldValueStringCoercion(value: mixed): void | string {
153 console.error(
154 'Form field values (value, checked, defaultValue, or defaultChecked props)' +
155 ' must be strings, not %s.' +
156 - ' This value must be coerced to a string before before using it here.',
156 + ' This value must be coerced to a string before using it here.',
157 typeName(value),
158 );
159 return testStringCoercion(value); // throw (to help callers find troubleshooting comments)