Skip to content

Commit 67cc9ba

Browse files
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. -->
1 parent 18a9dd1 commit 67cc9ba

7 files changed

+25
-25
lines changed

packages/react-dom/src/__tests__/ReactDOMAttribute-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('ReactDOM unknown attribute', () => {
106106
expect(test).toThrowError(new TypeError('prod message')),
107107
).toErrorDev(
108108
'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.',
110110
);
111111
});
112112

packages/react-dom/src/__tests__/ReactDOMComponent-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ describe('ReactDOMComponent', () => {
276276
expect(test).toThrowError(new TypeError('prod message')),
277277
).toErrorDev(
278278
'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.',
280280
);
281281
});
282282

packages/react-dom/src/__tests__/ReactDOMInput-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ describe('ReactDOMInput', () => {
631631
expect(test).toThrowError(new TypeError('prod message')),
632632
).toErrorDev(
633633
'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.',
635635
);
636636
});
637637

@@ -655,7 +655,7 @@ describe('ReactDOMInput', () => {
655655
expect(test).toThrowError(new TypeError('prod message')),
656656
).toErrorDev(
657657
'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.',
659659
);
660660
});
661661

@@ -679,7 +679,7 @@ describe('ReactDOMInput', () => {
679679
expect(test).toThrowError(new TypeError('prod message')),
680680
).toErrorDev(
681681
'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.',
683683
);
684684
});
685685

@@ -703,7 +703,7 @@ describe('ReactDOMInput', () => {
703703
expect(test).toThrowError(new TypeError('prod message')),
704704
).toErrorDev(
705705
'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.',
707707
);
708708
});
709709

packages/react-dom/src/__tests__/ReactDOMSelect-test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ describe('ReactDOMSelect', () => {
10541054
).toErrorDev(
10551055
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
10561056
' 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.',
10581058
);
10591059
});
10601060

@@ -1074,7 +1074,7 @@ describe('ReactDOMSelect', () => {
10741074
expect(test).toThrowError(new TypeError('prod message')),
10751075
).toErrorDev(
10761076
'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.',
10781078
);
10791079
});
10801080

@@ -1094,7 +1094,7 @@ describe('ReactDOMSelect', () => {
10941094
expect(test).toThrowError(new TypeError('prod message')),
10951095
).toErrorDev(
10961096
'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.',
10981098
);
10991099
});
11001100

@@ -1120,7 +1120,7 @@ describe('ReactDOMSelect', () => {
11201120
).toErrorDev(
11211121
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
11221122
' 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.',
11241124
);
11251125
});
11261126

@@ -1147,7 +1147,7 @@ describe('ReactDOMSelect', () => {
11471147
expect(test).toThrowError(new TypeError('prod message')),
11481148
).toErrorDev(
11491149
'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.',
11511151
);
11521152
});
11531153

@@ -1174,7 +1174,7 @@ describe('ReactDOMSelect', () => {
11741174
expect(test).toThrowError(new TypeError('prod message')),
11751175
).toErrorDev(
11761176
'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.',
11781178
);
11791179
});
11801180

@@ -1193,7 +1193,7 @@ describe('ReactDOMSelect', () => {
11931193
).toErrorDev(
11941194
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
11951195
' 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.',
11971197
);
11981198
});
11991199

@@ -1213,7 +1213,7 @@ describe('ReactDOMSelect', () => {
12131213
expect(test).toThrowError(new TypeError('prod message')),
12141214
).toErrorDev(
12151215
'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.',
12171217
);
12181218
});
12191219

@@ -1233,7 +1233,7 @@ describe('ReactDOMSelect', () => {
12331233
expect(test).toThrowError(new TypeError('prod message')),
12341234
).toErrorDev(
12351235
'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.',
12371237
);
12381238
});
12391239

@@ -1259,7 +1259,7 @@ describe('ReactDOMSelect', () => {
12591259
).toErrorDev(
12601260
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
12611261
' 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.',
12631263
);
12641264
});
12651265

@@ -1286,7 +1286,7 @@ describe('ReactDOMSelect', () => {
12861286
expect(test).toThrowError(new TypeError('prod message')),
12871287
).toErrorDev(
12881288
'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.',
12901290
);
12911291
});
12921292
});

packages/react-dom/src/__tests__/ReactDOMTextarea-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ describe('ReactDOMTextarea', () => {
251251
expect(test).toThrowError(new TypeError('prod message')),
252252
).toErrorDev(
253253
'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.',
255255
);
256256
});
257257

packages/react-dom/src/__tests__/ReactIdentity-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ describe('ReactIdentity', () => {
288288
expect(test).toThrowError(new TypeError('prod message')),
289289
).toErrorDev(
290290
'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.',
292292
{withoutStack: true},
293293
);
294294
});

packages/shared/CheckStringCoercion.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function checkAttributeStringCoercion(
7878
if (willCoercionThrow(value)) {
7979
console.error(
8080
'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.',
8282
attributeName,
8383
typeName(value),
8484
);
@@ -92,7 +92,7 @@ export function checkKeyStringCoercion(value: mixed): void | string {
9292
if (willCoercionThrow(value)) {
9393
console.error(
9494
'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.',
9696
typeName(value),
9797
);
9898
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
@@ -108,7 +108,7 @@ export function checkPropStringCoercion(
108108
if (willCoercionThrow(value)) {
109109
console.error(
110110
'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.',
112112
propName,
113113
typeName(value),
114114
);
@@ -125,7 +125,7 @@ export function checkCSSPropertyStringCoercion(
125125
if (willCoercionThrow(value)) {
126126
console.error(
127127
'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.',
129129
propName,
130130
typeName(value),
131131
);
@@ -139,7 +139,7 @@ export function checkHtmlStringCoercion(value: mixed): void | string {
139139
if (willCoercionThrow(value)) {
140140
console.error(
141141
'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.',
143143
typeName(value),
144144
);
145145
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
@@ -153,7 +153,7 @@ export function checkFormFieldValueStringCoercion(value: mixed): void | string {
153153
console.error(
154154
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
155155
' 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.',
157157
typeName(value),
158158
);
159159
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)

0 commit comments

Comments
 (0)