JavaScript refactoring (8): JSDoc and JSLint

Source: Internet
Author: User
Tags regex expression

JSDoc can generate API documents similar to JavaDoc, which is essential for front-end development.


 
Download jsdoc-tookit (http://code.google.com/p/jsdoc-toolkit/) and jsdoc-tookit-ant-task (http://code.google.com/p/jsdoc-toolkit-ant-task/), the escape Function of CSDN is problematic, so the angle brackets are replaced with the book name Number:
There are other similar tools. The DOC builder is essential to any mature front-end development team.
Xml Code
<Project default = "build-docs">
<Target name = "build-docs">
<Property name = "base" location = "."/>
<Taskdef name = "jsdoctoolkit" classname = "uk. co. darrenhurley. ant. tasks. jsDocToolkit "classpath =" jsdoc-toolkit-ant-task-1.1.0.jar; jsdoc-toolkit/java/classes/js. jar "/>
<Jsdoctoolkit template = "jsdoc" jsdochome = "$ {base}/jsdoc-toolkit/" outputdir = "$ {base}/output/">
<Source file = "portalone-common.js"/>
</Jsdoctoolkit>
</Target>
</Project>
 
JSLint is used for JavaScript code static check tool (http://jslint.com/), but this should not be open source; and need ruby runtime environment and gvim, and then with cscript engine, it is inconvenient to use. Online versions cannot be used in the project:


 
Eclipse has also developed the corresponding JSLint plugin, in addition, there is a very convenient tool jslint-toolkit (http://code.google.com/p/jslint-toolkit ):
Configure config. json first. The red font is the js directory to be checked:
Js Code
{
// JavaScript files to check
// "Includes": ["scripts // source", "scripts // jquery"],
"Includes": ["scripts // my"],
// Exclude files
"Excludes": [],
// Exclude file names (Regex expression)
"ExcludeNames": ["//. svn", "CVS"],
// Output directory
"OutPath": "out"
}
 
The output result is clear at a glance:

 

Author's "four-fire BLOG"
 

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.