Skip to content

Commit

Permalink
change eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
potproject committed Dec 13, 2017
1 parent 92589cc commit 4073c40
Show file tree
Hide file tree
Showing 5 changed files with 692 additions and 151 deletions.
63 changes: 58 additions & 5 deletions .eslintrc.json
Expand Up @@ -15,14 +15,67 @@
},
"parser": "babel-eslint",
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
//constを変更してはいけない
"no-const-assign": "error",

//クラスのsuper()は最初に
"no-this-before-super": "error",

//未定義変数を使用しない
"no-undef": "error",

//return, throw, continueの後に処理書かない
"no-unreachable": "warn",

//未使用変数を警告
"no-unused-vars": "warn",

//クラスのextend時のみsuperを使えるようにする
"constructor-super": "warn",
"valid-typeof": "warn",

//typeofのタイプミス
"valid-typeof": "error",

//Reactの無駄ロード防止(JSX)
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error"

//ReactJSX使用時のno-unused-vars
"react/jsx-uses-vars": "error",

//ダブルクオート推奨
//O: console.log("test");
//X: console.log('test');
"quotes":"warn",

//if文等で必ず値を返す
//O: if(flag){return 1;}else{return 2;}
//X: if(flag){return 1;}else{return;}
"consistent-return":"error",

//中括弧必須
//O: if(flag){return 1;}
//X: if(flag)return 1;
"curly":"error",

//配列は可能な限りドットを使う
//O: array.name
//X: array["name"]
"dot-notation":"warn",

// != or == は非推奨
//O: 1 === num
//X: 1 == num
"eqeqeq":"warn",

//変な小数点の書き方防止
//O: var num = 0.1;
//X: var num = .1;
"no-floating-decimal":"error",

//eval()っぽい書き方防止
//O:setTimeout(()=>{console.log("hello");}, 100);
//X:setTimeout("console.log('hello');", 100);
"no-implied-eval":"error"

}
}
2 changes: 1 addition & 1 deletion .flowconfig
Expand Up @@ -57,4 +57,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=false

[version]
^0.55.0
^0.61.0

0 comments on commit 4073c40

Please sign in to comment.