Skip to content

Commit

Permalink
add flymake-eslint-defer-binary-check bool (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
orzechowskid authored Aug 28, 2019
1 parent 5624f61 commit e4d4f18
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions flymake-eslint.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;;; flymake-eslint.el --- A Flymake backend for Javascript using eslint -*- lexical-binding: t; -*-

;;; Version: 1.3.5
;;; Version: 1.4.0

;;; Author: Dan Orzechowski
;;; Contributor: Terje Larsen
Expand Down Expand Up @@ -50,6 +50,13 @@
:type 'boolean
:group 'flymake-eslint)

(defcustom flymake-eslint-defer-binary-check nil
"Set to t to bypass the initial check which ensures eslint is present.
Useful when the value of `exec-path' is set dynamically and the location of eslint might not be known ahead of time."
:type 'boolean
:group 'flymake-eslint)


;; internal variables

Expand Down Expand Up @@ -136,6 +143,8 @@ Create linter process for SOURCE-BUFFER which invokes CALLBACK once linter is fi
(defun flymake-eslint--check-and-report (source-buffer flymake-report-fn)
"Internal function.
Run eslint against SOURCE-BUFFER and use FLYMAKE-REPORT-FN to report results."
(if flymake-eslint-defer-binary-check
(flymake-eslint--ensure-binary-exists))
(flymake-eslint--create-process
source-buffer
(lambda (eslint-stdout)
Expand All @@ -157,7 +166,8 @@ Run eslint on the current buffer, and report results using FLYMAKE-REPORT-FN. A
(defun flymake-eslint-enable ()
"Enable Flymake and add flymake-eslint as a buffer-local Flymake backend."
(interactive)
(flymake-eslint--ensure-binary-exists)
(if (not flymake-eslint-defer-binary-check)
(flymake-eslint--ensure-binary-exists))
(flymake-mode t)
(add-hook 'flymake-diagnostic-functions 'flymake-eslint--checker nil t))

Expand Down

0 comments on commit e4d4f18

Please sign in to comment.