Permalink
Browse files

Updated to latest version of jslint.

  • Loading branch information...
1 parent 4c4c1fc commit 2f186ab432e6e7e55c2f704e08c87995c7311d7f @magnars committed Feb 17, 2012
Showing with 63 additions and 10 deletions.
  1. +16 −0 changelog.md
  2. +47 −10 vendor/jslint.js
View
@@ -0,0 +1,16 @@
+Changes from 0.1.5 to 1.0.0
+---------------------------
+
+Autolint now uses [semantic versioning](http://semver.org).
+
+* The configuration file is no longer a `json`-file, but a proper node
+ module. Add `module.exports =` to the start of the file and rename to
+ `autolint.js` to upgrade.
+* Autolint no longer runs without a config file. Running it without one will
+ prompt you for a default config file to be created.
+* Passing `--once` to autolint makes it not-so-auto. Instead it is run once,
+ exiting with a `-1` error code if any lint is found. This makes it well
+ suited for pre-commit-hooks and the like.
+* Updated bundled versions of jslint and jshint - these have been significantly
+ changed since last, so your configuration file will certainly need an upgrade
+ too.
View
@@ -1,5 +1,5 @@
// jslint.js
-// 2012-02-03
+// 2012-02-16
// Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
@@ -202,8 +202,8 @@
// For example:
/*properties
- '\b', '\t', '\n', '\f', '\r', '!=', '!==', '"', '%', '\'', '(begin)',
- '(breakage)', '(context)', '(error)', '(identifier)', '(line)',
+ '\b', '\t', '\n', '\f', '\r', '!=', '!==', '"', '%', '\'', '(arguments)',
+ '(begin)', '(breakage)', '(context)', '(error)', '(identifier)', '(line)',
'(loopage)', '(name)', '(params)', '(scope)', '(token)', '(vars)',
'(verb)', '*', '+', '-', '/', '<', '<=', '==', '===', '>',
'>=', ADSAFE, Array, Date, E, Function, LN10, LN2, LOG10E, LOG2E,
@@ -281,9 +281,9 @@
'outline-color', 'outline-style', 'outline-width', output, overflow,
'overflow-x', 'overflow-y', p, padding, 'padding-bottom', 'padding-left',
'padding-right', 'padding-top', 'page-break-after', 'page-break-before',
- param, parameter_a_get_b, parameter_set_a, params, paren, parent, parse,
- passfail, pc, plusplus, pop, position, postscript, pre, predef,
- preventExtensions, print, progress, projection, properties,
+ param, parameter_a_get_b, parameter_arguments_a, parameter_set_a, params,
+ paren, parent, parse, passfail, pc, plusplus, pop, position, postscript,
+ pre, predef, preventExtensions, print, progress, projection, properties,
propertyIsEnumerable, prototype, pt, push, px, q, quote, quotes, r, radix,
range, raw, read_only, reason, redefinition_a, reduce, reduceRight, regexp,
replace, report, reserved, reserved_a, reverse, rhino, right, rp, rt, ruby,
@@ -564,6 +564,7 @@ var JSLINT = (function () {
not_a_scope: "'{a}' is out of scope.",
not_greater: "'{a}' should not be greater than '{b}'.",
octal_a: "Don't use octal: '{a}'. Use '\\u....' instead.",
+ parameter_arguments_a: "Do not mutate parameter '{a}' when using 'arguments'.",
parameter_a_get_b: "Unexpected parameter '{a}' in get {b} function.",
parameter_set_a: "Expected parameter (value) in set {a} function.",
radix: "Missing radix parameter.",
@@ -2786,6 +2787,11 @@ klass: do {
} else {
stop('read_only');
}
+ funct['(params)'].forEach(function (value) {
+ if (value.string === left.string) {
+ value.assign = true;
+ }
+ });
} else if (option.safe) {
l = left;
do {
@@ -3207,6 +3213,7 @@ klass: do {
} else if (option.safe) {
warn('adsafe_a', x);
}
+ funct['(arguments)'] = true;
});
reservevar('eval', function (x) {
if (option.safe) {
@@ -3631,9 +3638,15 @@ klass: do {
no_space();
step_out(')', this);
if (value.id === 'function') {
- if (next_token.id === '(') {
+ switch (next_token.id) {
+ case '(':
warn('move_invocation');
- } else {
+ break;
+ case '.':
+ case '[':
+ warn('unexpected_a');
+ break;
+ default:
warn('bad_wrap', this);
}
}
@@ -3803,7 +3816,7 @@ klass: do {
if (next_token.id === ')') {
no_space();
step_out(')', paren);
- return;
+ return params;
}
for (;;) {
edge();
@@ -3846,6 +3859,13 @@ klass: do {
func.first = funct['(params)'] = function_params();
one_space();
func.block = block(false);
+ if (funct['(arguments)']) {
+ func.first.forEach(function (value) {
+ if (value.assign) {
+ warn('parameter_arguments_a', value, value.string);
+ }
+ });
+ }
funct = old_funct;
option = old_option;
scope = old_scope;
@@ -4067,6 +4087,23 @@ klass: do {
if (funct['(loopage)']) {
warn('function_loop');
}
+ switch (next_token.id) {
+ case ';':
+ case '(':
+ case ')':
+ case ',':
+ case ']':
+ case '}':
+ case ':':
+ break;
+ case '.':
+ if (peek().string !== 'bind' || peek(1).id !== '(') {
+ warn('unexpected_a');
+ }
+ break;
+ default:
+ stop('unexpected_a');
+ }
this.arity = 'function';
return this;
});
@@ -6364,7 +6401,7 @@ klass: do {
};
itself.jslint = itself;
- itself.edition = '2012-02-03';
+ itself.edition = '2012-02-16';
return itself;
}());

0 comments on commit 2f186ab

Please sign in to comment.