http://www.jslint.com/lint.html
http://blog.8-p.info/2010/15-spidermonkey-jslint
http://insnvlovn.blogspot.com/2010/03/jslint.html
上記のurlの内容の設定例です。
一番上のリンクからテキストをコピーして修正します。
js-1.8.0-rc1.tar.gz を /usr/local/src/spidermonkey/js/src/Linux_All_DBG.OBJ/js にインストールします。
$ diff jslint.js.orig jslint.js 1c1 < load(environment.HOME + '/bin/js/fulljslint.js'); --- > load('/usr/local/bin/jslintLib/fulljslint.js'); 32c32,41 < })(arguments[0], arguments[1]); --- > })(arguments[0], slurp()); > > function slurp() { > var ln; > var result = ''; > while ((ln = readline()) !== null) { > result += ln + '\n'; > } > return result; > } $ diff jslint.sh.orig jslint 8c8,10 < js ~/bin/js/jslint.js $1 "`cat $1`" --- > cat $1 | /usr/local/src/spidermonkey/js/src/Linux_All_DBG.OBJ/js \ > /usr/local/stow/jslint-2010-04-01/bin/jslintLib/jslint.js $1 >
サイズの大きいjsファイルで動くことを確認します。
$ ./jslint prototype.js | head -n10 prototype.js:22:7:Missing semicolon. prototype.js:34:10:Expected '{' and instead saw 'return'. prototype.js:40:16:['__proto__'] is better written in dot notation. prototype.js:40:37:['__proto__'] is better written in dot notation. prototype.js:40:59:['__proto__'] is better written in dot notation. prototype.js:54:29:Missing semicolon. prototype.js:58:4:Expected '{' and instead saw 'Prototype'. prototype.js:83:26:Unnecessary semicolon. prototype.js:87:8:Expected '{' and instead saw 'parent'. prototype.js:99:38:Missing '()' invoking a constructor.
0 件のコメント:
コメントを投稿