forked from facebook/jscodeshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Infer displayName from variable declaration/assignment and property name
Also based on transfrom-react-display-name
- Loading branch information
Showing
9 changed files
with
111 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
transforms/__testfixtures__/class/class-displayName.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const React = require('React'); | ||
|
||
let A = React.createClass({ | ||
mixins: [], | ||
render() { | ||
return <div />; | ||
}, | ||
}); | ||
|
||
A = React.createClass({ | ||
mixins: [], | ||
render() { | ||
return <div />; | ||
}, | ||
}); | ||
|
||
const obj = { | ||
B: React.createClass({ | ||
mixins: [], | ||
render() { | ||
return <div />; | ||
}, | ||
}), | ||
}; | ||
|
||
export default React.createClass({ | ||
mixins: [], | ||
render() { | ||
return <div />; | ||
}, | ||
}); |
41 changes: 41 additions & 0 deletions
41
transforms/__testfixtures__/class/class-displayName.output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const React = require('React'); | ||
|
||
const createReactClass = require('react-create-class'); | ||
|
||
let A = createReactClass({ | ||
displayName: 'A', | ||
mixins: [], | ||
|
||
render() { | ||
return <div />; | ||
}, | ||
}); | ||
|
||
A = createReactClass({ | ||
displayName: 'A', | ||
mixins: [], | ||
|
||
render() { | ||
return <div />; | ||
}, | ||
}); | ||
|
||
const obj = { | ||
B: createReactClass({ | ||
displayName: 'B', | ||
mixins: [], | ||
|
||
render() { | ||
return <div />; | ||
}, | ||
}), | ||
}; | ||
|
||
export default createReactClass({ | ||
displayName: 'class-displayName.input', | ||
mixins: [], | ||
|
||
render() { | ||
return <div />; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters