Skip to content

Conversation

@nathanstitt
Copy link

Fixes #104

I also received the error when attempting to transform a simple file like this:

import React from 'react'; import NextIcon from './next-icon'; function renderEditTriangle({ rowIndex }) { return ( <Button id={rowIndex} plain icon={<NextIcon />} /> ); } renderEditTriangle.propTypes = { rowIndex: React.PropTypes.string };

FWIW:
I added a console.log(path.parent.node) to see what node it was choking on:

Node { type: 'FunctionDeclaration', start: 64, end: 188, loc: SourceLocation { start: Position { line: 4, column: 0 }, end: Position { line: 8, column: 1 }, lines: Lines {}, indent: 0 }, id: Node { type: 'Identifier', start: 73, end: 91, loc: SourceLocation { start: [Object], end: [Object], lines: Lines {}, indent: 0 }, name: 'renderEditTriangle', typeAnnotation: null }, generator: false, expression: false, async: false, params: [ Node { type: 'ObjectPattern', start: 92, end: 104, loc: [Object], properties: [Object], decorators: null } ], body: Node { type: 'BlockStatement', start: 106, end: 188, loc: SourceLocation { start: [Object], end: [Object], lines: Lines {}, indent: 0 }, body: [ [Object] ], directives: [] }, defaults: [], rest: null, returnType: null, typeParameters: null } 
@jrsinclair
Copy link

Tried this and worked for me. Thanks very much.

@rocking42
Copy link

Champion! Love the fix

@jaredpalmer
Copy link

Had same error. This worked for perfectly.

@elyobo
Copy link

elyobo commented Apr 11, 2017

Partially fixes for me too. Still breaks lots of code, e.g. the following, but they don't appear to be related to this fix.

@@ -1,4 +1,4 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; import classNames from 'classnames'; 

(no import added)

And also converting import { PropTypes } from 'react'; into import 'react';

@wmartins
Copy link

Working for me as well. Thank you @nathanstitt!

@bvaughn
Copy link
Contributor

bvaughn commented Apr 14, 2017

Thanks so much for this PR! This issue has been fixed by a similar PR already though. 🙇 Sorry for not noticing this sooner!

@bvaughn bvaughn closed this Apr 14, 2017
@bvaughn
Copy link
Contributor

bvaughn commented Apr 14, 2017

@elyobo Can you provide a before-and-after code snippet that illustrates the break (after pulling the recent fixes)?

@elyobo
Copy link

elyobo commented Apr 14, 2017

@bvaughn The latest master is working perfectly for me, the problems I mentioned no longer occur.

@bvaughn
Copy link
Contributor

bvaughn commented Apr 14, 2017

Great! Thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

7 participants