Project: aptanastudio
Issue APSTUD-4842: Investigate JS Warnings from JSLint
||Id||Description||Details||JSLint Option||JSHint Option|| |a_label|'\{a\}' is a statement label.| Looks for references to label identifiers in code (not as break/continue jumps). | | | |a_not_allowed|'\{a\}' is not allowed.| {color:red}Appears to be unused.{color} | | | |a_not_defined	| '\{a\}' is not defined. | {color:red}Appears to be unused.{color} | | | |{color:green}a_scope{color}	| '\{a\}' used out of scope. | {color:red}Unable to trigger, even with example at http://stackoverflow.com/questions/2485171/jslint-out-of-scope-error{color} | | funscope | |{color:green}already_defined{color}	| '\{a\}' is already defined. | Looks for variables defined multiple times (not in global scope). | | shadow | |and	| The '&&' subexpression should be wrapped in parens. | Looks for && inside \|\| expression. Warning. | |assign_exception	| Do not assign to the exception parameter. | Looks for assignment to errors in catch blocks. Warning. | |{color:green}assignment_function_expression{color}	| Expected an assignment or function call and instead saw an expression. | Looks for statements without any assignment or function call - which indicates unused code. (say 1+2;) | | expr | |{color:green}avoid_a{color}	| Avoid '\{a\}'. | Looks for calls to 'arguments.callee' and 'arguments.caller'. Warning. | | noarg | |bad_assignment	| Bad assignment. | Checks for assignments to non-identifiers, or to arguments array/object. Warning. | |bad_constructor	| Bad constructor. | Looks for construction where an expression is used in place of identifier (like a ternary to choose the function) | | | |bad_in_a	| Bad for in variable '\{a\}'. | Looks for non-local vars in for in loops. | | | |bad_invocation	| Bad invocation. | Looks for '()' calls with a non-identifer left-hand side (and not '.', '[', '(', '&&', '\|\|', or '?') like "/regexp/(7);'. See https://github.com/douglascrockford/JSLint/blob/master/jslint.js#L3599 | | | |bad_new	| Do not use 'new' for side effects. | Looks for new Foo() without assignment. | | | |bad_number	| Bad number '\{a\}'. | Looks for numbers outside the allowable range of -1.7976931348623157e+308 to 1.7976931348623157e+308 (Number.MAX_VALUE). Warning. | |{color:green}bad_operand{color}	| Bad operand. | Looks for ++ and -- operands with non-identifier first tokens (i.e. '!foo++') | plusplus | plusplus | |{color:green}bad_wrap{color}	| Do not wrap function literals in parens unless they are to be immediately invoked. | Checks for functions wrapped in parens that are not immediately invoked (followed by paren pair). | | immed | |combine_var	| Combine this with the previous 'var' statement. | Looks for variable declarations on separate lines/statements that can be combined. | | vars | |{color:green}conditional_assignment{color}	| Expected a conditional expression and instead saw an assignment. | Looks for assignments inside if/switch/while/do-while/for(second statement)/left-side of ternary/either side of \|\| and && | | boss | |confusing_a	| Confusing use of '\{a\}'. | Looks for use of '+++', '---' and specific cases of '!' negation. | | | |confusing_regexp	| Confusing regular expression. | Looks for '/' or '*' at end of regexp. (i.e. '/regexp//') | | | |{color:green}constructor_name_a{color} |	A constructor name '\{a\}' should start with an uppercase letter. | Looks for calls to 'new something()' where 'something' is just a lowercase identifier. Warning. | newcap | newcap | |control_a	| Unexpected control character '\{a\}'. | checks for control characters in strings (checks if character is less than ' ') | |{color:green}dangling_a{color}	| Unexpected dangling '_' in '\{a\}'. | if 'nomen' option is false (default is true) and identifier starts or ends with '_' character | | proto | |dangerous_comment	| Dangerous comment. | Looks for comments with content matching /@cc\|<\/?\|script\|\]\s*\]\|<\s*!\|</i | safe | | |deleted	| Only properties should be deleted. | Looks for delete keyword before identifiers to ensure it's a property using '.' or '[' access. Warning. | |duplicate_a	| Duplicate '\{a\}'. | Looks for duplicate case, duplicate ES5 getter/setter, duplicate JSON property string. | | | |{color:green}empty_block{color}	| Empty block. | Looks for blocks with no code (for/if/else/catch/function/etc) | | noempty | |empty_case	| Empty case. | Looks for empty case blocks in switch statements. Warning. | | | |empty_class	| Empty class. | Looks for an empty '[]' inside a regexp. Warning. | | | |{color:green}es5{color}	| This is an ES5 feature. | Looks for ES5 getters, or line continuations inside strings (\ before EOL in middle of string). | es5 | es5 |{color:green}evil{color}	| eval is evil. | Looks for calls to 'eval' or 'execScript' (globally, on object, on object using [] notation) if 'evil' option is false. Warning. | evil | evil | |{color:green}expected_a{color}	| Expected '\{a\}'. | If in JSON mode and string doesn't use double quotes (expects '"'). ? Also relates to unexpected spaces | white/es5 | trailing | |expected_identifier_a	| Expected an identifier and instead saw '\{a\}'. | Looks for missing identifiers (say in var decls) | | | |{color:green}expected_identifier_a_reserved{color}	| Expected an identifier and instead saw '\{a\}' (a reserved word). | Looks for use of a reserved word in place of an identifier (say in var names or function names) | es5 | esnext | |expected_number_a	| Expected a number and instead saw '\{a\}'. | Looks for digits 0-9 inside \{\} counts in regexps. | | | |expected_operator_a	| Expected an operator and instead saw '\{a\}'. | {color:red}Unable to reproduce.{color} | | | |{color:green}for_if{color}	| The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype. | Looks for for (x in foo) with an if statement in the block. Basically looking for checking properties in objects. | forin | forin | |function_block	| Function statements should not be placed in blocks . Use a function expression or move the statement to the top of the outer function. | Looks for functions declared in blocks (for/while/do/else/if/etc). | | | |{color:green}function_eval{color}	| The Function constructor is eval. | Looks for calls to Function() constructor if 'evil' option is false. Warning. | evil | evil | |{color:green}function_loop{color}	| Don't make functions within a loop. | Looks for functions or get/setters defined inside loops. (function_block is checked first, so to trigger you need to assign function to something so we get "prefix" function rule rather than "statement" function rule). | | loopfunc | |function_statement	| Function statements are not invocable . Wrap the whole function invocation in parens. | Looks for parens after function declaration. (self-invoking, but no assignment) | | | |function_strict	| Use the function form of 'use strict'. | Looks of ruse of "use strict"; in top-level/global scope, or as part of multiple statements on same line (not the first statement in that list.) | | | |html_confusion_a	| HTML confusion in regular expression '<\{a\}'. |Looks for '','<=','>=') for 'NaN'. Warning. | |label_a_b	| Label '\{a\}' on '\{b\}' statement. | {color:red}Unused.{color} | | | |leading_decimal_a	| A leading decimal point can be confused with a dot: '.\{a\}'. | Looks for numbers with leading '.'. Warning. | |missing_use_strict	| Missing 'use strict' statement. | Looks for "use strict"; at top of function/try bodies. | | sloppy | |move_invocation	| Move the invocation into the parens that contain the function. | Looks for self-invoking function where invocation parens are outside the set of parents wrapping the function declaration. | | | |move_var	| Move 'var' declarations to the top of the function. | Looks for var declarations inside 'for' first segment. | | | |name_function	| Missing name in function statement. | Looks for 'function ()' (function with no name). Error. | |nested_comment | Nested comment. | Looks for nested '/*' inside multiline comments. | | | |not_a_constructor	| Do not use \{a\} as a constructor. | Don't call constructor for 'Number', 'String', 'Boolean', 'Math', 'JSON' | | | |not_a_defined	| '\{a\}' has not been fully defined yet. | {color:red}Appears to be unused.{color} | | | |not_a_function	| '\{a\}' is not a function. | Looks for calls to Math/JSON as a function. | | | |not_a_label	| '\{a\}' is not a label. | Looks for break/continue jumps to labels that don't exist. | | | |{color:green}not_a_scope{color}	| '\{a\}' is out of scope. | {color:red}Unable to reproduce.{color} | | funscope | |not_greater	| '\{a\}' should not be greater than '\{b\}'. | Looks for use of \{\} counting in regexps with first number greater than second. | |octal_a | Don't use octal: '\{a\}'. Use '\u....' instead. | Looks for escaped 0-6 digit in string (i.e. \0). | | | |parameter_a_get_b	| Unexpected parameter '\{a\}' in get \{b\} function. | Looks for ES5 getter with parameters (should have none). | | | |parameter_arguments_a | Do not mutate parameter '\{a\}' when using 'arguments'. | Looks for assignment to any function's params when body refers to arguments array. | | | |parameter_set_a	| Expected parameter (value) in set \{a\} function. | Looks for ES5 setter function, ensures it has one parameter with name 'value'. | |radix | Missing radix parameter. | Calls to parseInt with one arg. Warning. | |read_only	| Read only. | Looks for assignment to predefined objects like Array or Object. | | | |redefinition_a	| Redefinition of '\{a\}'. | {color:red}Appears to be unused{color} | | | |{color:green}reserved_a{color}	| Reserved name '\{a\}'. | checks if an identifier token is '\_\_iterator\_\_' or '\_\_proto\_\_'. Error. | | iterator/proto | |slash_equal	| A regular expression literal can be confused with '/='. | Looks for '/='. | | | |{color:green}strange_loop{color}	| Strange loop. | Checks do, for, while loops for break/return/continue/throw (at top-level of block, not inside condition). Warning. | | curly | |{color:green}strict{color}	| Strict violation. | Looks for access to this inside function after "use strict"; or access to arguments in global scope after "use strict";. | strict | strict | |{color:green}subscript{color}	| ['\{a\}'] is better written in dot notation. | Checks for [''] notation property access when 'sub' option is false. String must be an identifier and not reserved. Warning. | | sub | |sync_a | Unexpected sync method: '\{a\}'. | Looks for method calls containing 'Sync' in their name if 'stupid' option is false. Warning. | stupid | | |trailing_decimal_a	| A trailing decimal point can be confused with a dot: '.\{a\}'. | Checks for numbers ending in '.' character. Warning. | |{color:green}unescaped_a{color}	| Unescaped '\{a\}'. | Looks for unescaped '/', '^', [', ']', ')', '(', '+', '-', '*' in regexps | | regexp | |{color:green}unexpected_a{color}	| Unexpected '\{a\}'. | if a hex character is {code}i >= 32 && i <= 126 && i !== 34 && i !== 92 && i !== 39{code}. Also, looks for use of ++ and -- if 'plusplus' option is false. {color:red}Is this definition complete? Seems to relate to a number of things{color} | bitwise/plusplus/debug | bitwise/plusplus/debug | |unexpected_property_a	| Unexpected /\*property\*/ '\{a\}'. | Looks for assignment/use of a property (in code) that is declared in special properties directive in comments. | | | |unnecessary_initialize	| It is not necessary to initialize '\{a\}' to 'undefined'. | Looks for 'var foo = undefined;' statements. | | | |unnecessary_use	| Unnecessary 'use strict'. | Looks for multiple "use strict"; in scope. | | | |unreachable_a_b	| Unreachable '\{a\}' after '\{b\}'. | Looks for unreachable statements (after break/continue/return) | | | |unsafe	| Unsafe character. | Looks for any control character in the source with a match against: {code}/[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/{code} | |{color:green}url{color}	| JavaScript URL. | Checks string or range tokens, label names, combined 'primitive' strings from '+' concat against regexp: {code}jx = /^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i{code} | | scripturl | |use_array	| Use the array literal notation []. | Checks for 'new Array();', 'new Array', and 'string.split(1)'. Warning. | |{color:green}use_braces{color}	| Spaces are hard to count. Use \{\{a\}\}. | Checks regexps for continuous spaces and asks user to replace with explicit count of spaces using \{2\} notation. Warning. | | curly | |use_charAt	| Use the charAt method. | {color:red}Appears to be unused/unchecked{color} | |use_object	| Use the object literal notation \{\}. | Checks for 'new Object()' or 'var foo = Object()'. Warning. | |use_or	| Use the \|\| operator. | If a ternary's first and second objects (before and after '?') are 'similar'\*. Warning. | |use_param	| Use a named parameter. | Checks for access to 'arguments' array with a number. Warning. | |{color:green}used_before_a{color} | '\{a\}' was used before it was defined. | If 'undef' option is false and if the variable is not in scope, and is not predefined, and if we are not in the global scope, then we have an undefined variable error. Or if a function is called inside another function and has not yet been defined. Warning. | undef | latedef/undef | |var_a_not	| Variable \{a\} was not declared correctly. | Checks for broken var assignment (here 'foo') of form {code}var bar = foo = 'something';{code}. Error. | |weird_assignment	| Weird assignment. | Checks if left and right of '=' assigment are 'similar\*. Warning | |weird_condition	| Weird condition. | Checks if left and right of '\|\|' or '&&' are 'similar\*. Also checks if condition keyword is followed by a non-infix '-'. Lastly checks if condition keyword is followed by '\{' or '(.'. Warning. | |{color:green}weird_new{color}	| Weird construction. Delete 'new'. | Checks for 'new function'? Warning. | | supernew | |weird_program	| Weird program. | Checks if we've hit a 'disrupting' statement (return/break/continue/throw) at the top-level? Warning. | |weird_relation	| Weird relation. | Checks if left and right of comparators are 'similar'\*, or both are either numbers or strings. Checks '==', '===', '===','!=', '!==', '!==', '<', '>', '<=', '>='. Warning. | |weird_ternary	| Weird ternary. | If the two values we're choosing between are 'similar'\*. Warning. | |{color:green}wrap_immediate{color}	| Wrap an immediate function invocation in parentheses to assist the reader in understanding that the expression is the result of a function, and not the function itself. | Checks if function is declared and then immediately invoked for it's return value. See http://stackoverflow.com/questions/939386/immediate-function-invocation-syntax. Warning. | | immed | |wrap_regexp	| Wrap the /regexp/ literal in parens to disambiguate the slash operator. | Checks for regexp following a 'return' keyword. Warning | |write_is_wrong	| document.write can be a form of eval. | If 'evil' option is false and there's a call to 'document.write' or 'document.writeln'. Warning. |
Story points: 40