Last active
August 29, 2015 14:08
-
-
Save HAKASHUN/731f9cdca33c240ffeb1 to your computer and use it in GitHub Desktop.
AngularJSのコードスタイル(jscs設定)見てみる ref: http://qiita.com/HAKASHUN@github/items/8f2431fed3ecb656efc3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"disallowKeywords": ["with"], | |
"disallowMixedSpacesAndTabs": true, | |
"disallowMultipleLineStrings": true, | |
"disallowNewlineBeforeBlockStatements": true, | |
"disallowSpaceAfterObjectKeys": true, | |
"disallowSpaceAfterPrefixUnaryOperators": ["!"], | |
"disallowSpaceBeforeBinaryOperators": [","], | |
"disallowSpacesInAnonymousFunctionExpression": { | |
"beforeOpeningRoundBrace": true | |
}, | |
"disallowSpacesInFunctionDeclaration": { | |
"beforeOpeningRoundBrace": true | |
}, | |
"disallowSpacesInNamedFunctionExpression": { | |
"beforeOpeningRoundBrace": true | |
}, | |
"disallowSpacesInsideParentheses": true, | |
"disallowTrailingComma": true, | |
"disallowTrailingWhitespace": true, | |
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], | |
"requireSpacesInFunction": { | |
"beforeOpeningCurlyBrace": true | |
}, | |
"validateParameterSeparator": ", " | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], | |
"requireSpaceAfterBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"], | |
"requireSpaceBeforeBinaryOperators": ["?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"], | |
"disallowImplicitTypeConversion": ["string"], | |
"disallowMultipleLineBreaks": true, | |
"disallowKeywordsOnNewLine": ["else"], | |
"requireLineFeedAtFileEnd": true, | |
"validateJSDoc": { | |
"checkParamNames": true, | |
"requireParamTypes": true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
function () {} | |
// オッケー | |
function() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
function a () {} | |
// オッケー | |
function a() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
var x = ( 1 + 2 ) * 3; | |
// オッケー | |
var x = (1 + 2) * 3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
var foo = [1, 2, 3, ]; | |
var bar = {a: "a", b: "b", } | |
// オッケー | |
var foo = [1, 2, 3]; | |
var bar = {a: "a", b: "b"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
var foo = "blah blah"; //<-- whitespace character here | |
// オッケー | |
var foo = "blah blah"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
if(x) { | |
x++; | |
} | |
//オッケー | |
if (x) { | |
x++; | |
} | |
// ダメ | |
return0; | |
// オッケー | |
return 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
function a(){} | |
//オッケー | |
function a() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
function a(b , c) {} | |
function a(b,c) {} | |
// オッケー | |
function a(b, c) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
if (x) x++; | |
// オッケー | |
if (x) { | |
x++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"?", ":", "+", "-", "/", "*", "%", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
with (x) { | |
prop++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
x +y; | |
x+y; | |
// オッケー | |
x + y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
x = '' + y; | |
// オッケー | |
x = String(y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x = 1; | |
x++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x = 1; | |
x++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
if (x < 0) { | |
x++; | |
} | |
else { | |
x--; | |
} | |
// オッケー | |
if (x < 0) { | |
x++; | |
} else { | |
x--; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
var x = "multi \ | |
line"; | |
// オッケー | |
var x = "multi" + | |
"line"; | |
var y = "single line"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bad() | |
{ | |
var obj = | |
{ | |
val: true | |
}; | |
return { | |
data: obj | |
}; | |
} | |
if (cond) | |
{ | |
foo(); | |
} | |
for (var e in elements) | |
{ | |
bar(e); | |
} | |
while (cond) | |
{ | |
foo(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function good(){ | |
var obj = { | |
val: true | |
}; | |
return { | |
data: obj | |
}; | |
} | |
if (cond){ | |
foo(); | |
} | |
for (var e in elements){ | |
bar(e); | |
} | |
while (cond){ | |
foo(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
var x = {a : 1}; | |
// オッケー | |
var x = {a: 1}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
x = ! y; | |
//オッケー | |
x = !y; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
var hoge = [1 , 2 , 3]; | |
// オッケー | |
var hoge = [1, 2, 3]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ダメ | |
function () {} | |
// オッケー | |
function() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment