Skip to content

Commit

Permalink
option.stupid
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascrockford committed Mar 30, 2012
1 parent e91bb61 commit 449848f
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 61 deletions.
18 changes: 9 additions & 9 deletions jslint.html
Expand Up @@ -151,7 +151,7 @@
above and click a&nbsp;<input type="button" name="jslint" value="JSLint">&nbsp;
button.</div>
<div style="text-align: center; margin: 1em; border: 2px solid black; padding: 1em; background-color: papayawhip;">
<big>Warning! JSLint will hurt your feelings.</big></div>
<big>Warning!&nbsp;JSLint will hurt your feelings.</big></div>
</div>
<pre id="JSLINT_TREE"></pre>
<p>
Expand Down Expand Up @@ -194,32 +194,32 @@
<td title="rhino">Assume&nbsp;<a href="http://www.mozilla.org/rhino/">Rhino</a></td>
<td><span title="eqeq">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="eqeq">Tolerate&nbsp;<code>==</code>&nbsp;and&nbsp;<code>!=</code></td>
<td><span title="sub">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="sub">Tolerate&nbsp;inefficient&nbsp;subscripting</td>
<td><span title="stupid">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="stupid">Tolerate&nbsp;stupidity</td>
</tr>
<tr>
<td><span title="widget">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="widget">Assume a&nbsp;<a href="http://widgets.yahoo.com/tools/">Yahoo Widget</a></td>
<td><span title="es5">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="es5">Tolerate&nbsp;ES5&nbsp;syntax</td>
<td><span title="vars">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="vars">Tolerate many&nbsp;<tt>var</tt>&nbsp;statements per function</td>
<td><span title="sub">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="sub">Tolerate&nbsp;inefficient&nbsp;subscripting</td>
</tr>
<tr>
<td><span title="windows">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="windows">Assume&nbsp;Windows</td>
<td><span title="evil">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="evil">Tolerate&nbsp;<tt>eval</tt></td>
<td><span title="white">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="white">Tolerate&nbsp;messy&nbsp;white space</td>
<td><span title="vars">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="vars">Tolerate many&nbsp;<tt>var</tt>&nbsp;statements per function</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><span title="forin">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="forin">Tolerate&nbsp;<a href="http://yuiblog.com/blog/2006/09/26/for-in-intrigue/">unfiltered</a>&nbsp;<tt>for</tt>&nbsp;<tt>in</tt></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><span title="white">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
<td title="white">Tolerate&nbsp;messy&nbsp;white space</td>
</tr>
<tr>
<td><span title="passfail">&nbsp;&nbsp;&nbsp;&nbsp;</span></td>
Expand Down
110 changes: 58 additions & 52 deletions jslint.js
@@ -1,5 +1,5 @@
// jslint.js
// 2012-03-27
// 2012-03-29

// Copyright (c) 2002 Douglas Crockford (www.JSLint.com)

Expand Down Expand Up @@ -183,6 +183,7 @@
// undef true, if variables can be declared out of order
// unparam true, if unused parameters should be tolerated
// sloppy true, if the 'use strict'; pragma is optional
// stupid true, if really stupid practices are tolerated
// sub true, if all forms of subscript notation are tolerated
// vars true, if multiple var statements per function should be allowed
// white true, if sloppy whitespace is tolerated
Expand All @@ -202,49 +203,50 @@
// For example:

/*properties
'\b', '\t', '\n', '\f', '\r', '!=', '!==', '"', '%', '\'', '(arguments)',
'(begin)', '(breakage)', '(context)', '(error)', '(identifier)', '(line)',
'(loopage)', '(name)', '(params)', '(scope)', '(token)', '(vars)', '(verb)',
'*', '+', '-', '/', '<', '<=', '==', '===', '>', '>=', ADSAFE,
Array, Date, Function, Object, '\\', a, a_label, a_not_allowed,
a_not_defined, a_scope, abbr, acronym, address, adsafe, adsafe_a,
adsafe_autocomplete, adsafe_bad_id, adsafe_div, adsafe_fragment, adsafe_go,
adsafe_html, adsafe_id, adsafe_id_go, adsafe_lib, adsafe_lib_second,
adsafe_missing_id, adsafe_name_a, adsafe_placement, adsafe_prefix_a,
adsafe_script, adsafe_source, adsafe_subscript_a, adsafe_tag, all,
already_defined, and, anon, applet, apply, approved, area, arity, article,
aside, assign, assign_exception, assignment_function_expression, at,
attribute_case_a, audio, autocomplete, avoid_a, b, background,
'background-attachment', 'background-color', 'background-image',
'background-position', 'background-repeat', bad_assignment, bad_color_a,
bad_constructor, bad_entity, bad_html, bad_id_a, bad_in_a, bad_invocation,
bad_name_a, bad_new, bad_number, bad_operand, bad_style, bad_type, bad_url_a,
bad_wrap, base, bdo, big, bitwise, block, blockquote, body, border,
'border-bottom', 'border-bottom-color', 'border-bottom-left-radius',
'border-bottom-right-radius', 'border-bottom-style', 'border-bottom-width',
'border-collapse', 'border-color', 'border-left', 'border-left-color',
'border-left-style', 'border-left-width', 'border-radius', 'border-right',
'border-right-color', 'border-right-style', 'border-right-width',
'border-spacing', 'border-style', 'border-top', 'border-top-color',
'border-top-left-radius', 'border-top-right-radius', 'border-top-style',
'border-top-width', 'border-width', bottom, br, braille, browser, button, c,
call, canvas, cap, caption, 'caption-side', center, charAt, charCodeAt,
character, cite, clear, clip, closure, cm, code, col, colgroup, color,
combine_var, command, conditional_assignment, confusing_a, confusing_regexp,
constructor_name_a, content, continue, control_a, 'counter-increment',
'counter-reset', create, css, cursor, d, dangerous_comment, dangling_a, data,
datalist, dd, debug, del, deleted, details, devel, dfn, dialog, dir,
direction, display, disrupt, div, dl, dt, duplicate_a, edge, edition, else,
em, embed, embossed, empty, 'empty-cells', empty_block, empty_case,
empty_class, entityify, eqeq, errors, es5, eval, evidence, evil, ex,
exception, exec, expected_a, expected_a_at_b_c, expected_a_b,
expected_a_b_from_c_d, expected_at_a, expected_attribute_a,
expected_attribute_value_a, expected_class_a, expected_fraction_a,
expected_id_a, expected_identifier_a, expected_identifier_a_reserved,
expected_lang_a, expected_linear_a, expected_media_a, expected_name_a,
expected_nonstandard_style_attribute, expected_number_a, expected_operator_a,
expected_percent_a, expected_positive_a, expected_pseudo_a,
expected_selector_a, expected_small_a, expected_space_a_b, expected_string_a,
'\b', '\t', '\n', '\f', '\r', '!', '!=', '!==', '"', '%', '\'',
'(arguments)', '(begin)', '(breakage)', '(context)', '(error)',
'(identifier)', '(line)', '(loopage)', '(name)', '(params)', '(scope)',
'(token)', '(vars)', '(verb)', '*', '+', '-', '/', '<', '<=', '==',
'===', '>', '>=', ADSAFE, Array, Date, Function, Object, '\\', a,
a_label, a_not_allowed, a_not_defined, a_scope, abbr, acronym, address,
adsafe, adsafe_a, adsafe_autocomplete, adsafe_bad_id, adsafe_div,
adsafe_fragment, adsafe_go, adsafe_html, adsafe_id, adsafe_id_go, adsafe_lib,
adsafe_lib_second, adsafe_missing_id, adsafe_name_a, adsafe_placement,
adsafe_prefix_a, adsafe_script, adsafe_source, adsafe_subscript_a,
adsafe_tag, all, already_defined, and, anon, applet, apply, approved, area,
arity, article, aside, assign, assign_exception,
assignment_function_expression, at, attribute_case_a, audio, autocomplete,
avoid_a, b, background, 'background-attachment', 'background-color',
'background-image', 'background-position', 'background-repeat',
bad_assignment, bad_color_a, bad_constructor, bad_entity, bad_html, bad_id_a,
bad_in_a, bad_invocation, bad_name_a, bad_new, bad_number, bad_operand,
bad_style, bad_type, bad_url_a, bad_wrap, base, bdo, big, bitwise, block,
blockquote, body, border, 'border-bottom', 'border-bottom-color',
'border-bottom-left-radius', 'border-bottom-right-radius',
'border-bottom-style', 'border-bottom-width', 'border-collapse',
'border-color', 'border-left', 'border-left-color', 'border-left-style',
'border-left-width', 'border-radius', 'border-right', 'border-right-color',
'border-right-style', 'border-right-width', 'border-spacing', 'border-style',
'border-top', 'border-top-color', 'border-top-left-radius',
'border-top-right-radius', 'border-top-style', 'border-top-width',
'border-width', bottom, br, braille, browser, button, c, call, canvas, cap,
caption, 'caption-side', center, charAt, charCodeAt, character, cite, clear,
clip, closure, cm, code, col, colgroup, color, combine_var, command,
conditional_assignment, confusing_a, confusing_regexp, constructor_name_a,
content, continue, control_a, 'counter-increment', 'counter-reset', create,
css, cursor, d, dangerous_comment, dangling_a, data, datalist, dd, debug,
del, deleted, details, devel, dfn, dialog, dir, direction, display, disrupt,
div, dl, dt, duplicate_a, edge, edition, else, em, embed, embossed, empty,
'empty-cells', empty_block, empty_case, empty_class, entityify, eqeq, errors,
es5, eval, evidence, evil, ex, exception, exec, expected_a,
expected_a_at_b_c, expected_a_b, expected_a_b_from_c_d, expected_at_a,
expected_attribute_a, expected_attribute_value_a, expected_class_a,
expected_fraction_a, expected_id_a, expected_identifier_a,
expected_identifier_a_reserved, expected_lang_a, expected_linear_a,
expected_media_a, expected_name_a, expected_nonstandard_style_attribute,
expected_number_a, expected_operator_a, expected_percent_a,
expected_positive_a, expected_pseudo_a, expected_selector_a,
expected_small_a, expected_space_a_b, expected_string_a,
expected_style_attribute, expected_style_pattern, expected_tagname_a,
expected_type_a, f, fieldset, figure, filter, first, flag, float, floor,
font, 'font-family', 'font-size', 'font-size-adjust', 'font-stretch',
Expand Down Expand Up @@ -279,9 +281,9 @@
reserved, reserved_a, rhino, right, rp, rt, ruby, safe, samp, scanned_a_b,
screen, script, search, second, section, select, shift, slash_equal, slice,
sloppy, small, sort, source, span, speech, split, src, statement_block,
stopping, strange_loop, strict, string, strong, style, styleproperty, sub,
subscript, substr, sup, supplant, t, table, 'table-layout', tag_a_in_b,
tbody, td, test, 'text-align', 'text-decoration', 'text-indent',
stopping, strange_loop, strict, string, strong, stupid, style, styleproperty,
sub, subscript, substr, sup, supplant, sync_a, t, table, 'table-layout',
tag_a_in_b, tbody, td, test, 'text-align', 'text-decoration', 'text-indent',
'text-shadow', 'text-transform', textarea, tfoot, th, thead, third, thru,
time, title, toLowerCase, toString, toUpperCase, token, too_long, too_many,
top, tr, trailing_decimal_a, tree, tt, tty, tv, type, u, ul, unclosed,
Expand All @@ -292,10 +294,10 @@
unreachable_a_b, unrecognized_style_attribute_a, unrecognized_tag_a, unsafe,
unused, url, urls, use_array, use_braces, use_charAt, use_object, use_or,
use_param, used_before_a, var, var_a_not, vars, 'vertical-align', video,
visibility, was, weird_assignment, weird_condition, weird_new,
weird_program, weird_relation, weird_ternary, white, 'white-space', widget,
width, windows, 'word-spacing', 'word-wrap', wrap, wrap_immediate,
wrap_regexp, write_is_wrong, writeable, 'z-index'
visibility, was, weird_assignment, weird_condition, weird_new, weird_program,
weird_relation, weird_ternary, white, 'white-space', widget, width, windows,
'word-spacing', 'word-wrap', wrap, wrap_immediate, wrap_regexp,
write_is_wrong, writeable, 'z-index'
*/

// The global directive is used to declare global variables that can
Expand Down Expand Up @@ -355,6 +357,7 @@ var JSLINT = (function () {
undef : true,
unparam : true,
sloppy : true,
stupid : true,
sub : true,
vars : true,
white : true,
Expand Down Expand Up @@ -560,6 +563,7 @@ var JSLINT = (function () {
strange_loop: "Strange loop.",
strict: "Strict violation.",
subscript: "['{a}'] is better written in dot notation.",
sync_a: "Unexpected sync method: '{a}'.",
tag_a_in_b: "A '<{a}>' must be within '<{b}>'.",
too_long: "Line too long.",
too_many: "Too many errors.",
Expand Down Expand Up @@ -3646,6 +3650,8 @@ klass: do {
} else if (!option.evil && left && left.string === 'document' &&
(name === 'write' || name === 'writeln')) {
warn('write_is_wrong', left);
} else if (!option.stupid && name.indexOf('Sync') > 0) {
warn('sync_a', token);
} else if (option.adsafe) {
if (!adsafe_top && left.string === 'ADSAFE') {
if (name === 'id' || name === 'lib') {
Expand Down Expand Up @@ -6388,7 +6394,7 @@ klass: do {
};
itself.jslint = itself;

itself.edition = '2012-03-27';
itself.edition = '2012-03-29';

return itself;
}());

0 comments on commit 449848f

Please sign in to comment.