Skip to content

Commit

Permalink
Fix: error messages (facebook#27523)
Browse files Browse the repository at this point in the history
<!--
  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.
-->
  • Loading branch information
AsanAzimkulov authored and AndyPengc12 committed Apr 15, 2024
1 parent aed1eaf commit 621c4f5
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactDOMAttribute-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('ReactDOM unknown attribute', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'Warning: The provided `unknown` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ describe('ReactDOMComponent', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'Warning: The provided `fontSize` CSS property is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});

Expand Down
8 changes: 4 additions & 4 deletions packages/react-dom/src/__tests__/ReactDOMInput-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ describe('ReactDOMInput', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
'strings, not TemporalLike. This value must be coerced to a string before using it here.',
);
});

Expand All @@ -655,7 +655,7 @@ describe('ReactDOMInput', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
'strings, not TemporalLike. This value must be coerced to a string before using it here.',
);
});

Expand All @@ -679,7 +679,7 @@ describe('ReactDOMInput', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
'strings, not TemporalLike. This value must be coerced to a string before using it here.',
);
});

Expand All @@ -703,7 +703,7 @@ describe('ReactDOMInput', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
'strings, not TemporalLike. This value must be coerced to a string before using it here.',
);
});

Expand Down
22 changes: 11 additions & 11 deletions packages/react-dom/src/__tests__/ReactDOMSelect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ describe('ReactDOMSelect', () => {
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before before using it here.',
'This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1074,7 +1074,7 @@ describe('ReactDOMSelect', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1094,7 +1094,7 @@ describe('ReactDOMSelect', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1120,7 +1120,7 @@ describe('ReactDOMSelect', () => {
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before before using it here.',
'This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1147,7 +1147,7 @@ describe('ReactDOMSelect', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1174,7 +1174,7 @@ describe('ReactDOMSelect', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1193,7 +1193,7 @@ describe('ReactDOMSelect', () => {
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before before using it here.',
'This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1213,7 +1213,7 @@ describe('ReactDOMSelect', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1233,7 +1233,7 @@ describe('ReactDOMSelect', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1259,7 +1259,7 @@ describe('ReactDOMSelect', () => {
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not TemporalLike. ' +
'This value must be coerced to a string before before using it here.',
'This value must be coerced to a string before using it here.',
);
});

Expand All @@ -1286,7 +1286,7 @@ describe('ReactDOMSelect', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'The provided `value` attribute is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactDOMTextarea-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('ReactDOMTextarea', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'Form field values (value, checked, defaultValue, or defaultChecked props) must be ' +
'strings, not TemporalLike. This value must be coerced to a string before before using it here.',
'strings, not TemporalLike. This value must be coerced to a string before using it here.',
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactIdentity-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ describe('ReactIdentity', () => {
expect(test).toThrowError(new TypeError('prod message')),
).toErrorDev(
'The provided key is an unsupported type TemporalLike.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
{withoutStack: true},
);
});
Expand Down
12 changes: 6 additions & 6 deletions packages/shared/CheckStringCoercion.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function checkAttributeStringCoercion(
if (willCoercionThrow(value)) {
console.error(
'The provided `%s` attribute is an unsupported type %s.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
attributeName,
typeName(value),
);
Expand All @@ -92,7 +92,7 @@ export function checkKeyStringCoercion(value: mixed): void | string {
if (willCoercionThrow(value)) {
console.error(
'The provided key is an unsupported type %s.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
typeName(value),
);
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
Expand All @@ -108,7 +108,7 @@ export function checkPropStringCoercion(
if (willCoercionThrow(value)) {
console.error(
'The provided `%s` prop is an unsupported type %s.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
propName,
typeName(value),
);
Expand All @@ -125,7 +125,7 @@ export function checkCSSPropertyStringCoercion(
if (willCoercionThrow(value)) {
console.error(
'The provided `%s` CSS property is an unsupported type %s.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
propName,
typeName(value),
);
Expand All @@ -139,7 +139,7 @@ export function checkHtmlStringCoercion(value: mixed): void | string {
if (willCoercionThrow(value)) {
console.error(
'The provided HTML markup uses a value of unsupported type %s.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
typeName(value),
);
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
Expand All @@ -153,7 +153,7 @@ export function checkFormFieldValueStringCoercion(value: mixed): void | string {
console.error(
'Form field values (value, checked, defaultValue, or defaultChecked props)' +
' must be strings, not %s.' +
' This value must be coerced to a string before before using it here.',
' This value must be coerced to a string before using it here.',
typeName(value),
);
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
Expand Down

0 comments on commit 621c4f5

Please sign in to comment.