Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

React 16 lifecycle errors appearing in a React 15 project #1789

Closed
shockey opened this issue May 12, 2018 · 6 comments
Closed

React 16 lifecycle errors appearing in a React 15 project #1789

shockey opened this issue May 12, 2018 · 6 comments

Comments

@shockey
Copy link

shockey commented May 12, 2018

I'm getting react/no-deprecated componentWillReceiveProps errors in a React 15 project 馃槩

shockey added a commit to swagger-api/swagger-ui that referenced this issue May 12, 2018
shockey added a commit to swagger-api/swagger-ui that referenced this issue May 12, 2018
* v3.14.2

* rebuild dist

* constrict `eslint-plugin-react` version

jsx-eslint/eslint-plugin-react#1789
@ljharb
Copy link
Member

ljharb commented May 12, 2018

https://github.com/swagger-api/swagger-ui/blob/d256ae87d310b40fb9fd5cc52ec2aa7db55b28ca/.eslintrc Doesn鈥檛 specify a react version pragma, so as far as eslint is concerned, it鈥檚 a React 16.3 project.

If you specify your react version, you鈥檒l get appropriate error messages.

@shockey
Copy link
Author

shockey commented May 12, 2018

Thanks @ljharb, I wasn't aware of the pragma setting!

From my perspective, having my linter (and therefore, my build) break due to a changing default in this plugin was not a fun thing to discover. I do see that the plugin documents its changing default React target version (React version, default to the latest React stable release).

Perhaps a warning if a pragma is not present would provide a better experience than finding out the hard way when something like this happens?

@ljharb
Copy link
Member

ljharb commented May 12, 2018

Adding a warning for that sounds like a great idea.

@maaydin
Copy link

maaydin commented May 14, 2018

We have faced same error messages with react 16.2. Adding react version to .eslintrc file fixed the problem.

{
...
  "settings": {
    "react": {
      "version": "16.2.0"
    },
  }
...
}

@alasdairhurst
Copy link

Adding the react version is good to know, however like @shockey said, this isn't great behaviour. Ideally, any rules that are modified to break where they didn't before should be breaking changes rather than something that gets picked - usually automatically with a minor bump

@ljharb
Copy link
Member

ljharb commented May 14, 2018

@alasdairhurst there's always cases, however, where that constitutes a bugfix - ie, the bug was "it wasn't warning" and now it is.

faboweb pushed a commit to faboweb/swagger-ui that referenced this issue May 23, 2018
* v3.14.2

* rebuild dist

* constrict `eslint-plugin-react` version

jsx-eslint/eslint-plugin-react#1789
alexzherdev added a commit to alexzherdev/eslint-plugin-react that referenced this issue Jun 27, 2018
alexzherdev added a commit to alexzherdev/eslint-plugin-react that referenced this issue Jun 27, 2018
ljharb pushed a commit to alexzherdev/eslint-plugin-react that referenced this issue Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants