Permalink
Browse files

no longer stomping on JSHINT namespace

updated readme
  • Loading branch information...
1 parent 3125bf5 commit 0c560a7fc169ce3740b8655cb6d7eeeb6c156c93 Sam Breed committed Feb 18, 2011
View
@@ -1,177 +1,12 @@
-jslint.vim
+jshint.vim
=============
-Vim plugin and command line tool for running [JSLint][].
+## This is a port of [jslint.vim][1] to use JSHint
-[JSLint]: http://jslint.com/
+Vim plugin and command line tool for running [JSHint][].
-JSLint is a handy tool that spots errors and common mistakes in
-JavaScript code.
+[JSHint]: http://jshint.com/
+[1]: https://github.com/hallettj/jslint.vim
-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][nodejs].
-
- [nodejs]: http://nodejs.org/
-
- 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.
-
-[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html "Vim documentation: quickfix"
-
-
-Alternative Plugins
----------------------
-
-There are other plugins for Vim that integrate [JavaScript Lint][]. JavaScript
-Lint is another JavaScript checker that is similar to JSLint.
-
-[JavaScript Lint]: http://www.javascriptlint.com/
-
-[jsl.vim][] uses Vim's compiler infrastructure making its use consistent with
-syntax checkers for other languages.
-
-[jsl.vim]: http://www.vim.org/scripts/script.php?script_id=2630
-
-[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.
-
-[javaScriptLint.vim]: http://www.vim.org/scripts/script.php?script_id=2578
-
-
-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
-
-
-License
----------
-
-Copyright (c) 2008-2011 Jesse Hallett <hallettj@gmail.com>, 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.
+moar to come soon...
@@ -33,26 +33,26 @@
*/
/*
- JSLINT is a global function. It takes two parameters.
+ JSHINT is a global function. It takes two parameters.
- var myResult = JSLINT(source, option);
+ var myResult = JSHINT(source, option);
The first parameter is either a string or an array of strings. If it is a
string, it will be split on '\n' or '\r'. If it is an array of strings, it
is assumed that each string represents one line. The source can be a
JavaScript text, or HTML text, or a JSON text, or a CSS text.
The second parameter is an optional object of options which control the
- operation of JSLINT. Most of the options are booleans: They are all
+ operation of JSHINT. Most of the options are booleans: They are all
optional and have a default value of false. One of the options, predef,
can be an array of names, which will be used to declare global variables,
or an object whose keys are used as global names, with a boolean value
that determines if they are assignable.
- If it checks out, JSLINT returns true. Otherwise, it returns false.
+ If it checks out, JSHINT returns true. Otherwise, it returns false.
- If false, you can inspect JSLINT.errors to find out the problems.
- JSLINT.errors is an array of objects containing these members:
+ If false, you can inspect JSHINT.errors to find out the problems.
+ JSHINT.errors is an array of objects containing these members:
{
line : The line (relative to 0) at which the lint was found
@@ -67,20 +67,20 @@
}
If a fatal error was found, a null will be the last element of the
- JSLINT.errors array.
+ JSHINT.errors array.
You can request a Function Report, which shows all of the functions
and the parameters and vars that they use. This can be used to find
implied global variables and other problems. The report is in HTML and
can be inserted in an HTML <body>.
- var myReport = JSLINT.report(limited);
+ var myReport = JSHINT.report(limited);
If limited is true, then the report will be limited to only errors.
You can request a data structure which contains JSHint's results.
- var myData = JSLINT.data();
+ var myData = JSHINT.data();
It returns a structure with this form:
@@ -213,7 +213,7 @@
implieds, in, inactiveborder, inactivecaption, inactivecaptiontext,
include, indent, indexOf, indianred, indigo, infobackground, infotext,
init, input, ins, isAlpha, isApplicationRunning, isArray, isDigit,
- isFinite, isNaN, ivory, join, jshint, JSLINT, json, kbd, keygen, keys, khaki,
+ isFinite, isNaN, ivory, join, jshint, JSHINT, json, kbd, keygen, keys, khaki,
konfabulatorVersion, label, labelled, lang, last, lavender,
lavenderblush, lawngreen, laxbreak, lbp, led, left, legend,
lemonchiffon, length, "letter-spacing", li, lib, lightblue, lightcoral,
@@ -269,9 +269,9 @@
// We build the application inside a function so that we produce only a single
// global variable. That function will be invoked immediately, and its return
-// value is the JSLINT function itself.
+// value is the JSHINT function itself.
-var JSLINT = (function () {
+var JSHINT = (function () {
"use strict";
var adsafe_id, // The widget's ADsafe id.
@@ -1155,7 +1155,7 @@ var JSLINT = (function () {
d: d
};
w.reason = m.supplant(w);
- JSLINT.errors.push(w);
+ JSHINT.errors.push(w);
if (option.passfail) {
quit('Stopping. ', l, ch);
}
@@ -2140,7 +2140,7 @@ loop: for (;;) {
}
-// This is the heart of JSLINT, the Pratt parser. In addition to parsing, it
+// This is the heart of JSHINT, the Pratt parser. In addition to parsing, it
// is looking for ad hoc lint patterns. We add .fud to Pratt's model, which is
// like .nud except that it is only used on the first token of a statement.
// Having .fud makes it much easier to define statement-oriented languages like
@@ -5465,11 +5465,11 @@ loop: for (;;) {
}
-// The actual JSLINT function itself.
+// The actual JSHINT function itself.
var itself = function (s, o) {
var a, i, k;
- JSLINT.errors = [];
+ JSHINT.errors = [];
predefined = Object.create(standard);
if (o) {
a = o.predef;
@@ -5617,14 +5617,14 @@ loop: for (;;) {
advance('(end)');
} catch (e) {
if (e) {
- JSLINT.errors.push({
+ JSHINT.errors.push({
reason : e.message,
line : e.line || nexttoken.line,
character : e.character || nexttoken.from
}, null);
}
}
- return JSLINT.errors.length === 0;
+ return JSHINT.errors.length === 0;
};
@@ -5848,7 +5848,7 @@ loop: for (;;) {
}());
-// Make JSLINT a Node module, if possible.
+// Make JSHINT a Node module, if possible.
if (typeof exports == 'object' && exports)
- exports.JSLINT = JSLINT;
+ exports.JSHINT = JSHINT;
@@ -1,7 +1,7 @@
/*jslint laxbreak: true */
if (typeof require != 'undefined') {
- JSLINT = require('./jshint').JSLINT;
+ JSHINT = require('./jshint').JSHINT;
print = require('sys').puts;
} else {
load('jshint.js');
@@ -70,15 +70,15 @@ var readSTDIN = (function() {
})();
readSTDIN(function(body) {
- var ok = JSLINT(body)
+ var ok = JSHINT(body)
, i
, error
, errorCount;
if (!ok) {
- errorCount = JSLINT.errors.length;
+ errorCount = JSHINT.errors.length;
for (i = 0; i < errorCount; i += 1) {
- error = JSLINT.errors[i];
+ error = JSHINT.errors[i];
if (error && error.reason && error.reason.match(/^Stopping/) === null) {
print([error.line, error.character, error.reason].join(":"));
}
@@ -1,7 +1,7 @@
<job>
<script src="jslint-core.js" language="javascript"></script>
<script language="javascript">
-/*global JSLINT load readline WScript */
+/*global JSHINT load readline WScript */
var readSTDIN = function() {
var line,
@@ -21,15 +21,15 @@ var readSTDIN = function() {
};
var body = readSTDIN() || arguments[0],
- ok = JSLINT(body),
+ ok = JSHINT(body),
i,
error,
errorCount;
if (!ok) {
- errorCount = JSLINT.errors.length;
+ errorCount = JSHINT.errors.length;
for (i = 0; i < errorCount; i += 1) {
- error = JSLINT.errors[i];
+ error = JSHINT.errors[i];
if (error && error.reason && error.reason.match(/^Stopping/) === null) {
WScript.echo([error.line, error.character, error.reason].join(":"));
}

0 comments on commit 0c560a7

Please sign in to comment.