Created
April 6, 2017 18:17
-
-
Save sebcode/4a43760ab4abaf078f987f1dd94d4178 to your computer and use it in GitHub Desktop.
Replace @autoBind decorator with class instance properties
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
// https://github.com/andreypopp/autobind-decorator | |
// https://github.com/facebook/codemod | |
// Example replacement: | |
// - @autobind onClick(e: SyntheticEvent) { | |
// + onClick = (e: SyntheticEvent) => { | |
codemod -m -d . --extensions js \ | |
'@autobind\ ([a-zA-Z0-9]+)\(([^)]*)\)' \ | |
'\1 = (\2) =>' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had to modify the regex a bit to account for our code:
and also to remove imports