JSLint for Eclipse installation and setting description

Source: Internet
Author: User
Tags bitwise bitwise operators svn hasownproperty

JSLint is a JavaScript program that looks to problems in JavaScript programs. It is acode quality tool

How to use Jslintfor Eclipse

Installation

Step One : Open Eclipse up in your machine and go to ' help '-> ' Install New Software '


Step Two: Click ' Add ' on the popup and Youwill have the screen as below.

With this screen where it says location add the following link:

https://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-

Phonegap/tags/jslint4java1/download

Then click ' OK '.




Step Three: Once The information has loadedchoose the options as shown

On the next screen below selecting ' Jslint4java '

and click Next. If have not install ' Javascript Development Tools ', selected it too.



Step Four: Keep clicking Next, your may have toaccept any license terms

And during installation you to get the screen

Below,don ' t worry, just click ' OK '.


Step Five: Openeclipseup on your machine and go to ' window '-> ' preferences ',

Click the item ' Jslint4java '

Checked some checkbox and input forsetting




Step Fix: Choosea project, Clicktheenablejslint4java,check The Eclipse head menu,

Clickproject->clean ..., then click Project->build Project.

If you are have many builder, can chooseonly one builder by

Right click ProjectName-> Properties->builders


If you are need one builder, you canedit the. project file of one project

Edit the file content as follow

<?xml version= "1.0" encoding= "UTF-8"?>
<projectDescription>
	<name>mr</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		< buildcommand>
			<name>com.googlecode.jslint4java.eclipse.jsLintBuilder</name>
			< arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>com.googlecode.jslint4java.eclipse.jsLintNature</nature>
	</natures>
</projectDescription>


JSLint Setting

Filter Code

Describe

Other

Adsafe

If Adsafe rules should be enforced

Whether to verify the third party JS Library Adsafe.

Bitwise

If bitwise operators should be allowed

If true, Shint disables the bitwise operator JavaScript allow bit arithmetic, but he does not have an integer, the bitwise operator converts the number of digits that participate in the operation into an integer, and then returns it after the operation. So they are less efficient than they are in other languages.

Browser

If the standard browser globals should be predefined

Whether a standard browser global variable should be predefined.

Caps

If Upper case HTML should is allowed

Whether to allow uppercase HTML tags.

Confusion

If types can be used inconsistently

Whether the variable uses the same type.

Continue

If the continuation statement should be tolerated

Whether to allow continuous declarations.

Css

If CSS workarounds should be tolerated

Whether to allow CSS fields.

Debug

IF Debugger statements should be allowed

Whether to allow debugger declarations.

Devel

If logging should be allowed (console, alert, etc.)

Whether to allow debugging JS.

Eqeqeq

If = = should be allowed

If true, JSLint will see if you are using either = = or!== in your code, instead of using = = and!=.


Filter Code

Describe

Other

Es5

If ES5 syntax should be allowed

Whether to allow ECMAScript 5 syntax

Evil

If Eval should be allowed

If true, JSLint allows the use of eval eval to provide access to the JavaScript compiler, which is sometimes useful, but also poses a risk of injecting your code into the attack and causing some difficulty to debug. Remember, the function constructor is also another ' eval ', and settimeout and setinterval are similar to eval when the incoming arguments are strings.

Forin

If statements need not filter

If true, then Jshint allows hasOwnProperty to be not present in the For In loop, which is typically used to traverse the properties of an object, including the attributes that he inherits from the prototype chain. And hasOwnProperty can determine whether an attribute is an attribute of the object itself rather than inherited.

Immed

IF immediate invocations must is wrapped in parens

If true, JSLint requires that anonymous functions be called as follows:

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

(function () {//bla bla}) ();

Laxbreak

If statement breaks should is checked

If true, JSLint does not check for line wrapping. JavaScript corrects some errors by automatically filling the full number, so this option can check for potential problems.

Newcap

If constructor names capitalization is ignored

If true, JSLint requires each constructor name to begin with a capital letter.


Filter Code

Describe

Other

Nomen

If names may have dangling _

If true, Jshint disables the underlined variable name. Many people use _name to name their variables to show that this is a private variable, but in fact, not, the underscore just makes a mark. If you want to use private variables, you can use closures to implement them.

On

If HTML event handlers should be allowed

Whether an HTML event handler is allowed.

Onevar

If only one var statement/function is allowed.

If true, the JSLint expected function is only declared once in the form of Var.

Passfail

If the scan should stop on the

If true, Jshint stops checking after the first error is found.

Plusplus

If increment/decrement should be allowed

If true, Jshint disables the self augmentation and decrement operations + + and--may bring some code reading confusion.

Regexp

If the. Should be allowed in regexp literals

If true, Jshint will not allow the use of. and [^ ...] Regular, because such a positive will often match to what you do not expect, and may be used to create some harm.

Rhino

If The Rhino environment globals should be predefined

Environment global variables that are rhino should be predefined.

Safe

If use of the some browser features should be restricted

If you use some browser features, you should be limited.

Strict

If the ' use strict '; pragma is optional

If it is true, Jshint will ask you to use the strict syntax. The Strict pattern is a new feature within ES5 that allows you to place a program or function in a "strict" scope. ECMAScript 5


Other setting

Describe

The mumber of spaces used for indentation

Specify the number of spaces between code

The maximum number of warnings reported

Maximum number of display errors

Maximum Line Length

Maximum number of characters per line

The names of predefined global variables

Pre-defined global variables


References


Jlint official website http://www.jslint.com/lint.html

Google Code specification Http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml

jquery Code Specification http://contribute.jquery.org/style-guide/js/



Related Article

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.