Comments (5)
I was seeing the same error but Nathan's commit did the trick.
from react-codemod.
Hey @kentcdodds! Sorry for not seeing this issue earlier. Have had my hands full the past few days.
I committed a few bug fixes this evening that should resolve the issues you reported above. (I ran the code snippets you provided to make certain.)
One thing to note: In your second example, the codemod will insert semicolons after the react
and prop-types
imports. (Sorry!)
from react-codemod.
Note that I did get errors for files that do actually utilize PropTypes (like this one):
import React, { PropTypes } from 'react'
import { StyleSheet, css } from 'aphrodite'
import * as ViewActions from '../../actions/actions'
import content from '../../lib/content'
const i18n = content('crossBorder/calc')
// Allows User to skip straight to Xoom if they want to repeat the
// prior Xoom transaction
const styles = StyleSheet.create({
skipContainer: {
lineHeight: '60px',
marginBottom: 30,
borderRadius: 5,
backgroundColor: '#f5f7fa',
fontSize: 15,
},
})
const SkipToXoom = React.createClass({
propTypes: {
dispatch: PropTypes.func.isRequired,
toCountryData: PropTypes.shape({
countryName: PropTypes.string.isRequired, // localized country name
countryCode: PropTypes.string.isRequired,
}),
},
redirectToXoom() {
this.props.dispatch(ViewActions.redirectToXoom({
type: 'repeatUser',
countryCode: this.props.toCountryData.countryCode,
}))
},
render() {
const { toCountryData: { countryName } } = this.props
return (
<div className={css(styles.skipContainer)}>
<span className="content">
{i18n('skipToXoom.body', { country: <strong key={countryName}>{countryName}</strong> })}
</span>
{' '}
<a
href="#"
onClick={this.redirectToXoom}
data-pagename="main:consumer:p2p:transfer:xb:repeatSkipToXoom"
>
{i18n('skipToXoom.link')}
</a>
</div>
)
},
})
export default SkipToXoom
from react-codemod.
Still seeing this. Is it because my babel setup is in my webpack instead of babelrc?
from react-codemod.
Have had my hands full the past few days.
No worries. Understandable :)
I committed a few bug fixes this evening that should resolve the issues you reported above. (I ran the code snippets you provided to make certain.)
Great! Thanks!
One thing to note: In your second example, the codemod will insert semicolons after the
react
andprop-types
imports. (Sorry!)
No worries! We can autofix that away!
from react-codemod.
Related Issues (20)
- update-react-imports not working with TS HOT 3
- Maybe it's a RFC HOT 4
- update-react-imports transform unnecessarily errors on multiple React imports HOT 1
- Consider providing an option for update-react-transform to convert namespace imports HOT 5
- Cannot find module 'core-js/modules/web.dom.iterable' HOT 5
- 【Question】'React' refers to a UMD global, but the current file is a module. Consider adding an import instead. HOT 5
- update-react-imports changes line endings (LF -> CRLF) HOT 2
- Feature request: npx react-codemod ./path/to/local/codemod
- update-react-imports adds extra import * from React HOT 10
- update-react-imports: cb.apply is not a function HOT 1
- Skipping files when running create-element-to-jsx
- 'npx react-codemod update-react-imports' can’t update imports automatically.
- [pure-component] Parsing error: Identifier `props` has already been declared HOT 3
- [pure-component] Transformation error (Could not replace path) HOT 1
- Render Prop Expression to Child Component Transformer code
- Exposing utils / helpers in some way HOT 2
- Duplicate of https://github.com/reactjs/react-codemod/pull/295
- Strange output from React-PropTypes-to-prop-types HOT 5
- Add support for React 18 features
- Error `did not recognize object of type "PropertyDefinition"` when running `update-react-imports` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-codemod.