Skip to content
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

Question: examples directory #57

Closed
igncp opened this issue Oct 19, 2015 · 14 comments
Closed

Question: examples directory #57

igncp opened this issue Oct 19, 2015 · 14 comments

Comments

@igncp
Copy link

igncp commented Oct 19, 2015

Hi,

I have been reviewing this awesome project and I think it would be cool if the repo had an examples directory where novices (like me) could review some possible transformers. So far the only examples I have seen are at http://astexplorer.net/ and https://medium.com/@cpojer/effective-javascript-codemods-5a6686bb46fb. Conceptually, there are not many projects like this so maybe a bunch of examples showing the potential of the transformers would ease the learning curve.

Would you accept PRs with examples or you prefer to leave them outside this repository? If affirmative, which structure would you prefer?

Cheers

@fkling
Copy link
Contributor

fkling commented Oct 19, 2015

I agree that examples of how to use the API would be useful, but I'm not sure how useful contrived examples would be. https://github.com/cpojer/js-codemod/ contains a couple of transforms that are actually used, which could serve as examples. They may need a some more explanation / comments.

cc @cpojer

@wincent
Copy link
Contributor

wincent commented Oct 19, 2015

There are also some examples bundled with the React repo. It might be worth linking to these places from the README (if we don't already).

@hzoo
Copy link
Contributor

hzoo commented Oct 19, 2015

@jhgg is working on some too https://github.com/jhgg/js-transforms (from #codemod in reactiflux)

@fkling
Copy link
Contributor

fkling commented Oct 19, 2015

Maybe we should just create a wiki page that links to projects using jscodeshift.

@jhgg
Copy link

jhgg commented Oct 19, 2015

I am working on learning code modding. My examples probably aren't the best. Always looking for feedback on what I did wrong and what I can do better.

@hzoo
Copy link
Contributor

hzoo commented Oct 19, 2015

Wiki sounds ok - and @jhgg you can always add tests

@igncp
Copy link
Author

igncp commented Oct 19, 2015

The wiki idea is great. At the end, having examples from multiple sources is enough for getting started, just the three links you mentioned seem to have a lot of value for learning purposes.

@hzoo
Copy link
Contributor

hzoo commented Oct 20, 2015

Made a simple wiki page: https://github.com/facebook/jscodeshift/wiki/Codemod-Examples for now

@fkling
Copy link
Contributor

fkling commented Oct 20, 2015

Thanks @hzoo!

@fkling fkling closed this as completed Oct 20, 2015
@igncp
Copy link
Author

igncp commented Oct 20, 2015

Thank you!

@cpojer
Copy link
Contributor

cpojer commented Oct 20, 2015

How do you guys feel about adding this to the README? The problem with the wiki on GitHub is that it isn't discoverable. And if this is just 3-5 links it doesn't hurt adding an "Examples" section to the readme I think.

@hzoo
Copy link
Contributor

hzoo commented Oct 20, 2015

Sounds good since theres only 2 links right now and no link to it (unless you link to the wiki on the readme)

@fkling
Copy link
Contributor

fkling commented Oct 20, 2015

Yeah, I would just link the wiki from the readme.

@steve-taylor
Copy link

steve-taylor commented Apr 11, 2017

There aren't any simple examples, such as how to change the literal value of an object property that has a specific name.

euphocat pushed a commit to euphocat/jscodeshift that referenced this issue Oct 22, 2017
56: identify components with refs as impure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants