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

Reprinting file without changes line break changes #52

Open
sophiebits opened this issue Sep 11, 2015 · 2 comments
Open

Reprinting file without changes line break changes #52

sophiebits opened this issue Sep 11, 2015 · 2 comments

Comments

@sophiebits
Copy link

Parsing and reprinting

// I have a parent
newNode.parent
  && (
    (// Or I did but its different than the one I have now.
      !originalNode.parent ||
      newNode.parent.key !== originalNode.parent.key
    )
  )

outputs

// I have a parent
newNode.parent
  && (
    (// Or I did but its different than the one I have now.
      (!originalNode.parent || newNode.parent.key !== originalNode.parent.key)
    )
  )

which is inconvenient for codemods. Live test: http://felix-kling.de/esprima_ast_explorer/#/NvtYJQH95L.

@fkling
Copy link
Contributor

fkling commented Sep 11, 2015

All the printing is done by recast. You should file an issue there.

Though for jscodeshift specifically, you can simply return nothing from the transformer. That tells the runner/worker that the file is not supposed to change (and of course it won't be overridden since there was no return value).

@fkling fkling changed the title Reprinting file without causes line break changes Reprinting file without changes line break changes Sep 11, 2015
@sophiebits
Copy link
Author

Okay, thanks: benjamn/recast#215.

euphocat pushed a commit to euphocat/jscodeshift that referenced this issue Oct 22, 2017
51: handle failure to read eslint config options for file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants