From 4985bb0a80f5cbeaa61d21a7daf7da5ecff2d892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Thu, 28 May 2020 10:25:39 -0700 Subject: [PATCH] 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. --- packages/react-dom/index.experimental.js | 2 +- packages/react-dom/index.stable.js | 2 +- .../react-dom/src/__tests__/ReactComponentLifeCycle-test.js | 6 +++--- .../react-dom/src/__tests__/ReactCompositeComponent-test.js | 2 +- packages/react-dom/src/__tests__/ReactDOMFiber-test.js | 4 ++-- .../react-dom/src/__tests__/ReactRenderDocument-test.js | 4 ++-- .../src/__tests__/ReactServerRenderingHydration-test.js | 2 +- .../ReactUnmockedSchedulerWarning-test.internal.js | 2 +- packages/react-dom/src/client/ReactDOM.js | 4 ++-- packages/react-dom/src/client/ReactDOMLegacy.js | 2 +- packages/react-is/src/ReactIs.js | 4 ++-- packages/react-reconciler/src/ReactFiberWorkLoop.new.js | 2 +- packages/react-reconciler/src/ReactFiberWorkLoop.old.js | 2 +- .../react-reconciler/src/ReactStrictModeWarnings.new.js | 6 +++--- .../react-reconciler/src/ReactStrictModeWarnings.old.js | 6 +++--- packages/react/src/__tests__/ReactStrictMode-test.js | 6 +++--- packages/shared/ReactFeatureFlags.js | 2 +- 17 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/react-dom/index.experimental.js b/packages/react-dom/index.experimental.js index dba70ca2b6c92..ba1d58b72ae21 100644 --- a/packages/react-dom/index.experimental.js +++ b/packages/react-dom/index.experimental.js @@ -27,6 +27,6 @@ export { unstable_renderSubtreeIntoContainer, // Disabled behind disableUnstableCreatePortal // Temporary alias since we already shipped React 16 RC with it. - // TODO: remove in React 17. + // TODO: remove in React 18. unstable_createPortal, } from './src/client/ReactDOM'; diff --git a/packages/react-dom/index.stable.js b/packages/react-dom/index.stable.js index 00d52806bab59..e9aa750475228 100644 --- a/packages/react-dom/index.stable.js +++ b/packages/react-dom/index.stable.js @@ -19,6 +19,6 @@ export { unmountComponentAtNode, unstable_renderSubtreeIntoContainer, // Temporary alias since we already shipped React 16 RC with it. - // TODO: remove in React 17. + // TODO: remove in React 18. unstable_createPortal, } from './src/client/ReactDOM'; diff --git a/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js b/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js index bfe41c540b575..939b7b77203ec 100644 --- a/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js +++ b/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js @@ -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. * 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`, `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. * 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`, `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. -* 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`, /* eslint-enable max-len */ diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js index 73984da6c40d6..7006f51b77f52 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js @@ -196,7 +196,7 @@ describe('ReactCompositeComponent', () => { ReactDOM.render(, container), ).toWarnDev( '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.', {withoutStack: true}, ); diff --git a/packages/react-dom/src/__tests__/ReactDOMFiber-test.js b/packages/react-dom/src/__tests__/ReactDOMFiber-test.js index 9391b34c446a2..ddec9c9ba2363 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiber-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiber-test.js @@ -246,7 +246,7 @@ describe('ReactDOMFiber', () => { expect(container.innerHTML).toBe(''); }); - // TODO: remove in React 17 + // TODO: remove in React 18 if (!__EXPERIMENTAL__) { it('should support unstable_createPortal alias', () => { const portalContainer = document.createElement('div'); @@ -260,7 +260,7 @@ describe('ReactDOMFiber', () => { ), ).toWarnDev( '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, ' + 'but without the "unstable_" prefix.', {withoutStack: true}, diff --git a/packages/react-dom/src/__tests__/ReactRenderDocument-test.js b/packages/react-dom/src/__tests__/ReactRenderDocument-test.js index 97ff0393f8741..2e7a60c9975fa 100644 --- a/packages/react-dom/src/__tests__/ReactRenderDocument-test.js +++ b/packages/react-dom/src/__tests__/ReactRenderDocument-test.js @@ -39,7 +39,7 @@ describe('rendering React components at document', () => { callback, ).toWarnDev( '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.', {withoutStack: true}, ); @@ -201,7 +201,7 @@ describe('rendering React components at document', () => { ReactDOM.render(, testDocument), ).toWarnDev( '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.', {withoutStack: true}, ); diff --git a/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js b/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js index 0ad352648c3e7..fea9d79b4735d 100644 --- a/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js @@ -83,7 +83,7 @@ describe('ReactDOMServerHydration', () => { instance = ReactDOM.render(, element); }).toWarnDev( '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.', {withoutStack: true}, ); diff --git a/packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.internal.js b/packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.internal.js index e4c47453adeef..501b01336b1b3 100644 --- a/packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.internal.js @@ -32,7 +32,7 @@ it('should warn in legacy mode', () => { expect(() => { ReactDOM.render(, document.createElement('div')); }).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}, ); // does not warn twice diff --git a/packages/react-dom/src/client/ReactDOM.js b/packages/react-dom/src/client/ReactDOM.js index d24be67df240f..1fe446e32a31b 100644 --- a/packages/react-dom/src/client/ReactDOM.js +++ b/packages/react-dom/src/client/ReactDOM.js @@ -164,7 +164,7 @@ function unstable_createPortal( didWarnAboutUnstableCreatePortal = true; console.warn( '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, ' + 'but without the "unstable_" prefix.', ); @@ -210,7 +210,7 @@ export { renderSubtreeIntoContainer as unstable_renderSubtreeIntoContainer, // Disabled behind disableUnstableCreatePortal // Temporary alias since we already shipped React 16 RC with it. - // TODO: remove in React 17. + // TODO: remove in React 18. unstable_createPortal, // enableCreateEventHandleAPI createEventHandle as unstable_createEventHandle, diff --git a/packages/react-dom/src/client/ReactDOMLegacy.js b/packages/react-dom/src/client/ReactDOMLegacy.js index 276baa8c634aa..6ca009233b0e9 100644 --- a/packages/react-dom/src/client/ReactDOMLegacy.js +++ b/packages/react-dom/src/client/ReactDOMLegacy.js @@ -143,7 +143,7 @@ function legacyCreateRootFromDOMContainer( warnedAboutHydrateAPI = true; console.warn( '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.', ); } diff --git a/packages/react-is/src/ReactIs.js b/packages/react-is/src/ReactIs.js index 2b0b03e38d370..bac0db1a880ff 100644 --- a/packages/react-is/src/ReactIs.js +++ b/packages/react-is/src/ReactIs.js @@ -84,7 +84,7 @@ export function isAsyncMode(object: any) { // Using console['warn'] to evade Babel and ESLint console['warn']( '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 console['warn']( 'The ReactIs.isConcurrentMode() alias has been deprecated, ' + - 'and will be removed in React 17+.', + 'and will be removed in React 18+.', ); } } diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index 39ddbe53f8a6f..c8bacdb12cd65 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -3141,7 +3141,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) { } else if (warnAboutUnmockedScheduler === true) { didWarnAboutUnmockedScheduler = true; 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. ' + 'For example, with jest: \n' + // Break up requires to avoid accidentally parsing them as dependencies. diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index daaaced567cf6..908108f972650 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -3310,7 +3310,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) { } else if (warnAboutUnmockedScheduler === true) { didWarnAboutUnmockedScheduler = true; 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. ' + 'For example, with jest: \n' + // Break up requires to avoid accidentally parsing them as dependencies. diff --git a/packages/react-reconciler/src/ReactStrictModeWarnings.new.js b/packages/react-reconciler/src/ReactStrictModeWarnings.new.js index dd0a270df6b4d..15d86a73b4b78 100644 --- a/packages/react-reconciler/src/ReactStrictModeWarnings.new.js +++ b/packages/react-reconciler/src/ReactStrictModeWarnings.new.js @@ -239,7 +239,7 @@ if (__DEV__) { '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' + '* 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 ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', @@ -260,7 +260,7 @@ if (__DEV__) { 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* 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 ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', @@ -276,7 +276,7 @@ if (__DEV__) { 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* 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 ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', diff --git a/packages/react-reconciler/src/ReactStrictModeWarnings.old.js b/packages/react-reconciler/src/ReactStrictModeWarnings.old.js index dd0a270df6b4d..15d86a73b4b78 100644 --- a/packages/react-reconciler/src/ReactStrictModeWarnings.old.js +++ b/packages/react-reconciler/src/ReactStrictModeWarnings.old.js @@ -239,7 +239,7 @@ if (__DEV__) { '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' + '* 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 ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', @@ -260,7 +260,7 @@ if (__DEV__) { 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' + '* 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 ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', @@ -276,7 +276,7 @@ if (__DEV__) { 'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* 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 ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', diff --git a/packages/react/src/__tests__/ReactStrictMode-test.js b/packages/react/src/__tests__/ReactStrictMode-test.js index 55e473f2b60fd..055b71d8c7ff5 100644 --- a/packages/react/src/__tests__/ReactStrictMode-test.js +++ b/packages/react/src/__tests__/ReactStrictMode-test.js @@ -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. * 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`, `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. * 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`, `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. -* 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`, /* eslint-enable max-len */ diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index 466491b5b41ac..acd8c92088e2b 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -62,7 +62,7 @@ export const enableCreateEventHandleAPI = false; // 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 export const warnAboutUnmockedScheduler = false;