-
Notifications
You must be signed in to change notification settings - Fork 885
Ability to not overwrite source file when using --fix
#2125
Comments
I'm not sure if this would belong in the this repo, but it would be pretty simple to write a custom formatter to write out the fixes in whatever format you want. The text replacements are available in the API even if --fix isn't used. See https://palantir.github.io/tslint/develop/custom-formatters/ Each |
@nchen63 how would this solve the problem of files being overwritten in place? |
don't call with --fix so nothing is overwritten |
Thanks for the info @nchen63! I created an MVP here: https://github.com/ianks/tslint-fix-formatter It might be nice to include this in core, since I imagine it would be useful to many users (VIM users, at least). I will leave that up to the team though. Cheers! |
@ianks sure, we'd accept a PR for a fix formatter. |
Continuing off of #2149. Making a copy of the file in a temp for is actually what neoformat attempts to do, however the imports , etc are broken at that point. Overall, that mechanism is a bit too error-prone and complicated to use in most cases. |
Seems like this is a subset of #1760. Closing for housekeeping, but if I've misinterpreted and this is actually a separate issue, please do comment here! |
Currently, running
--fix
replaces the file in place. In certain cases, this causes problem with integrating with other editors, etc. For example, https://github.com/sbdchd/neoformat likes to have a copy of the changed file so it can perform diffs on the current buffer. Would you consider adding an option which allow--fix
to emit the changes to stdout optionally?The text was updated successfully, but these errors were encountered: