Javascript specifications and tools jslint

Source: Internet
Author: User
Specifications

Gooogle JavascriptSpecifications:

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

Jquery core style guidelines

Http://docs.jquery.com/JQuery_Core_Style_Guidelines

Dojo style guide

Http://o.dojotoolkit.org/developer/StyleGuide

70 expert ideas for better CSS Coding

Http://www.360doc.com/content/07/0512/12/18868_495822.shtml

Standardized inspection tools

Google jslint http://code.google.com/p/jslint-toolkit/

Jslint http://www.JSLint.com

Javascript lint http://www.JavaScriptLint.com/

Microsoft Ajax minifier http://aspnet.codeplex.com/releases/view/40584

Google jslint usage steps

Ensure jre1.5 or above is installed on the local machine

1. decompress the compressed package

2. Put the file to be checked in the scripts \ file directory, and change the "allowed des": ["scripts \ file"] in the config. JSON file to "allowed des": ["scripts \ file"],

3. Click Run. BAT to perform a standard check.

4. Check the out \ index.html file, check the violation, and modify the file again.

Compile JSCodeFirst, familiarize yourself with the doc \ index.htm file, have a familiarity with the standard conventions, and then write the code.

About jslintCheck other encoded files:

Jslint uses the rhino engine to execute JS checks. Run. bat uses the rhino shell to run. For reading files, the system completes the current default encoding.

Scripts \ source \ util. js

Readfile: function (PATH)

 
 
 
Readfile (PATH); this function is a pre-defined function of rhino shell. You can set the second parameter encoding to readfile (path, 'utf-8 '); you can analyze the UTF-8 encoding, and other encodings are also set
 
 
 
When vs2008 and vs2010 tools are used, the JS file is saved as a signed UTF-8 file by default [the first three bytes of the file are signatures], for such a file rhino can not deal with [can only deal with UTF-8 files without signature], in order to automate this problem, made a small tool, as shown below:
 
 
 
 
 

Specify the execution path of jslint, select the JS root path and the JS directory to be checked, and run the conversion command to view the result.

A green file indicates that the file complies with the specifications, and a red file indicates that the file violates the specifications. Locate the location and modify the file.

Note: js to be analyzedThe file directory cannot contain Chinese characters. Otherwise, the results cannot be displayed.

 

Download specific correction tool: http://jsfkit.codeplex.com/releases

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.