Rename 17 to 18 in warnings (#19031)

We're not really supposed to refer to future versions by numbers.

These will all slip so these numbers don't make sense anymore.
This commit is contained in:
Sebastian Markbåge 2020-05-28 10:25:39 -07:00 committed by GitHub
parent 86b4070ddb
commit 4985bb0a80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 29 additions and 29 deletions

View File

@ -27,6 +27,6 @@ export {
unstable_renderSubtreeIntoContainer, unstable_renderSubtreeIntoContainer,
// Disabled behind disableUnstableCreatePortal // Disabled behind disableUnstableCreatePortal
// Temporary alias since we already shipped React 16 RC with it. // Temporary alias since we already shipped React 16 RC with it.
// TODO: remove in React 17. // TODO: remove in React 18.
unstable_createPortal, unstable_createPortal,
} from './src/client/ReactDOM'; } from './src/client/ReactDOM';

View File

@ -19,6 +19,6 @@ export {
unmountComponentAtNode, unmountComponentAtNode,
unstable_renderSubtreeIntoContainer, unstable_renderSubtreeIntoContainer,
// Temporary alias since we already shipped React 16 RC with it. // Temporary alias since we already shipped React 16 RC with it.
// TODO: remove in React 17. // TODO: remove in React 18.
unstable_createPortal, unstable_createPortal,
} from './src/client/ReactDOM'; } from './src/client/ReactDOM';

View File

@ -1386,20 +1386,20 @@ describe('ReactComponentLifeCycle', () => {
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. `Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
* Move code with side effects to componentDidMount, and set initial state in the constructor. * Move code with side effects to componentDidMount, and set initial state in the constructor.
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. * Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
Please update the following components: MyComponent`, Please update the following components: MyComponent`,
`Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. `Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
* Move data fetching code or side effects to componentDidUpdate. * Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
Please update the following components: MyComponent`, Please update the following components: MyComponent`,
`Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. `Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
* Move data fetching code or side effects to componentDidUpdate. * Move data fetching code or side effects to componentDidUpdate.
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. * Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
Please update the following components: MyComponent`, Please update the following components: MyComponent`,
/* eslint-enable max-len */ /* eslint-enable max-len */

View File

@ -196,7 +196,7 @@ describe('ReactCompositeComponent', () => {
ReactDOM.render(<Parent />, container), ReactDOM.render(<Parent />, container),
).toWarnDev( ).toWarnDev(
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
'will stop working in React v17. Replace the ReactDOM.render() call ' + 'will stop working in React v18. Replace the ReactDOM.render() call ' +
'with ReactDOM.hydrate() if you want React to attach to the server HTML.', 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
{withoutStack: true}, {withoutStack: true},
); );

View File

@ -246,7 +246,7 @@ describe('ReactDOMFiber', () => {
expect(container.innerHTML).toBe(''); expect(container.innerHTML).toBe('');
}); });
// TODO: remove in React 17 // TODO: remove in React 18
if (!__EXPERIMENTAL__) { if (!__EXPERIMENTAL__) {
it('should support unstable_createPortal alias', () => { it('should support unstable_createPortal alias', () => {
const portalContainer = document.createElement('div'); const portalContainer = document.createElement('div');
@ -260,7 +260,7 @@ describe('ReactDOMFiber', () => {
), ),
).toWarnDev( ).toWarnDev(
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
'and will be removed in React 17+. Update your code to use ' + 'and will be removed in React 18+. Update your code to use ' +
'ReactDOM.createPortal() instead. It has the exact same API, ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' +
'but without the "unstable_" prefix.', 'but without the "unstable_" prefix.',
{withoutStack: true}, {withoutStack: true},

View File

@ -39,7 +39,7 @@ describe('rendering React components at document', () => {
callback, callback,
).toWarnDev( ).toWarnDev(
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
'will stop working in React v17. Replace the ReactDOM.render() call ' + 'will stop working in React v18. Replace the ReactDOM.render() call ' +
'with ReactDOM.hydrate() if you want React to attach to the server HTML.', 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
{withoutStack: true}, {withoutStack: true},
); );
@ -201,7 +201,7 @@ describe('rendering React components at document', () => {
ReactDOM.render(<Component text="Hello world" />, testDocument), ReactDOM.render(<Component text="Hello world" />, testDocument),
).toWarnDev( ).toWarnDev(
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
'will stop working in React v17. Replace the ReactDOM.render() call ' + 'will stop working in React v18. Replace the ReactDOM.render() call ' +
'with ReactDOM.hydrate() if you want React to attach to the server HTML.', 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
{withoutStack: true}, {withoutStack: true},
); );

View File

@ -83,7 +83,7 @@ describe('ReactDOMServerHydration', () => {
instance = ReactDOM.render(<TestComponent name="x" />, element); instance = ReactDOM.render(<TestComponent name="x" />, element);
}).toWarnDev( }).toWarnDev(
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
'will stop working in React v17. Replace the ReactDOM.render() call ' + 'will stop working in React v18. Replace the ReactDOM.render() call ' +
'with ReactDOM.hydrate() if you want React to attach to the server HTML.', 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
{withoutStack: true}, {withoutStack: true},
); );

View File

@ -32,7 +32,7 @@ it('should warn in legacy mode', () => {
expect(() => { expect(() => {
ReactDOM.render(<App />, document.createElement('div')); ReactDOM.render(<App />, document.createElement('div'));
}).toErrorDev( }).toErrorDev(
['Starting from React v17, the "scheduler" module will need to be mocked'], ['Starting from React v18, the "scheduler" module will need to be mocked'],
{withoutStack: true}, {withoutStack: true},
); );
// does not warn twice // does not warn twice

View File

@ -164,7 +164,7 @@ function unstable_createPortal(
didWarnAboutUnstableCreatePortal = true; didWarnAboutUnstableCreatePortal = true;
console.warn( console.warn(
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' + 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
'and will be removed in React 17+. Update your code to use ' + 'and will be removed in React 18+. Update your code to use ' +
'ReactDOM.createPortal() instead. It has the exact same API, ' + 'ReactDOM.createPortal() instead. It has the exact same API, ' +
'but without the "unstable_" prefix.', 'but without the "unstable_" prefix.',
); );
@ -210,7 +210,7 @@ export {
renderSubtreeIntoContainer as unstable_renderSubtreeIntoContainer, renderSubtreeIntoContainer as unstable_renderSubtreeIntoContainer,
// Disabled behind disableUnstableCreatePortal // Disabled behind disableUnstableCreatePortal
// Temporary alias since we already shipped React 16 RC with it. // Temporary alias since we already shipped React 16 RC with it.
// TODO: remove in React 17. // TODO: remove in React 18.
unstable_createPortal, unstable_createPortal,
// enableCreateEventHandleAPI // enableCreateEventHandleAPI
createEventHandle as unstable_createEventHandle, createEventHandle as unstable_createEventHandle,

View File

@ -143,7 +143,7 @@ function legacyCreateRootFromDOMContainer(
warnedAboutHydrateAPI = true; warnedAboutHydrateAPI = true;
console.warn( console.warn(
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' + 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
'will stop working in React v17. Replace the ReactDOM.render() call ' + 'will stop working in React v18. Replace the ReactDOM.render() call ' +
'with ReactDOM.hydrate() if you want React to attach to the server HTML.', 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
); );
} }

View File

@ -84,7 +84,7 @@ export function isAsyncMode(object: any) {
// Using console['warn'] to evade Babel and ESLint // Using console['warn'] to evade Babel and ESLint
console['warn']( console['warn'](
'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'The ReactIs.isAsyncMode() alias has been deprecated, ' +
'and will be removed in React 17+.', 'and will be removed in React 18+.',
); );
} }
} }
@ -97,7 +97,7 @@ export function isConcurrentMode(object: any) {
// Using console['warn'] to evade Babel and ESLint // Using console['warn'] to evade Babel and ESLint
console['warn']( console['warn'](
'The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'The ReactIs.isConcurrentMode() alias has been deprecated, ' +
'and will be removed in React 17+.', 'and will be removed in React 18+.',
); );
} }
} }

View File

@ -3141,7 +3141,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) {
} else if (warnAboutUnmockedScheduler === true) { } else if (warnAboutUnmockedScheduler === true) {
didWarnAboutUnmockedScheduler = true; didWarnAboutUnmockedScheduler = true;
console.error( console.error(
'Starting from React v17, the "scheduler" module will need to be mocked ' + 'Starting from React v18, the "scheduler" module will need to be mocked ' +
'to guarantee consistent behaviour across tests and browsers. ' + 'to guarantee consistent behaviour across tests and browsers. ' +
'For example, with jest: \n' + 'For example, with jest: \n' +
// Break up requires to avoid accidentally parsing them as dependencies. // Break up requires to avoid accidentally parsing them as dependencies.

View File

@ -3310,7 +3310,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) {
} else if (warnAboutUnmockedScheduler === true) { } else if (warnAboutUnmockedScheduler === true) {
didWarnAboutUnmockedScheduler = true; didWarnAboutUnmockedScheduler = true;
console.error( console.error(
'Starting from React v17, the "scheduler" module will need to be mocked ' + 'Starting from React v18, the "scheduler" module will need to be mocked ' +
'to guarantee consistent behaviour across tests and browsers. ' + 'to guarantee consistent behaviour across tests and browsers. ' +
'For example, with jest: \n' + 'For example, with jest: \n' +
// Break up requires to avoid accidentally parsing them as dependencies. // Break up requires to avoid accidentally parsing them as dependencies.

View File

@ -239,7 +239,7 @@ if (__DEV__) {
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
'* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' +
'* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' +
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
'To rename all deprecated lifecycles to their new names, you can run ' + 'To rename all deprecated lifecycles to their new names, you can run ' +
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
'\nPlease update the following components: %s', '\nPlease update the following components: %s',
@ -260,7 +260,7 @@ if (__DEV__) {
'code to use memoization techniques or move it to ' + 'code to use memoization techniques or move it to ' +
'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' +
'* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' +
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
'To rename all deprecated lifecycles to their new names, you can run ' + 'To rename all deprecated lifecycles to their new names, you can run ' +
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
'\nPlease update the following components: %s', '\nPlease update the following components: %s',
@ -276,7 +276,7 @@ if (__DEV__) {
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
'* Move data fetching code or side effects to componentDidUpdate.\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' +
'* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' +
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
'To rename all deprecated lifecycles to their new names, you can run ' + 'To rename all deprecated lifecycles to their new names, you can run ' +
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
'\nPlease update the following components: %s', '\nPlease update the following components: %s',

View File

@ -239,7 +239,7 @@ if (__DEV__) {
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
'* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' +
'* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' +
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
'To rename all deprecated lifecycles to their new names, you can run ' + 'To rename all deprecated lifecycles to their new names, you can run ' +
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
'\nPlease update the following components: %s', '\nPlease update the following components: %s',
@ -260,7 +260,7 @@ if (__DEV__) {
'code to use memoization techniques or move it to ' + 'code to use memoization techniques or move it to ' +
'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' +
'* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' +
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
'To rename all deprecated lifecycles to their new names, you can run ' + 'To rename all deprecated lifecycles to their new names, you can run ' +
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
'\nPlease update the following components: %s', '\nPlease update the following components: %s',
@ -276,7 +276,7 @@ if (__DEV__) {
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
'* Move data fetching code or side effects to componentDidUpdate.\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' +
'* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' +
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
'To rename all deprecated lifecycles to their new names, you can run ' + 'To rename all deprecated lifecycles to their new names, you can run ' +
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
'\nPlease update the following components: %s', '\nPlease update the following components: %s',

View File

@ -487,20 +487,20 @@ Please update the following components: AsyncRoot`,
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. `Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
* Move code with side effects to componentDidMount, and set initial state in the constructor. * Move code with side effects to componentDidMount, and set initial state in the constructor.
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. * Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
Please update the following components: Parent`, Please update the following components: Parent`,
`Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. `Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
* Move data fetching code or side effects to componentDidUpdate. * Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
Please update the following components: Parent`, Please update the following components: Parent`,
`Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. `Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
* Move data fetching code or side effects to componentDidUpdate. * Move data fetching code or side effects to componentDidUpdate.
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. * Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
Please update the following components: Parent`, Please update the following components: Parent`,
/* eslint-enable max-len */ /* eslint-enable max-len */

View File

@ -62,7 +62,7 @@ export const enableCreateEventHandleAPI = false;
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107 // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?) // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v18?)
// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version // Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
export const warnAboutUnmockedScheduler = false; export const warnAboutUnmockedScheduler = false;