Skip to content

Commit

Permalink
Add Javascript coding standard and lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Feb 17, 2015
1 parent b588bcf commit fe12d8d
Show file tree
Hide file tree
Showing 4 changed files with 877 additions and 0 deletions.
26 changes: 26 additions & 0 deletions js/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.

# Set this file as the topmost .editorconfig
# (multiple files can be used, and are applied starting from current document location)
root = true

# Use hard or soft tabs ["tab", "space"]
indent_style = space

# Size of a single indent [an integer, "tab"]
indent_size = tab

# Number of columns representing a tab character [an integer]
tab_width = 4

# Line breaks representation ["lf", "cr", "crlf"]
end_of_line = lf

# ["latin1", "utf-8", "utf-16be", "utf-16le"]
charset = utf-8

# Remove any whitespace characters preceding newline characters ["true", "false"]
trim_trailing_whitespace = true

# Ensure file ends with a newline when saving ["true", "false"]
insert_final_newline = true
102 changes: 102 additions & 0 deletions js/.jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"catch"
],
"disallowKeywords": [
"with"
],
"disallowKeywordsOnNewLine": [
"else",
"catch"
],

"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceAfterBinaryOperators": true,

"disallowSpacesInsideParentheses": true,
"disallowEmptyBlocks": true,

"requireParenthesesAroundIIFE": true,
"requireSpacesInFunctionDeclaration": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningCurlyBrace": true
},

"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},

"disallowSpaceBeforeBinaryOperators": [
","
],
"requireCommaBeforeLineBreak": true,

"validateQuoteMarks": "'",
"disallowMultipleLineStrings": true,

"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"disallowYodaConditions": true,

"disallowSpacesInsideArrayBrackets": true,

"requireDotNotation": true,
"disallowSpaceAfterObjectKeys": true,
"disallowQuotedKeysInObjects": "allButReserved",

"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
},

"maximumLineLength": {
"value": 120,
"allowUrlComments": true
},
"requireSpaceAfterLineComment": true,
"requireLineFeedAtFileEnd": true,
"disallowMultipleLineBreaks": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"validateLineBreaks": "LF",

"excludeFiles": ["node_modules/**"]
}
32 changes: 32 additions & 0 deletions js/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"strict": true,
"curly": true,
"camelcase": true,
"undef": true,
"latedef": "nofunc",
"eqeqeq": true,
"browser": true,
"node": true,
"es3": true,
"es5": false,
"esnext": false,
"moz": false,
"newcap": true,
"quotmark": "single",
"maxlen": 120,
"indent": 4,
"noarg": true,
"bitwise": false,
"unused": true,
"globals": {
"define": false,
"require": false,

"describe" : false,
"it" : false,
"before" : false,
"beforeEach" : false,
"after" : false,
"afterEach" : false
}
}
Loading

0 comments on commit fe12d8d

Please sign in to comment.