MithrilJS / mithril-codemods

jscodeshift-powered mithril@0.2.x to mithril@1.x transformations
MIT License
19 stars 4 forks source link

Applying the script iteratively appends keyword "state" even if already there #28

Closed zy4 closed 7 years ago

zy4 commented 7 years ago

first run: job: vnode.state.attrs.job

second run: job: vnode.state.state.attrs.job

tivac commented 7 years ago

Sorry about that, it definitely hasn't been designed for repeat runs against a codebase.

Could you provide a more complete example of the code that triggers the error? It's not a high priority thing for me to fix but I'll take a look if I can!

zy4 commented 7 years ago

Here is a sample diff: https://gist.github.com/zy4/3d1b629e7ae6c9810b27f3079e707cb4 I also think that this is not high-priority but when a run fails, most of the time files have been changed (if not run dry). After fixing the problem (e.g. "unexpected token"), one wants to rerun the program although the files have been modified already.

Would also highly appreciate some useful logs of why a warning was thrown. For example, I get the warning unmodified but I don't know why this was thrown. I ended up having modified code but did not know where to search for code which I need to migrate manually.

tivac commented 7 years ago

Agreed, jscodeshift doesn't provide very much infrastructure for explaining why things happened. 😒

tivac commented 7 years ago

mithril-codemods@3.4.2 should be on NPM soon with a very simple fix for this. It may not be enough, but it's a start at least.