• Stars
    star
    462
  • Rank 94,832 (Top 2 %)
  • Language
    JavaScript
  • License
    Other
  • Created almost 16 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

VIM plugin and command line tool for running JSLint <http://jslint.com/>. This is project is no longer under active development. See Readme for details.

This project is no longer under active development. For alternatives take a look at the Alternative Plugins section below. Or check out the actively developed forks of this project: wookiehangover/jshint.vim and FuDesign2008/jslint.vim.

jslint.vim

Vim plugin and command line tool for running JSLint.

JSLint is a handy tool that spots errors and common mistakes in JavaScript code.

The source code for jslint.vim is hosted at http://github.com/hallettj/jslint.vim.

This is alpha software and is under heavy development.

Installation

  • Make sure you have a JavaScript interpreter installed. On Linux jslint.vim supports Spidermonkey, Rhino, and node.js. Spidermonkey or node.js are recommended because Rhino tends to have a long startup time.

    In Ubuntu you can install the Spidermonkey shell with this command:

      $ sudo apt-get install spidermonkey-bin
    

    Latest Ubuntu versions don't have spidermonkey in the default repositories. You can use rhino instead:

      $ sudo apt-get install rhino
    

    Or you can find instructions for installing node.js on the node.js website.

    On Windows you can use cscript.exe - which is probably already installed.

    On MacOS X you don't need to install any JavaScript interpreter because one is included with OS X by default.

  • If you have rake installed, run:

      $ rake install
    

    Otherwise copy the directory ftplugin/ into your Vim ftplugin directory. Usually this is ~/.vim/ftplugin/. On Windows it is ~/vimfiles/ftplugin/.

  • Finally, activate filetype plugins in your .vimrc, by adding the following line:

      filetype plugin on
    

Usage

  • This plugin automatically checks the JavaScript source and highlights the lines with errors.

    It also will display more information about the error in the commandline if the curser is in the same line.

  • You also can call it manually via :JSLintUpdate

  • You can toggle automatic checking on or off with the command :JSLintToggle. You can modify your ~/.vimrc file to bind this command to a key or to turn off error checking by default.

  • (optional) Add any valid JSLint options to ~/.jslintrc file, they will be used as global options for all JavaScript files. For example:

      /*jslint browser: true, regexp: true */
      /*global jQuery, $ */
    
      /* vim: set ft=javascript: */
    

To get a detailed report of any issues in your JavaScript file outside of Vim, run the bin/jslint executable in a terminal. For example:

$ bin/jslint ftplugin/jslint/fulljslint.js

You can copy bin/jslint into for PATH for easier access. The executable requires that the Vim plugin is installed and also requires Ruby.

To disable error highlighting altogether add this line to your ~/.vimrc file:

let g:JSLintHighlightErrorLine = 0

Working with quickfix

When automatic error checking is enabled jslint.vim will automatically display errors in the quickfix window in addition to highlighting them.

You can open and close the quickfix window with the commands :copen and :cclose. Use the command :cn to go to the next error or :cc [nr] to go to a specific error, where [nr] is a number. The first error in the list is 1, the second is 2, and so on.

Once an error is fixed the corresponding quickfix line will disappear.

Alternative Plugins

Syntastic supports syntax checking for a number of languages, including JavaScript via jshint or JSLint.

There are other plugins for Vim that integrate JavaScript Lint. JavaScript Lint is another JavaScript checker that is similar to JSLint.

jsl.vim uses Vim's compiler infrastructure making its use consistent with syntax checkers for other languages.

javaScriptLint.vim runs the contents of a JavaScript file through JavaScript Lint after the file's buffer is saved and places any warnings in the quickfix error window.

Credits

  • Jesse Hallett -- original author
  • Nathan Smith -- Windows compatibility, quickfix integration, better OS X compatibility, support for node.js, and other improvements
  • Travis Jeffery -- Easy plugin installation with rake
  • Sam Goldstein -- Display of problem report for the current line and bug fixes
  • Bryan Chow -- Fixes for formatting issues and typos
  • Jeff Buttars -- Options to remove and to disable error highlighting
  • Rainux Luo -- Support for reading JSLint options from a ~/.jslintrc file, Pathogen compatibility on Windows
  • Pascal Hartig -- Support for running jslint with rhino and other updates
  • Martin SchΓΌrrer -- Fixing path issues and error handling
  • Nik Graf -- Documentation updates
  • Ian McCracken -- Real-time error checking
  • Luke Smith -- Enhancement of OS X support
  • Michael Smith -- Feature to customize JavaScript executable that is used by setting JS_CMD environment variable
  • SzilΓ‘gyi Szilveszter -- Fixes for bugs when running in Windows
  • Yasuhiro Matsumoto -- Pathogen compatibility and :JSLintToggle command
  • Ben Loveridge -- Integrated quickfix with automatic error checking
  • Brian Egan -- Documentation for enabling filetype plugins
  • Trent Mick -- Feature to ignore #! lines for compatibility with shell scripts
  • Christopher Sexton -- Fixed errors in MacVim on Lion and Snow Leopard
  • Brian Donovan -- Fix for non-POSIX shells
  • guileen (Lin Gui) -- Prefer node over jsc on Mac OS
  • daethorian (Lowe Thiderman) -- Fix for error in updated spidermonkey version
  • afairley -- Check for nodejs executable if node is not present

License

Copyright (c) 2008-2012 Jesse Hallett [email protected], except where otherwise noted

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The Software shall be used for Good, not Evil.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

git-format-staged

Git command to transform staged files using a formatting command
TypeScript
155
star
2

safety-lens

Type-safe, functional lens library
JavaScript
73
star
3

zaml

Fast yaml serialization in pure Ruby
Ruby
55
star
4

bitable

An implementation of a distributed hash table in Javascript, using WebRTC to connect peers. This is a work-in-progress and is not yet ready to use!
JavaScript
34
star
5

LambdaCalculus

Scala implementation of a lambda calculus interpreter
Scala
28
star
6

dot-vim

This is my vim configuration.
Lua
16
star
7

sunshine

JavaScript application framework, based on React
JavaScript
13
star
8

dot-xmonad

This is my xmonad configuration.
Haskell
10
star
9

comparing-go-and-rust

This is companion code for the post http://sitr.us/2017/02/21/changes-i-would-make-to-go.html
Rust
10
star
10

config_files

My config files for *nix environments. Clone this repo in your home directory for instant configuration.
Vim Script
9
star
11

estimate_tracking_for_lighthouse

A Greasemonkey script that provides time estimate totals for open tickets on milestone pages in Lighthouse
JavaScript
9
star
12

buscatcher

Location-aware wep app displays arrival times for nearby bus lines. This is alpha software: the software and interfaces will be subject to dramatic changes
JavaScript
8
star
13

restful_captcha

A standalone server that provides CAPTCHA images and that verifies answers to CAPTCHA challenges. The main repo is now at http://github.com/copious/restful_captcha
Ruby
8
star
14

flow-cookbook-hacker-news

Example script to demonstrate type-checking API data with Flow
JavaScript
7
star
15

tagging_for_nautilus

A set of Nautilus scripts that add functions for tagging files using Tracker
6
star
16

redux-instant

Minimize boilerplate in your Redux app by inferring type-safe action creators from your reducer
TypeScript
5
star
17

rhinautheros

OAuth as a replacement for cookie authentication in web apps
JavaScript
5
star
18

github_beacon

Better Lighthouse integration for Github
Ruby
5
star
19

cluster.js

Cluster analysis implemented in JavaScript. This software is pre-alpha quality and is under heavy development.
JavaScript
5
star
20

no_creeper_griefing

Datapack for Minecraft Java edition that prevents creeper explosions from destroying blocks
mcfunction
5
star
21

openid_authentication_for_hobo

Extends Hobo's user model and authentication support to use OpenID for authentication instead of passwords.
Ruby
4
star
22

rust_graphql_server_demo

Rust
4
star
23

dot-files

This is the base configuration for my workstations.
Perl
3
star
24

redstone-designer

A little project for learning about game programming with Bevy
Rust
3
star
25

hacker-news-ts

Example to demonstrate type-checking API data with TypeScript
TypeScript
3
star
26

flow-cookbook-react

Demonstration applying Flow typechecking to a React app
JavaScript
3
star
27

graphql-starter

Example of a GraphQL client & server with end-to-end type safety using graphql-codegen
TypeScript
3
star
28

party_mix_for_rdio

Adds an "Add 25 random songs to Queue" button on the Rdio Collection view.
JavaScript
2
star
29

sendxmpp.rb

Workalike of sendxmpp implemented in Ruby with xmpp4r
2
star
30

game

my first javascript came written using Crafty
JavaScript
2
star
31

openid-example

Sample app demonstrating OpenID authentication in Node.js using Passport and Express
JavaScript
2
star
32

cloudrcs

A revision control system implemented in Ruby and based on darcs
Ruby
2
star
33

etiquette.js

Code reuse in JavaScript inspired by Clojure protocols and Haskell type classes
JavaScript
2
star
34

locutoria

experimental email client - work in progress
Haskell
2
star
35

jsonp_proxy

Adds JSONP support to any website by proxying requests and modifying the response.
Ruby
2
star
36

couch_history

Save your shell history with CouchDB. Based on Shell Sink. This is alpha software and is under heavy development.
2
star
37

monopl4r

Get the most out of your Monopoly money with cutting edge online banking.
2
star
38

projecteuler

My solutions to the problems at http://projecteuler.net/
Ruby
2
star
39

calagator.jive

Jive app that provides integration with Calagator. This is a work-in-progress - it is not yet functional.
JavaScript
1
star
40

xaos

Prototypal inheritance pattern for JavaScript
JavaScript
1
star
41

aichallenge

my work-in-progress solution to the 2011 challenge at aichallenge.org
Scala
1
star
42

sitr.us

My personal blog
JavaScript
1
star
43

hallettj.github.com

sitr.us - Jesse Hallett's personal blog
HTML
1
star
44

industrial-beans

Data packs for vanilla Minecraft that add in-world crafting, and other tweaks for automation
Makefile
1
star
45

dot-zsh

This is my vim configuration.
Shell
1
star
46

pdxjs_vote_system

1
star
47

home.nix

My personal dot files / Home Manager config
Lua
1
star