Jshint Configuration Parameter Summary

Source: Internet
Author: User
Tags bitwise operators uppercase letter

Jshint Rules Reference Http://www.cnblogs.com/code/articles/4103070.html;http://www.htmlhifive.com/conts/web/view/library /jslint_jshint

Options Content Value Error message
Bitwise Disable bitwise operators (such as ^,&) Setting: TRUE; Do not set: false Unexpected use of '??? '. (When set to true)
Curly Use {} In statements such as if and while for explicit code blocks Setting: TRUE; Do not set: false Expected ' {' and instead saw '??? '.
Eqeqeq Use = = = and!== instead = = and! = Setting: TRUE; Do not set: false Use ' = = = ' to compare with ' null '.
Forin

Use Object.prototype.hasOwnProperty () in a for In loop to filter properties in the prototype chain

Setting: TRUE; Do not set: false The body of a for in should is wrapped in an if statement to filter unwanted properties from the prototype
Immed

Anonymous function calls must be

(function() {   // body }());

Instead of

(function() {   // body})();
这是为了表明,表达式的值是函数的结果,而不是函数本身。
Setting: TRUE; Do not set: false
Move the invocation into the parens that contain the function. ? Wrap an immediate function invocation in parentheses to assist the reader in understanding that the expression is the ResU Lt of a function, and not the function itself.
Latedef Prohibit use before variable definition Setting: TRUE; Do not set: false "Was??? Used before it was defined.
Newcap The first letter of the constructor name must be capitalized Setting: TRUE; Do not set: false A constructor name should start with the uppercase letter.
Noarg Prohibit the use of Arguments.caller and Arguments.callee Setting: TRUE; Do not set: false Avoid Arguments.callee.
Noempty Suppress empty blocks of code Setting: TRUE; Do not set: false Empty block.
Nonew Prohibit use of constructors Setting: TRUE; Do not set: false Don't use the ' new ' for side effects.
Plusplus Prohibit the use of + + and-- Setting: TRUE; Do not set: false Unexpected use of ' + '.
Undef Disallow use of undefined variables that are not in the global variable list Setting: TRUE; Do not set: false '??? ' is not defined.
Strict Strict mode for forcing the use of ES5 Setting: TRUE; Do not set: false Missing "use strict" statement.
Freeze

Disallow the prototype of a replicated native object (such as array, Date)

/* jshint freeze:true */Array.prototype.count = function (value) { return 4; };// -> Warning: Extending prototype of native object: ‘Array‘.

Setting: TRUE; Do not set: false Warning: Extending prototype of native object: ‘Array‘.
Asi Allow omitting semicolons Allow: true; Not allowed: false Missing semicolon.
Boss Allows assignment in if,for,while statements; using assignments in conditional statements is often a clerical error if (A = 10) {} Allow: true; Not allowed: false Expected a conditional expression and instead saw an assignment.
Debug Allow debugger statements Allow: true; Not allowed: false All ' debugger ' statements should is removed.
Eqnull

Allow ==null

==null is usually used to compare = = = null;=== undefined

Allow: true; Not allowed: false Use ' = = = ' to compare with ' ~ '.
Evil Allow use of eval Allow: true; Not allowed: false Eval is evil.
Expr Allow expressions to be used where assignments or function calls should occur Allow: true; Not allowed: false Expected an assignment or function call and instead saw an expression.
Iterator Allow __iterator__; not all browsers support __iterator__. Allow: true; Not allowed: false __iterator__ ' is only available in JavaScript 1.7.
Lastsemic

Allow single-line control blocks to omit semicolons

var name = (function() { return ‘Anton‘ }());

Allow: true; Not allowed: false Missing semicolon.
Laxbreak Allow unsafe line interrupts (used with Laxcomma) Allow: true; Not allowed: false Bad line breaking before ' ~ '.
Laxcomma Allow encoding style to begin with a comma Allow: true; Not allowed: false Comma warnings can be turned off with ' Laxcomma '.
Loopfunc Allow functions to be defined in loops Allow: true; Not allowed: false Don ' t make functions within a loop.
Onecase Allow a switch statement with only one case condition Allow: true; Not allowed: false This ' switch ' should is an ' if '.
Proto Allow Proto (not all browsers support __proto__.) Allow: true; Not allowed: false The ' __proto__ ' is deprecated. Against
Regexdash

To understand---"seems to understand that:

In the control statement of the regular expression, the beginning of the hyphen or the end of the square brackets-the existence of the tolerance.

Allow: true; Not allowed: false unescaped '-'.
Scripturl Allow: true; Not allowed: false
Shadow

Allow variable Shadow

function test() {    var x = 10;    if (true) {        var x = 20;    }    return x;}
Based on the function scope, there is no difference between defining variables and defining a single definition multiple times, but it can cause dyslexia.

Allow: true; Not allowed: false '??? ' is already defined.
Sub

Allow person[' name ']

Jshint recommend using Person.name instead of person[' name ']

Allow: true; Not allowed: false [‘???‘] is better written in dot notation.
Supernew Allow new function () {...} and new Object; Allow: true; Not allowed: false Weird construction. Delete
Validthis Allows the use of this in non-constructors in strict mode Allow: true; Not allowed: false Possible strict violation.

Jshint Configuration Parameter Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.