Skip to content

Commit

Permalink
upgrade lazyflymake
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Bin committed Dec 2, 2024
1 parent 0475913 commit fbbed37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
13 changes: 9 additions & 4 deletions site-lisp/lazyflymake/lazyflymake-eslint.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

(require 'lazyflymake-sdk)

(defcustom lazyflymake-eslint-args '("--format" "unix")
"Arguments of eslint cli."
:group 'lazyflymake
:type '(repeat string))

(defun lazyflymake-eslint-err-line-pattern ()
"Return error line pattern.
If return a list containing patterns, `flymake-proc-err-line-patterns' uses the
Expand All @@ -20,7 +25,6 @@ If return nil, nothing need be done."
(let* ((dir (locate-dominating-file default-directory "node_modules"))
(local-eslint (concat dir "node_modules/.bin/eslint"))
(program (if (file-exists-p local-eslint) local-eslint "eslint"))
(eslint-args '("--format" "unix"))
file
;; use babel?
(babelrc (lazyflymake-sdk-find-dominating-file '("babel.config.json" ".babelrc.json" "babel.config.js"))))
Expand All @@ -30,12 +34,13 @@ If return nil, nothing need be done."

;; use locale babel configuration file
(when babelrc
(push (format "{babelOptions:{configFile:'%s'}}" (file-truename babelrc)) eslint-args)
(push "--parser-options" eslint-args))
(push (format "{babelOptions:{configFile:'%s'}}" (file-truename babelrc))
lazyflymake-eslint-args)
(push "--parser-options" lazyflymake-eslint-args))

(lazyflymake-sdk-generate-flymake-init
program
eslint-args
lazyflymake-eslint-args
file))))

(provide 'lazyflymake-eslint)
Expand Down
9 changes: 7 additions & 2 deletions site-lisp/lazyflymake/lazyflymake-shell.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
:group 'lazyflymake
:type 'string)

(defcustom lazyflymake-shell-args '("--format=gcc" "-x")
"Arguments of shellcheck cli."
:group 'lazyflymake
:type '(repeat string))

(defun lazyflymake-shell-err-line-pattern ()
"Return error line pattern.
If return a list containing the pattern, `flymake-proc-err-line-patterns' uses the
If return a list of patterns, `flymake-proc-err-line-patterns' uses the
list and is also converted into a buffer local variable.
If return the pattern, it's is pushed to `flymake-proc-err-line-patterns'.
If return nil, nothing need be done."
Expand All @@ -29,7 +34,7 @@ If return nil, nothing need be done."
(if lazyflymake-debug (message "lazyflymake-shell-init called"))
(lazyflymake-sdk-generate-flymake-init
lazyflymake-shell-program
'("--format=gcc")
lazyflymake-shell-args
file))))

(provide 'lazyflymake-shell)
Expand Down

0 comments on commit fbbed37

Please sign in to comment.