-
Notifications
You must be signed in to change notification settings - Fork 20
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
Format on pre-save #34
Comments
The eslint format command can't read from stdin, it can only format files on disk. For this to be possible this plugin would need to write the file to some temp location, run eslint on that file with the configuration of the original file's directory, and then replace the buffer with the contents of the temp file before saving. I would guess that the impact to perf would not be great and the logic would make this fairly complicated. I'd be willing to accept a PR though, especially if it had tests. :) |
This is now supported through the CLI example: |
I added support for a very similar feature of |
Would it be possible to configure the formatter to format the file before it's saved (but after pressing Cmd-s) instead of after? Now it seems that the file is saved to disk, then the formatter formats the file and saves it again, resulting in two saves.
This is problematic in cases where saved files are watched for changes, as the first (unformatted) save triggers actions (babel-compiles etc), and the second (formatted) save goes by unnoticed since the action is already in progress.
The text was updated successfully, but these errors were encountered: