Code Monkey home page Code Monkey logo

jshint-mode's Introduction

jshint-mode

Integrate JSHint into Emacs via a node.js server.

example

jshint-mode was heavily inspired by Kevin Turners lintnode.

Dependencies

Building

download or clone

$ git clone git://github.com/daleharvey/jshint-mode.git

Usage

Add the configuration to your .emacs config file:

$jshint-emacs-conf >> ~/.emacs  // or
$npm explore jshint-mode
Exploring /Users/yourname/node_modules/jshint-mode
Type 'exit' or ^D when finished

bash-3.2$ exit

or if you downloaded manually:

(add-to-list 'load-path "~/path/to/jshint-mode")
(require 'flymake-jshint)
(add-hook 'javascript-mode-hook
     (lambda () (flymake-mode t)))

Becareful: If you emacs can't find node program, maybe you should add some config to .emacs like this:

(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
(setq exec-path
      '(
	"/usr/local/bin"
	"/usr/bin"
	))

You can use M-x flymake-mode to turn flymake of and on, if you want to turn it on be fault, add the following to your .emacs

;; Turns on flymake for all files which have a flymake mode
(add-hook 'find-file-hook 'flymake-find-file-hook)

Using .jshintrc

By default, jshint-mode will search for the nearest .jshintrc file up the directory tree from the location of each JS file you edit.

Alternatively, you can customize the jshint-mode-jshintrc variable to set the location of a .jshintrc file that will always be used (and will be the only one used).

Custom installations of jshint/jslint

You can use jshint-mode-jshint-path/jshint-mode-jslint-path to set the require path for the jshint module.

For the global installation of jshint, you can set jshint-mode-jshint-path to "jshint"

(setq jshint-mode-jshint-path "jshint")

Or for other installations you can point to the corresponding library via the absolute path. Eg:

(setq jshint-mode-jshint-path
 "/home/rohan/.local/lib/node_modules/jshint/src/jshint.js")

By default, jshint-mode will use the bundled snapshots the linting tools.

Note to Emacs.app users

If use Emacs.app on OS X, you need to set the following environment variables:

  • PATH - Add path to your node executable

jshint-mode's People

Contributors

carljm avatar crodjer avatar daleharvey avatar diasjorge avatar jmalonzo avatar theotheo avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.