Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Downgrade deprecation error to warning #63

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

flarnie
Copy link
Contributor

@flarnie flarnie commented May 24, 2017

what is the change?:
Inlines a version of 'warning' that uses console.warn instead of console.error, and then uses that for the deprecation warning.

NOTE: I'm not sure that this will only warn in development, which is a problem. We don't seem to have a 'DEV' env. variable set up here, so I'm not sure how to limit the warnings to development?

why make this change?:
This is a particularly noisy warning that was firing in 3rd party libraries, which then causes it to show up in product code. Users then can't silence it easily without updating their library. This makes it slightly less painful, hopefully, but still painful enough to get folks to update their code.

test plan:
yarn test - updated some tests to check for this.

issue:
facebook/react#9398

**what is the change?:**
Inlines a version of 'warning' that uses `console.warn` instead of `console.error`, and then uses that for the deprecation warning.

**NOTE: I'm not sure that this will only warn in development, which is a problem. We don't seem to have a '__DEV__' env. variable set up here, so I'm not sure how to limit the warnings to development?**

**why make this change?:**
This is a particularly noisy warning that was firing in 3rd party libraries, which then causes it to show up in product code. Users then can't silence it easily without updating their library. This makes it slightly less painful, hopefully, but still painful enough to get folks to update their code.

**test plan:**
`yarn test` - updated some tests to check for this.

**issue:**
facebook/react#9398
@gaearon
Copy link
Contributor

gaearon commented May 24, 2017

We have a process.env.NODE_ENV !== 'production' check before calling the method so it should be good. It's CommonJS equivalent of __DEV__.

Copy link
Contributor

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't transpile ES6 here (the build process is not fully set up) so we should limit ourselves to using ES5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants