Introduction to JSLint
JavaScript is a language with flexible syntax and loose format requirements. The code format is messy and some language features are incorrectly used, this often makes the final delivered product contain many unforeseen behaviors or errors caused by coding style conventions. If this habitual problem is not pointed out and modified in time, it is often repeated in the project iteration process, seriously affecting the stability and security of Web products.
JSLint is exactly the tool Douglas Crockford created to solve such problems. In addition to pointing out these unreasonable conventions, JSLint can also mark structural problems. Although JSLint cannot ensure that the Code logic is correct, it helps to discover errors and teach developers some good coding practices. It is worth mentioning that the JSLint tool itself is also a piece of JavaScript code, which is a JavaScript script that tests the quality of JavaScript code.
JSLint's JavaScript script Quality Detection mainly includes the following aspects:
- Check syntax error: for example, the matching error of braces.
- Variable definition specification: for example, the detection of undefined variables.
- Code format specification: for example, the absence of semicolons at the end of a sentence.
- Usage detection of poor language features: such as restrictions on eval and.
Currently, there are many JavaScript code detection tools like JSLint, including YUI Test, Firebug, MS Script Debugger, and CompanionJS, most of them exist in the form of browser plug-ins in the client browser for JavaScript runtime detection and debugging. The important difference between JSLint and these tools is that it pays more attention to static code format detection, this is exactly what we need and advocate for continuous building in the current hot agile development.
Several Methods for installing the JSLint plug-in Eclipse
When installing JSLint, I have referred to several methods on the Internet, which are as follows:
Method 1:
Step One: Open Eclipse up on your machine and go to ‘Help’ -> ‘Install New Software’Step Two: Click ‘add’ and to stuff the location with the following link:
https://svn.codespot.com/a/eclipselabs.org/mobile-web-development-with-phonegap/tags/jslint4java1/download then click ‘ok’.Step Three: Selecting ‘Javascript Development Tools’ and ‘jslint4java’ and click next.
Method 2:
Step One: Download jslint4javaStep Two: Put jslint4java.jar somewhereStep Three: Add an external tool configuration in Eclipse: Location: /usr/bin/java(or your path to javaw.exe) Arguments: -jar /path/to/jslint4java.jar ${resource_loc}
Method 3:
1. Help -> Install new software2. Click the 'Add' button Name : Rockstar Apps (or whatever you want) Location : http://update.rockstarapps.com/site.xml3. expend the selection and check Rockstar JsLint4. Click 'Next'...again5. Accept and install (you'll have to hit okay when it prompts you about installing unsigned content).6. Restart Eclipse...
References
1. http://www.ibm.com/developerworks/cn/web/1105_linlin_jslint/
2. http://stackoverflow.com/questions/2741058/jslint-eclipse-plugin
3. http://www.andyjamesdavies.com/javascript/installing-jslint-on-eclipse-ide
Recommended reading by bloggers
- Recommended articles for Web developers and Designers [Series 1]
- Recommended articles for Web developers and Designers [Series 2]
- Recommended articles for Web developers and Designers [Series 3]
- Recommended articles for Web developers and Designers [series 4]
- Recommended articles for Web developers and Designers [Series 5]
- Recommended articles for Web developers and Designers [Series 6]
Address: Use JSLint in Eclipse to ensure JavaScript code Quality
Source: mxsky ◆ focus on front-end development technology ◆ share web design resources