Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: 0.2
Fetching contributors…

Cannot retrieve contributors at this time

65 lines (53 sloc) 2.315 kb
;;; flymake-jslint.el --- Flymake support for javascript using jslint
;;; Author: Steve Purcell <>
;;; Homepage:
;;; Version: DEV
;;; Commentary:
;; References:
;; Usage: (add-hook 'js-mode-hook 'flymake-jslint-load)
(require 'flymake)
(defgroup flymake-jslint nil
"Flymake checking of Javascript using jslint"
:group 'programming
:prefix "flymake-jslint-")
(defcustom flymake-jslint-detect-trailing-comma t
"Whether or not to report warnings about trailing commas"
:type 'boolean :group :flymake-jslint)
(defcustom flymake-jslint-command "jsl"
"Whether or not to report warnings about trailing commas"
:type 'string :group 'flymake-jslint)
(defvar flymake-jslint-err-line-patterns
'(("^\\(.+\\)\:\\([0-9]+\\)\: \\(SyntaxError\:.+\\)\:$" nil 2 nil 3)
("^\\(.+\\)(\\([0-9]+\\)): \\(SyntaxError:.+\\)$" nil 2 nil 3)
("^\\(.+\\)(\\([0-9]+\\)): \\(lint \\)?\\(warning:.+\\)$" nil 2 nil 4)))
(defvar flymake-jslint-trailing-comma-err-line-pattern
'("^\\(.+\\)\:\\([0-9]+\\)\: strict \\(warning: trailing comma.+\\)\:$" nil 2 nil 3))
(defun flymake-jslint-init ()
(list flymake-jslint-command (list "-process" (flymake-init-create-temp-buffer-copy
(defun flymake-jslint-load ()
"Configure flymake mode to check the current buffer's javascript syntax.
This function is designed to be called in `js-mode-hook' or
equivalent; it does not alter flymake's global configuration, so
`flymake-mode' alone will not suffice."
(set (make-local-variable 'flymake-allowed-file-name-masks) '(("." flymake-jslint-init)))
(set (make-local-variable 'flymake-err-line-patterns) flymake-jslint-err-line-patterns)
(when flymake-jslint-detect-trailing-comma
(add-to-list 'flymake-err-line-patterns
(if (executable-find "jsl")
(flymake-mode t)
(message "Not enabling flymake: jsl command not found")))
(provide 'flymake-js)
;;; flymake-jslint.el ends here
Jump to Line
Something went wrong with that request. Please try again.