Browse Source

add flymake-jshint package for emacs

pull/1/head
Brett Langdon 12 years ago
parent
commit
6547fb938c
6 changed files with 144 additions and 0 deletions
  1. +6
    -0
      emacs
  2. +18
    -0
      emacs.d/elpa/flymake-jshint-1.0/flymake-jshint-autoloads.el
  3. +1
    -0
      emacs.d/elpa/flymake-jshint-1.0/flymake-jshint-pkg.el
  4. BIN
      emacs.d/elpa/flymake-jshint-1.0/flymake-jshint-pkg.elc
  5. +119
    -0
      emacs.d/elpa/flymake-jshint-1.0/flymake-jshint.el
  6. BIN
      emacs.d/elpa/flymake-jshint-1.0/flymake-jshint.elc

+ 6
- 0
emacs View File

@ -28,6 +28,9 @@
;disable vc-git (dont use it and too slow to start up)
(setq vc-handled-backends nil)
;dont use tabs!
(setq-default indent-tabs-mode nil)
;auto-indent
(define-key global-map (kbd "RET") 'newline-and-indent)
@ -40,6 +43,9 @@
(require 'flymake-cursor)
(add-hook 'find-file-hook 'flymake-find-file-hook)
(require 'flymake-jshint)
(add-hook 'js-mode-hook 'flymake-mode)
(require 'projectile)
(setq projectile-completion-system 'grizzl)
(setq projectile-enable-caching t)


+ 18
- 0
emacs.d/elpa/flymake-jshint-1.0/flymake-jshint-autoloads.el View File

@ -0,0 +1,18 @@
;;; flymake-jshint-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
;;;### (autoloads nil nil ("flymake-jshint-pkg.el" "flymake-jshint.el")
;;;;;; (21025 54429 922272 0))
;;;***
(provide 'flymake-jshint-autoloads)
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; flymake-jshint-autoloads.el ends here

+ 1
- 0
emacs.d/elpa/flymake-jshint-1.0/flymake-jshint-pkg.el View File

@ -0,0 +1 @@
(define-package "flymake-jshint" "1.0" "making flymake work with JSHint" (quote nil))

BIN
emacs.d/elpa/flymake-jshint-1.0/flymake-jshint-pkg.elc View File


+ 119
- 0
emacs.d/elpa/flymake-jshint-1.0/flymake-jshint.el View File

@ -0,0 +1,119 @@
;;; flymake-jshint.el --- making flymake work with JSHint
;; Copyright (C) 2011 Wilfred Hughes <me@wilfred.me.uk>
;; Author: Wilfred Hughes <me@wilfred.me.uk>
;; Created: 23 June 2011
;; Version: 1.0
;; Keywords: flymake, jshint, javascript
;; This file is not part of GNU Emacs.
;; However, it is distributed under the same license.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary
;; To use JSHint with emacs, you will need JSHint installed and available on
;; your path. You should be able to do
;; $ jshint
;; without problem. To do this, you can install node.js, npm and
;; jshint by doing the following:
;; $ apt-get install nodejs # or your distro / OS equivalent
;; $ curl http://npmjs.org/install.sh | sh
;; $ npm install -g jshint
;; You will probably want to configure the warnings that JSHint
;; produces. The full list is at http://www.jshint.com/options/ but
;; for reference I use:
;; { "browser": true, //browser constants, such as alert
;; "curly": true, // require {} on one-line if
;; "undef": true, // non-globals must be declared before use
;; "newcap": true, // constructors must start with capital letter
;; "jquery": true, // jQuery constants
;; "nomen": false, // permit leading/trailing underscores, these do actually mean private in jQuery plugins
;; "nonew": true, // don't permit object creation for side-effects only
;; "strict": true // require "use strict";
;; }
;; Save this in a file called whatever.json and then set
;; jshint-configuration-path to point to it.
;;; Usage
;; Add to your emacs config:
;; (require 'flymake-jshint)
;; (add-hook 'js-mode-hook 'flymake-mode)
;; making sure that flymake-jshint.el is on your load-path. If not,
;; also add to your config:
;; (add-to-list 'load-path "~/.emacs.d/path/to/flymake-jshint.el")
;;; Debugging
;; If JSHint isn't working for any reason, execute
;; M-x set-variable flymake-log-level <RET> 3
;; and you will see what is going wrong listed in the *Messages*
;; buffer.
(require 'flymake)
(defcustom jshint-configuration-path nil
"Path to a JSON configuration file for JSHint."
:type 'string
:group 'flymake-jshint)
(defun flymake-jshint-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))))
(if jshint-configuration-path
(list "jshint" (list local-file "--config" (expand-file-name jshint-configuration-path)))
(list "jshint" (list local-file)))))
(setq flymake-allowed-file-name-masks
(cons '(".+\\.js$"
flymake-jshint-init
flymake-simple-cleanup
flymake-get-real-file-name)
flymake-allowed-file-name-masks))
(setq flymake-err-line-patterns
(cons '("^\\(.*\\): line \\([[:digit:]]+\\), col \\([[:digit:]]+\\), \\(.+\\)$"
1 2 3 4)
flymake-err-line-patterns))
; load flymake automatically in JavaScript mode
(add-hook 'js-mode-hook 'flymake-mode)
(provide 'flymake-jshint)
;;; flymake-jshint.el ends herep

BIN
emacs.d/elpa/flymake-jshint-1.0/flymake-jshint.elc View File


Loading…
Cancel
Save