Skip to content

Instantly share code, notes, and snippets.

@shinofara
Created April 19, 2013 08:45
Show Gist options
  • Save shinofara/5419010 to your computer and use it in GitHub Desktop.
Save shinofara/5419010 to your computer and use it in GitHub Desktop.
javascriptの自動テストに向けて、JSHintと呼ばれるJavascript用構文チェッカーを入れてみた。 ref: http://qiita.com/items/eeca05aaf556655b44f1
{
"indent" : 2, // インデント
"camelcase":true, // キャメルケース
"maxlen" : 80, // 一行の最大文字数
"unused" : true, // 宣言のみで使用していない変数を検出
"eqeqeq":true, // ==、!=の使用禁止
"undef" : true, // グローバル変数へのアクセスを禁止
"devel" : true // console、alertを許可
}
sudo su
cd /usr/local/src/
git clone https://github.com/creationix/nvm.git ~/.nvm
source ~/.nvm/nvm.sh
nvm install v0.11.0
$ node -v
v0.11.0
$ npm -v
1.2.15
$ jshint test.js
test.js: line 2, col 2, Expected 'return' to have an indentation at 3 instead at 2.
test.js: line 5, col 1, 'res' is not defined.
test.js: line 6, col 24, 'res' is not defined.
3 errors
$ jshint test.js
function x(a,b) {
return a + b;
}
var res = x(10,20);
console.log("res = " + res);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment