-
Notifications
You must be signed in to change notification settings - Fork 29
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
Added support for ES6 imports and exports (and PureComponent) #26
base: master
Are you sure you want to change the base?
Conversation
- Updated `babel-helper-is-react-class` - Version bump to `2.0.0` because of the API change (requires `path` instead of `path.node`) - Added a traversal for named imports (e.g. `import React, { Component } from 'react'`) - Added checks for `PureComponent` - Updated `babel-plugin-transform-react-pure-class-to-function` - Refactored replacement logic to read more clearly now that there's 3 code paths - Added export declaration check, to avoid "We don't know what to do with this node type" errors - Added extra tests for new functionality
Remove after (if?) jamiebuilds#26 gets merged
@LeoIannacone Well, I've made a temporary fork on NPM that I've been using: I was planning on deprecating it once this PR got merged. |
@@ -0,0 +1 @@ | |||
node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the eslint docs:
In addition to any patterns in a .eslintignore file, ESLint always ignores files in /node_modules/* and /bower_components/*.
@thedillonb Wouldn't a |
@thedillonb Actually, after a cursory glance over the plugin, it looks like anything that contains more than just |
@vdh, you're right. If there are methods other than |
@thedillonb Hmm, that's sort of a limitation in how React currently implements the rendering of stateless functional components, but I get what you're saying. Perhaps if I added some sort of optional configuration toggle to skip |
I have forked and revived the original plugin (here, don't like the idea of having presets and plugins mixed) and made it up to date with some of the pull requests in here. I have added the option (disabled by default) to convert PureComponents or not, and added some additional features. |
You know, maybe if a single person in any of these PRs offered to help out maintaining this project, then it would be more active. But everyone just wants to complain. So you all get nothing |
@thejameskyle I can try at least to go though the opened issues. I use the plugin in production, so I'm interested in it. Would you mind to add some permissions to me? |
Added |
Fixes #23 & #8 by checking imports for
import React, { Component } from 'react'
, and also adds support for the newPureComponent
.It possibly also fixes #22 due to the fix for export declarations (which are mostly only used in the tests, since Babel already converts the ES6 exports down to ES5 syntax).
babel-helper-is-react-class
2.0.0
because of the API change (requirespath
instead ofpath.node
)import React, { Component } from 'react'
)PureComponent
babel-plugin-transform-react-pure-class-to-function