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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React 15.5: Support react-create-class and prop-types #1144

Closed
3 tasks done
ljharb opened this issue Apr 8, 2017 · 7 comments
Closed
3 tasks done

React 15.5: Support react-create-class and prop-types #1144

ljharb opened this issue Apr 8, 2017 · 7 comments

Comments

@ljharb
Copy link
Member

ljharb commented Apr 8, 2017

To support React 15.5, we need the following changes asap:

  • Everywhere we support React.createClass, we also need to support an import or require of react-create-class
  • if we support PropTypes.* anywhere, we also need to support an import or require of prop-types
  • we need to make no-deprecated warn on React.createClass and React.PropTypes usage and recommends the packages as well. It should apply to all versions of React since it's safe to migrate to the standalone packages on all versions.
@yannickcr
Copy link
Member

For the third point we already have the no-deprecated rule that can be used.

@EvHaus
Copy link
Collaborator

EvHaus commented Apr 9, 2017

I can take care of the no-unused-prop-types rule. Will look into it early next week.

@EvHaus
Copy link
Collaborator

EvHaus commented Apr 17, 2017

After review, looks like the no-unused-prop-types and prop-types rules are not affected by the React 15.5 changes as they don't make any assumptions about where the PropTypes object comes from. No changes needed there.

@kentor
Copy link
Contributor

kentor commented Apr 17, 2017

In the README there's this section for the eslint config:

{
  "settings": {
    "react": {
      "createClass": "createClass", // Regex for Component Factory to use, default to "createClass"
      "pragma": "React",  // Pragma to use, default to "React"
      "version": "15.0" // React version, default to the latest React stable release
    }
  }
}

Changing "createClass": "createClass" to "createClass": "createReactClass" worked for the sort-comp rule for component detection. Haven't tested other rules...

@ljharb
Copy link
Member Author

ljharb commented Apr 17, 2017

@EvNaverniouk I think it's a flaw in the prop-types rule in particular that any validator named "shape", for example, assumes the semantics of PropTypes.shape - but you're right that that means it's not a blocker for React 15.5.

@kentor if that's the case, then perhaps we should default createClass to createReactClass when the version is 15.5+?

@yannickcr
Copy link
Member

React 15.5.0 support seems to be complete.

  • Component factory now default to createReactClass (you still got the possibility to change it to createClass using the shared settings).
  • PropTypes detection is not affected by the changes in React 15.5.0.
  • React.PropTypes and React.createClass were added to no-deprecated.

I will publish a RC for the 7.0.0 (since there is some breaking changes here), you can test it with:

npm install eslint-plugin-react@next

Feedback welcome 😃

@ljharb
Copy link
Member Author

ljharb commented Apr 23, 2017

Thanks - we have more v7 PRs that need to be merged before a real v7 can go out, but as long as breaking changes can go in between RCs this is fine :-)

I'll close this for now.

@ljharb ljharb closed this as completed Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants