Permalink
Browse files

init import

  • Loading branch information...
1 parent 1220f2d commit 23a8a6fa200897c53c0ad66553b536b0b5a66d7b @tavisrudd committed Jun 14, 2012
Showing with 47 additions and 0 deletions.
  1. +47 −0 flymake-coffeelint.el
View
@@ -0,0 +1,47 @@
+(require 'flymake)
+
+;;; see https://github.com/ajkavanagh/coffeelintnode
+;;; https://github.com/kui/flymake-coffeescript/blob/master/flymake-coffeescript.el
+;;;
+
+(defcustom flymake-coffeelint-program "coffeelint.sh"
+ "The JSHint program name."
+ :type 'string
+ :group 'flymake-coffeelint)
+
+(defcustom flymake-coffeelint-config nil
+ "If non-nil, specifies the location of the JSHint configuration file to use."
+ :type 'string
+ :group 'flymake-coffeelint)
+
+(defun flymake-coffeelint-init ()
+ (let* ((temp-file (flymake-init-create-temp-buffer-copy
+ 'flymake-create-temp-inplace))
+ (local-file (file-relative-name
+ temp-file
+ (file-name-directory buffer-file-name)))
+ (arglist (list local-file)))
+ (if flymake-coffeelint-config
+ (setq arglist (append arglist (list "--config" (expand-file-name flymake-coffeelint-config)))))
+ (list flymake-coffeelint-program arglist)))
+
+(setq flymake-err-line-patterns
+ (cons '(" +✗ *#\\([[:digit:]]+\\): \\(.+\\)$"
+ nil 1 nil 2)
+ flymake-err-line-patterns))
+;;; ✗ #16: Line contains a trailing semicolon.
+
+(setq flymake-err-line-patterns
+ (cons '("Error: Parse error on line \\([[:digit:]]+\\): \\(.+\\)$"
+ nil 1 nil 2)
+ flymake-err-line-patterns))
+
+(setq flymake-err-line-patterns
+ (cons '("SyntaxError:\\(.+\\) on line \\([[:digit:]]+\\)$"
+ nil 2 nil 1)
+ flymake-err-line-patterns))
+
+(add-to-list 'flymake-allowed-file-name-masks
+ '(".+\\.coffee$" flymake-coffeelint-init))
+
+(provide 'flymake-coffeelint)

0 comments on commit 23a8a6f

Please sign in to comment.