jshint 检查js文件代码规范

1. 安装

npm install -g jshint 


2.使用

1)单文件

jshint   main.js

2)文件夹

$ jshint  folder/*

输出类似下面的,对应修改就行了:


js/main.js: line 1, col 20, Missing semicolon.

js/main.js: line 2, col 24, Missing semicolon.

js/main.js: line 3, col 20, Missing semicolon.

js/main.js: line 6, col 17, Missing semicolon.

js/main.js: line 5, col 10, 'add' is defined but never used.

 

3.参考

文档:http://jshint.com/docs/

你可能感兴趣的:(javascript)