Created
January 12, 2016 23:59
-
-
Save ustun/73321bfcb01a8657e5b8 to your computer and use it in GitHub Desktop.
run eslint --fix on emacs file save
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; runs eslint --fix on the current file after save | |
;;; alpha quality -- use at your own risk | |
(defun eslint-fix-file () | |
(interactive) | |
(message "eslint --fixing the file" (buffer-file-name)) | |
(shell-command (concat "eslint --fix " (buffer-file-name)))) | |
(defun eslint-fix-file-and-revert () | |
(interactive) | |
(eslint-fix-file) | |
(revert-buffer t t)) | |
(add-hook 'js2-mode-hook | |
(lambda () | |
(add-hook 'after-save-hook #'eslint-fix-file-and-revert))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍