├── .editorconfig ├── .esformatter ├── .eslintignore ├── .eslintrc ├── .jsbeautifyrc ├── .jscsrc ├── .jshintignore ├── .jshintrc ├── Beautify.md ├── Editing.md ├── Linting.md ├── Readme.md ├── app ├── .meteor │ ├── .finished-upgraders │ ├── .gitignore │ ├── .id │ ├── .meteor │ │ ├── .finished-upgraders │ │ ├── .gitignore │ │ ├── .id │ │ ├── packages │ │ ├── platforms │ │ ├── release │ │ └── versions │ ├── packages │ ├── platforms │ ├── release │ └── versions ├── client │ ├── addLink │ │ ├── addLink.html │ │ └── addLink.js │ ├── client.js │ ├── lib │ │ ├── configuration.js │ │ ├── helpers.js │ │ └── router.js │ ├── linksList │ │ ├── linksList.html │ │ └── linksList.js │ ├── loginRequest.html │ ├── main.html │ └── styles.css ├── common │ ├── collections.js │ └── methods.js └── server │ ├── app.js │ └── fixtures.js ├── build └── sonar-project.properties └── configs ├── .eslintrc-base ├── .eslintrc-base-commented ├── .jscsrc-base └── .jshintrc-base /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true -------------------------------------------------------------------------------- /.esformatter: -------------------------------------------------------------------------------- 1 | { 2 | "preset": "default", 3 | "indent": { 4 | "value": " ", 5 | "ArrayExpression": 1, 6 | "AssignmentExpression": 1, 7 | "BinaryExpression": 1, 8 | "ConditionalExpression": 1, 9 | "CallExpression": 1, 10 | "CatchClause": 1, 11 | "DoWhileStatement": 1, 12 | "ForInStatement": 1, 13 | "ForStatement": 1, 14 | "FunctionDeclaration": 1, 15 | "FunctionExpression": 1, 16 | "IfStatement": 1, 17 | "MemberExpression": 1, 18 | "MultipleVariableDeclaration": 1, 19 | "ObjectExpression": 1, 20 | "ReturnStatement": 1, 21 | "SwitchCase": 1, 22 | "SwitchStatement": 1, 23 | "TopLevelFunctionBlock": 1, 24 | "TryStatement": 1, 25 | "VariableDeclaration.LogicalExpression": 1, 26 | "WhileStatement": 1 27 | }, 28 | "lineBreak": { 29 | "value": "\n", 30 | "before": { 31 | "AssignmentExpression": ">= 1", 32 | "AssignmentOperator": 0, 33 | "BlockStatement": 0, 34 | "CallExpression": -1, 35 | "ConditionalExpression": ">=1", 36 | "CatchOpeningBrace": 0, 37 | "CatchClosingBrace": ">=1", 38 | "CatchKeyword": 0, 39 | "DeleteOperator": ">=1", 40 | "DoWhileStatement": ">=1", 41 | "DoWhileStatementOpeningBrace": 0, 42 | "DoWhileStatementClosingBrace": ">=1", 43 | "EndOfFile": -1, 44 | "EmptyStatement": -1, 45 | "FinallyKeyword": -1, 46 | "FinallyOpeningBrace": 0, 47 | "FinallyClosingBrace": ">=1", 48 | "ForInStatement": ">=1", 49 | "ForInStatementExpressionOpening": 0, 50 | "ForInStatementExpressionClosing": 0, 51 | "ForInStatementOpeningBrace": 0, 52 | "ForInStatementClosingBrace": ">=1", 53 | "ForStatement": ">=1", 54 | "ForStatementExpressionOpening": 0, 55 | "ForStatementExpressionClosing": "<2", 56 | "ForStatementOpeningBrace": 0, 57 | "ForStatementClosingBrace": ">=1", 58 | "FunctionExpression": 0, 59 | "FunctionExpressionOpeningBrace": 0, 60 | "FunctionExpressionClosingBrace": ">=1", 61 | "FunctionDeclaration": ">=1", 62 | "FunctionDeclarationOpeningBrace": 0, 63 | "FunctionDeclarationClosingBrace": ">=1", 64 | "IfStatement": ">=1", 65 | "IfStatementOpeningBrace": 0, 66 | "IfStatementClosingBrace": ">=1", 67 | "ElseIfStatement": 0, 68 | "ElseIfStatementOpeningBrace": 0, 69 | "ElseIfStatementClosingBrace": ">=1", 70 | "ElseStatement": 0, 71 | "ElseStatementOpeningBrace": 0, 72 | "ElseStatementClosingBrace": ">=1", 73 | "LogicalExpression": -1, 74 | "ObjectExpressionClosingBrace": ">=1", 75 | "Property": ">=1", 76 | "ReturnStatement": -1, 77 | "SwitchOpeningBrace": 0, 78 | "SwitchClosingBrace": ">=1", 79 | "ThisExpression": -1, 80 | "ThrowStatement": ">=1", 81 | "TryKeyword": -1, 82 | "TryOpeningBrace": 0, 83 | "TryClosingBrace": ">=1", 84 | "VariableName": ">=1", 85 | "VariableValue": 0, 86 | "VariableDeclaration": ">=1", 87 | "VariableDeclarationWithoutInit": ">=1", 88 | "WhileStatement": ">=1", 89 | "WhileStatementOpeningBrace": 0, 90 | "WhileStatementClosingBrace": ">=1" 91 | }, 92 | "after": { 93 | "AssignmentExpression": ">=1", 94 | "AssignmentOperator": 0, 95 | "BlockStatement": 0, 96 | "CallExpression": -1, 97 | "CatchOpeningBrace": ">=1", 98 | "CatchClosingBrace": ">=0", 99 | "CatchKeyword": 0, 100 | "ConditionalExpression": ">=1", 101 | "DeleteOperator": ">=1", 102 | "DoWhileStatement": ">=1", 103 | "DoWhileStatementOpeningBrace": ">=1", 104 | "DoWhileStatementClosingBrace": 0, 105 | "EmptyStatement": -1, 106 | "FinallyKeyword": -1, 107 | "FinallyOpeningBrace": ">=1", 108 | "FinallyClosingBrace": ">=1", 109 | "ForInStatement": ">=1", 110 | "ForInStatementExpressionOpening": "<2", 111 | "ForInStatementExpressionClosing": -1, 112 | "ForInStatementOpeningBrace": ">=1", 113 | "ForInStatementClosingBrace": ">=1", 114 | "ForStatement": ">=1", 115 | "ForStatementExpressionOpening": "<2", 116 | "ForStatementExpressionClosing": -1, 117 | "ForStatementOpeningBrace": ">=1", 118 | "ForStatementClosingBrace": ">=1", 119 | "FunctionExpression": ">=1", 120 | "FunctionExpressionOpeningBrace": ">=1", 121 | "FunctionExpressionClosingBrace": -1, 122 | "FunctionDeclaration": ">=1", 123 | "FunctionDeclarationOpeningBrace": ">=1", 124 | "FunctionDeclarationClosingBrace": ">=1", 125 | "IfStatement": ">=1", 126 | "IfStatementOpeningBrace": ">=1", 127 | "IfStatementClosingBrace": ">=1", 128 | "ElseIfStatement": ">=1", 129 | "ElseIfStatementOpeningBrace": ">=1", 130 | "ElseIfStatementClosingBrace": ">=1", 131 | "ElseStatement": ">=1", 132 | "ElseStatementOpeningBrace": ">=1", 133 | "ElseStatementClosingBrace": ">=1", 134 | "LogicalExpression": -1, 135 | "ObjectExpressionOpeningBrace": ">=1", 136 | "Property": 0, 137 | "ReturnStatement": -1, 138 | "SwitchOpeningBrace": ">=1", 139 | "SwitchClosingBrace": ">=1", 140 | "ThisExpression": 0, 141 | "ThrowStatement": ">=1", 142 | "TryKeyword": -1, 143 | "TryOpeningBrace": ">=1", 144 | "TryClosingBrace": 0, 145 | "VariableDeclaration": ">=1", 146 | "WhileStatement": ">=1", 147 | "WhileStatementOpeningBrace": ">=1", 148 | "WhileStatementClosingBrace": ">=1" 149 | } 150 | }, 151 | "whiteSpace": { 152 | "value": " ", 153 | "removeTrailing": 1, 154 | "before": { 155 | "ArrayExpressionOpening": 0, 156 | "ArrayExpressionClosing": 0, 157 | "ArrayExpressionComma": 0, 158 | "ArgumentComma": 0, 159 | "ArgumentList": 0, 160 | "ArgumentListArrayExpression": 0, 161 | "ArgumentListFunctionExpression": 0, 162 | "ArgumentListObjectExpression": 0, 163 | "AssignmentOperator": 1, 164 | "BinaryExpression": 0, 165 | "BinaryExpressionOperator": 1, 166 | "BlockComment": 1, 167 | "CallExpression": -1, 168 | "CatchParameterList": 0, 169 | "CatchOpeningBrace": 1, 170 | "CatchClosingBrace": 1, 171 | "CatchKeyword": 1, 172 | "CommaOperator": 0, 173 | "ConditionalExpressionConsequent": 1, 174 | "ConditionalExpressionAlternate": 1, 175 | "DoWhileStatementOpeningBrace": 1, 176 | "DoWhileStatementClosingBrace": 1, 177 | "DoWhileStatementConditional": 1, 178 | "EmptyStatement": 0, 179 | "ExpressionClosingParentheses": 0, 180 | "FinallyKeyword": -1, 181 | "FinallyOpeningBrace": 1, 182 | "FinallyClosingBrace": 1, 183 | "ForInStatement": 1, 184 | "ForInStatementExpressionOpening": 1, 185 | "ForInStatementExpressionClosing": 0, 186 | "ForInStatementOpeningBrace": 1, 187 | "ForInStatementClosingBrace": 1, 188 | "ForStatement": 1, 189 | "ForStatementExpressionOpening": 1, 190 | "ForStatementExpressionClosing": 0, 191 | "ForStatementOpeningBrace": 1, 192 | "ForStatementClosingBrace": 1, 193 | "ForStatementSemicolon": 0, 194 | "FunctionDeclarationOpeningBrace": 1, 195 | "FunctionDeclarationClosingBrace": 1, 196 | "FunctionExpressionOpeningBrace": 1, 197 | "FunctionExpressionClosingBrace": 1, 198 | "IfStatementConditionalOpening": 1, 199 | "IfStatementConditionalClosing": 0, 200 | "IfStatementOpeningBrace": 1, 201 | "IfStatementClosingBrace": 1, 202 | "ElseStatementOpeningBrace": 1, 203 | "ElseStatementClosingBrace": 1, 204 | "ElseIfStatementOpeningBrace": 1, 205 | "ElseIfStatementClosingBrace": 1, 206 | "MemberExpressionClosing": 0, 207 | "LineComment": 1, 208 | "LogicalExpressionOperator": 1, 209 | "Property": 1, 210 | "PropertyValue": 1, 211 | "ParameterComma": 0, 212 | "ParameterList": 0, 213 | "SwitchDiscriminantOpening": 1, 214 | "SwitchDiscriminantClosing": 0, 215 | "ThrowKeyword": 1, 216 | "TryKeyword": -1, 217 | "TryOpeningBrace": 1, 218 | "TryClosingBrace": 1, 219 | "UnaryExpressionOperator": 0, 220 | "VariableName": 1, 221 | "VariableValue": 1, 222 | "WhileStatementConditionalOpening": 1, 223 | "WhileStatementConditionalClosing": 0, 224 | "WhileStatementOpeningBrace": 1, 225 | "WhileStatementClosingBrace": 1 226 | }, 227 | "after": { 228 | "ArrayExpressionOpening": 0, 229 | "ArrayExpressionClosing": 0, 230 | "ArrayExpressionComma": 1, 231 | "ArgumentComma": 1, 232 | "ArgumentList": 0, 233 | "ArgumentListArrayExpression": 0, 234 | "ArgumentListFunctionExpression": 0, 235 | "ArgumentListObjectExpression": 0, 236 | "AssignmentOperator": 1, 237 | "BinaryExpression": 0, 238 | "BinaryExpressionOperator": 1, 239 | "BlockComment": 1, 240 | "CallExpression": 0, 241 | "CatchParameterList": 0, 242 | "CatchOpeningBrace": 1, 243 | "CatchClosingBrace": 1, 244 | "CatchKeyword": 1, 245 | "CommaOperator": 1, 246 | "ConditionalExpressionConsequent": 1, 247 | "ConditionalExpressionTest": 1, 248 | "DoWhileStatementOpeningBrace": 1, 249 | "DoWhileStatementClosingBrace": 1, 250 | "DoWhileStatementBody": 1, 251 | "EmptyStatement": 0, 252 | "ExpressionOpeningParentheses": 0, 253 | "FinallyKeyword": -1, 254 | "FinallyOpeningBrace": 1, 255 | "FinallyClosingBrace": 1, 256 | "ForInStatement": 1, 257 | "ForInStatementExpressionOpening": 0, 258 | "ForInStatementExpressionClosing": 1, 259 | "ForInStatementOpeningBrace": 1, 260 | "ForInStatementClosingBrace": 1, 261 | "ForStatement": 1, 262 | "ForStatementExpressionOpening": 0, 263 | "ForStatementExpressionClosing": 1, 264 | "ForStatementClosingBrace": 1, 265 | "ForStatementOpeningBrace": 1, 266 | "ForStatementSemicolon": 1, 267 | "FunctionReservedWord": 0, 268 | "FunctionName": 1, 269 | "FunctionExpressionOpeningBrace": 1, 270 | "FunctionExpressionClosingBrace": 0, 271 | "FunctionDeclarationOpeningBrace": 1, 272 | "FunctionDeclarationClosingBrace": 1, 273 | "IfStatementConditionalOpening": 0, 274 | "IfStatementConditionalClosing": 1, 275 | "IfStatementOpeningBrace": 1, 276 | "IfStatementClosingBrace": 1, 277 | "ElseStatementOpeningBrace": 1, 278 | "ElseStatementClosingBrace": 1, 279 | "ElseIfStatementOpeningBrace": 1, 280 | "ElseIfStatementClosingBrace": 1, 281 | "MemberExpressionOpening": 0, 282 | "LogicalExpressionOperator": 1, 283 | "ObjectExpressionClosingBrace": 0, 284 | "PropertyName": 0, 285 | "PropertyValue": 0, 286 | "ParameterComma": 1, 287 | "ParameterList": 0, 288 | "SwitchDiscriminantOpening": 0, 289 | "SwitchDiscriminantClosing": 1, 290 | "ThrowKeyword": 1, 291 | "TryKeyword": -1, 292 | "TryOpeningBrace": 1, 293 | "TryClosingBrace": 1, 294 | "UnaryExpressionOperator": 0, 295 | "VariableName": 1, 296 | "WhileStatementConditionalOpening": 0, 297 | "WhileStatementConditionalClosing": 1, 298 | "WhileStatementOpeningBrace": 1, 299 | "WhileStatementClosingBrace": 1 300 | } 301 | } 302 | } 303 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | app/.meteor/** 2 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | //.eslintrc for use with v0.23.0 2 | // inspired by https://gist.github.com/cletusw/e01a85e399ab563b1236 3 | // ESLint Meteor Configuration File 4 | { 5 | // http://eslint.org/docs/rules/ 6 | 7 | "ecmaFeatures": { 8 | "arrowFunctions": false, // enable arrow functions 9 | "binaryLiterals": false, // enable binary literals 10 | "blockBindings": false, // enable let and const (aka block bindings) 11 | "classes": false, // enable classes 12 | "defaultParams": false, // enable default function parameters 13 | "destructuring": false, // enable destructuring 14 | "forOf": false, // enable for-of loops 15 | "generators": false, // enable generators 16 | "modules": false, // enable modules and global strict mode 17 | "objectLiteralComputedProperties": false, // enable computed object literal property names 18 | "objectLiteralDuplicateProperties": false, // enable duplicate object literal properties in strict mode 19 | "objectLiteralShorthandMethods": false, // enable object literal shorthand methods 20 | "objectLiteralShorthandProperties": false, // enable object literal shorthand properties 21 | "octalLiterals": false, // enable octal literals 22 | "regexUFlag": false, // enable the regular expression u flag 23 | "regexYFlag": false, // enable the regular expression y flag 24 | "restParams": false, // enable the rest parameters 25 | "spread": false, // enable the spread operator 26 | "superInFunctions": false, // enable super references inside of functions 27 | "templateStrings": false, // enable template strings 28 | "unicodeCodePointEscapes": false, // enable code point escapes 29 | "globalReturn": false, // allow return statements in the global scope 30 | "jsx": false // enable JSX 31 | }, 32 | 33 | "env": { 34 | "browser": false, // browser global variables. 35 | "node": false, // Node.js global variables and Node.js-specific rules. 36 | "worker": false, // web workers global variables. 37 | "amd": false, // defines require() and define() as global variables as per the amd spec. 38 | "mocha": false, // adds all of the Mocha testing global variables. 39 | "jasmine": false, // adds all of the Jasmine testing global variables for version 1.3 and 2.0. 40 | "phantomjs": false, // phantomjs global variables. 41 | "jquery": false, // jquery global variables. 42 | "prototypejs": false, // prototypejs global variables. 43 | "shelljs": false, // shelljs global variables. 44 | "meteor": true, // meteor global variables. 45 | "mongo": false, // mongo global variables. 46 | "applescript": false, // applescript global variables. 47 | "es6": false // enable all ECMAScript 6 features except for modules. 48 | }, 49 | 50 | "globals": { 51 | "meteor": true 52 | }, 53 | 54 | "plugins": [ 55 | // (must run `npm install eslint-plugin-*` as well ) 56 | ], 57 | 58 | "rules": { 59 | /////////// Rules /////////// 60 | // Rules in ESLint are divided into several categories to help you better understand their value. 61 | // Additionally, not all rules are enabled by default. 62 | // Those that are not enabled by default are marked as being off. 63 | // use 0 for no action, 1 for warning, 2 for error 64 | 65 | /////////// Possible Errors /////////// 66 | // The following rules point out areas where you might have made mistakes. 67 | "comma-dangle": 0, // disallow or enforce trailing commas 68 | "no-comma-dangle": 0, // (deprecated) disallow trailing commas in object literals (off by default) 69 | "no-cond-assign": 0, // disallow assignment in conditional expressions 70 | "no-console": 0, // disallow use of console (off by default in the node environment) 71 | "no-constant-condition": 0, // disallow use of constant expressions in conditions 72 | "no-control-regex": 0, // disallow control characters in regular expressions 73 | "no-debugger": 0, // disallow use of debugger 74 | "no-dupe-args": 0, // disallow duplicate arguments in functions 75 | "no-dupe-keys": 0, // disallow duplicate keys when creating object literals 76 | "no-duplicate-case": 0, // disallow a duplicate case label. 77 | "no-empty-character-class": 0, // disallow the use of empty character classes in regular expressions 78 | "no-empty-class": 0, // (deprecated) disallow the use of empty character classes in regular expressions (off by default) 79 | "no-empty": 0, // disallow empty statements 80 | "no-ex-assign": 0, // disallow assigning to the exception in a catch block 81 | "no-extra-boolean-cast": 0, // disallow double-negation boolean casts in a boolean context 82 | "no-extra-parens": 0, // disallow unnecessary parentheses (off by default) 83 | "no-extra-semi": 0, // disallow unnecessary semicolons 84 | "no-func-assign": 0, // disallow overwriting functions written as function declarations 85 | "no-inner-declarations": 0, // disallow function or variable declarations in nested blocks 86 | "no-invalid-regexp": 0, // disallow invalid regular expression strings in the RegExp constructor 87 | "no-irregular-whitespace": 0, // disallow irregular whitespace outside of strings and comments 88 | "no-negated-in-lhs": 0, // disallow negation of the left operand of an in expression 89 | "no-obj-calls": 0, // disallow the use of object properties of the global object (Math and JSON) as functions 90 | "no-regex-spaces": 0, // disallow multiple spaces in a regular expression literal 91 | "no-reserved-keys": 0, // disallow reserved words being used as object literal keys (off by default) 92 | "no-sparse-arrays": 0, // disallow sparse arrays 93 | "no-unreachable": 0, // disallow unreachable statements after a return, throw, continue, or break statement 94 | "use-isnan": 0, // disallow comparisons with the value NaN 95 | "valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default) 96 | "valid-typeof": 0, // Ensure that the results of typeof are compared against a valid string 97 | 98 | /////////// Best Practices /////////// 99 | // These are rules designed to prevent you from making mistakes. They either prescribe a better way of doing something or help you avoid footguns. 100 | "accessor-pairs": 0, // Enforces getter/setter pairs in objects (off by default) 101 | "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default) 102 | "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default) 103 | "consistent-return": 0, // require return statements to either always or never specify values 104 | "curly": [ 105 | 2, 106 | "multi-line" 107 | ], // specify curly brace conventions for all control statements 108 | "default-case": 0, // require default case in switch statements (off by default) 109 | "dot-notation": 0, // encourages use of dot notation whenever possible 110 | "dot-location": 0, // enforces consistent newlines before or after dots (off by default) 111 | "eqeqeq": 2, // require the use of === and !== 112 | "guard-for-in": 0, // make sure for-in loops have an if statement (off by default) 113 | "no-alert": 0, // disallow the use of alert, confirm, and prompt 114 | "no-caller": 0, // disallow use of arguments.caller or arguments.callee 115 | "no-div-regex": 0, // disallow division operators explicitly at beginning of regular expression (off by default) 116 | "no-else-return": 0, // disallow else after a return in an if (off by default) 117 | "no-empty-label": 0, // disallow use of labels for anything other than loops and switches 118 | "no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default) 119 | "no-eval": 0, // disallow use of eval() 120 | "no-extend-native": 0, // disallow adding to native types 121 | "no-extra-bind": 0, // disallow unnecessary function binding 122 | "no-fallthrough": 0, // disallow fallthrough of case statements 123 | "no-floating-decimal": 0, // disallow the use of leading or trailing decimal points in numeric literals (off by default) 124 | "no-implied-eval": 0, // disallow use of eval()-like methods 125 | "no-iterator": 0, // disallow usage of __iterator__ property 126 | "no-labels": 0, // disallow use of labeled statements 127 | "no-lone-blocks": 0, // disallow unnecessary nested blocks 128 | "no-loop-func": 0, // disallow creation of functions within loops 129 | "no-multi-spaces": 0, // disallow use of multiple spaces 130 | "no-multi-str": 0, // disallow use of multiline strings 131 | "no-native-reassign": 0, // disallow reassignments of native objects 132 | "no-new-func": 0, // disallow use of new operator for Function object 133 | "no-new-wrappers": 0, // disallows creating new instances of String,Number, and Boolean 134 | "no-new": 0, // disallow use of new operator when not part of the assignment or comparison 135 | "no-octal-escape": 0, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251"; 136 | "no-octal": 0, // disallow use of octal literals 137 | "no-param-reassign": 0, // disallow reassignment of function parameters (off by default) 138 | "no-process-env": 0, // disallow use of process.env (off by default) 139 | "no-proto": 0, // disallow usage of __proto__ property 140 | "no-redeclare": 0, // disallow declaring the same variable more than once 141 | "no-return-assign": 0, // disallow use of assignment in return statement 142 | "no-script-url": 0, // disallow use of javascript: urls. 143 | "no-self-compare": 0, // disallow comparisons where both sides are exactly the same (off by default) 144 | "no-sequences": 0, // disallow use of comma operator 145 | "no-throw-literal": 0, // restrict what can be thrown as an exception (off by default) 146 | "no-unused-expressions": 0, // disallow usage of expressions in statement position 147 | "no-void": 0, // disallow use of void operator (off by default) 148 | "no-warning-comments": 0, // disallow usage of configurable warning terms in comments e.g. TODO or FIXME (off by default) 149 | "no-with": 0, // disallow use of the with statement 150 | "radix": 0, // require use of the second argument for parseInt() (off by default) 151 | "vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default) 152 | "wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default) 153 | "yoda": 0, // require or disallow Yoda conditions 154 | 155 | /////////// Strict Mode /////////// 156 | // These rules relate to using strict mode. 157 | "global-strict": 0, // (deprecated) require or disallow the "use strict" pragma in the global scope (on by default)(off by default in the node environment) 158 | "no-extra-strict": 0, // (deprecated) disallow unnecessary use of "use strict"; when already in strict mode 159 | "strict": 0, // controls location of Use Strict Directives 160 | 161 | /////////// Variables /////////// 162 | // These rules have to do with variable declarations. 163 | "no-catch-shadow": 0, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) 164 | "no-delete-var": 0, // disallow deletion of variables 165 | "no-label-var": 0, // disallow labels that share a name with a variable 166 | "no-shadow-restricted-names": 0, // disallow shadowing of names such as arguments 167 | "no-shadow": 0, // disallow declaration of variables already declared in the outer scope 168 | "no-undef-init": 0, // disallow use of undefined when initializing variables 169 | "no-undef": 0, // disallow use of undeclared variables unless mentioned in a /*global */ block 170 | "no-undefined": 0, // disallow use of undefined variable (off by default) 171 | "no-unused-vars": 0, // disallow declaration of variables that are not used in the code 172 | "no-use-before-define": 0, // disallow use of variables before they are defined 173 | 174 | /////////// Node.js /////////// 175 | // These rules are specific to JavaScript running on Node.js. 176 | "handle-callback-err": 0, // enforces error handling in callbacks (off by default) (on by default in the node environment) 177 | "no-mixed-requires": 0, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment) 178 | "no-new-require": 0, // disallow use of new operator with the require function (off by default) (on by default in the node environment) 179 | "no-path-concat": 0, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment) 180 | "no-process-exit": 0, // disallow process.exit() (on by default in the node environment) 181 | "no-restricted-modules": 0, // restrict usage of specified node modules (off by default) 182 | "no-sync": 0, // disallow use of synchronous methods (off by default) 183 | 184 | /////////// Stylistic Issues /////////// 185 | // These rules are purely matters of style and are quite subjective. 186 | "brace-style": 0, // enforce one true brace style (off by default) 187 | "camelcase": 2, // require camel case names 188 | "comma-spacing": [ 189 | 2, { 190 | "before": false, 191 | "after": true 192 | } 193 | ], // enforce spacing before and after comma 194 | "comma-style": 0, // enforce one true comma style (off by default) 195 | "computed-property-spacing": 0, // require or disallow padding inside computed properties (off by default) 196 | "consistent-this": 0, // enforces consistent naming when capturing the current execution context (off by default) 197 | "eol-last": 0, // enforce newline at the end of file, with no multiple empty lines 198 | "func-names": 0, // require function expressions to have a name (off by default) 199 | "func-style": 0, // enforces use of function declarations or expressions (off by default) 200 | "indent": [ 201 | 2, 202 | 2 203 | ], // this option sets a specific tab width for your code (off by default) 204 | "key-spacing": 0, // enforces spacing between keys and values in object literal properties 205 | "lines-around-comment": 0, // enforces empty lines around comments (off by default) 206 | "linebreak-style": 0, // disallow mixed LF and CRLF as linebreaks (off by default) 207 | "max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default) 208 | "new-cap": 0, // require a capital letter for constructors 209 | "new-parens": 0, // disallow the omission of parentheses when invoking a constructor with no arguments 210 | "newline-after-var": 0, // allow/disallow an empty newline after var statement (off by default) 211 | "no-array-constructor": 0, // disallow use of the Array constructor 212 | "no-continue": 0, // disallow use of the continue statement (off by default) 213 | "no-inline-comments": 0, // disallow comments inline after code (off by default) 214 | "no-lonely-if": 0, // disallow if as the only statement in an else block (off by default) 215 | "no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation 216 | "no-multiple-empty-lines": 0, // disallow multiple empty lines (off by default) 217 | "no-nested-ternary": 0, // disallow nested ternary expressions (off by default) 218 | "no-new-object": 0, // disallow use of the Object constructor 219 | "no-space-before-semi": 0, // (deprecated) disallow space before semicolon (off by default) 220 | "no-spaced-func": 0, // disallow space between function identifier and application 221 | "no-ternary": 0, // disallow the use of ternary operators (off by default) 222 | "no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines 223 | "no-underscore-dangle": 0, // disallow dangling underscores in identifiers 224 | "no-unneeded-ternary": 0, // disallow the use of Boolean literals in conditional expressions (off by default) 225 | "no-wrap-func": 0, // (deprecated) disallow wrapping of non-IIFE statements in parens 226 | "object-curly-spacing": 0, // require or disallow padding inside curly braces (off by default) 227 | "one-var": 0, // allow or disallow one variable declaration per function (off by default) 228 | "operator-assignment": 0, // require assignment operator shorthand where possible or prohibit it entirely (off by default) 229 | "operator-linebreak": 0, // enforce operators to be placed before or after line breaks (off by default) 230 | "padded-blocks": 0, // enforce padding within blocks (off by default) 231 | "quote-props": 0, // require quotes around object literal property names (off by default) 232 | "quotes": [ 233 | 1, 234 | "single" 235 | ], // specify whether backticks, double or single quotes should be used 236 | "semi-spacing": [ 237 | 2, 238 | {"before": false, "after": true} 239 | ], // enforce spacing before and after semicolons 240 | "semi": [ 241 | 2, 242 | "always" 243 | ], // require or disallow use of semicolons instead of ASI 244 | "sort-vars": 0, // sort variables within the same declaration block (off by default) 245 | "space-after-function-name": 0, // (deprecated) require a space after function names (off by default) 246 | "space-after-keywords": [ 247 | 2, 248 | "always" 249 | ], // require a space after certain keywords (off by default) 250 | "space-before-blocks": 0, // require or disallow space before blocks (off by default) 251 | "space-before-function-paren": [ 252 | 2, 253 | "always" 254 | ], // require or disallow space before function opening parenthesis (off by default) 255 | "space-before-function-parentheses": 0, // (deprecated) require or disallow space before function parentheses (off by default) 256 | "space-in-brackets": [2, "always", { 257 | "singleValue": false, 258 | "objectsInArrays": false, 259 | "arraysInArrays": false, 260 | "arraysInObjects": false, 261 | "objectsInObjects": false, 262 | "propertyName": false 263 | }], // (deprecated) require or disallow spaces inside brackets (off by default) 264 | "space-in-parens": [ 265 | 0, 266 | "never" 267 | ], // require or disallow spaces inside parentheses (off by default) 268 | "space-infix-ops": 0, // require spaces around operators 269 | "space-return-throw-case": 0, // require a space after return, throw, and case 270 | "space-unary-ops": 0, // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) 271 | "space-unary-word-ops": 0, // (deprecated) Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) 272 | "spaced-comment": 0, // require or disallow a space immediately following the // or /* in a comment (off by default) 273 | "spaced-line-comment": 0, // (deprecated) require or disallow a space immediately following the // in a line comment (off by default) 274 | "wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default) 275 | 276 | /////////// ECMAScript 6 /////////// 277 | // These rules are only relevant to ES6 environments and are off by default. 278 | "generator-star-spacing": 0, // enforce the spacing around the * in generator functions (off by default) 279 | "generator-star": 0, // (deprecated) enforce the position of the * in generator functions (off by default) 280 | "no-var": 0, // require let or const instead of var (off by default) 281 | "object-shorthand": 0, // require method and property shorthand syntax for object literals (off by default) 282 | "prefer-const": 0, // suggest using of const declaration for variables that are never modified after declared (off by default) 283 | 284 | /////////// Legacy /////////// 285 | // The following rules are included for compatibility with JSHint and JSLint. While the names of the rules may not match up with the JSHint/JSLint counterpart, the functionality is the same. 286 | "max-depth": 0, // specify the maximum depth that blocks can be nested (off by default) 287 | "max-len": [ 288 | 1, 289 | 80, 290 | 2 291 | ], // specify the maximum length of a line in your program (off by default) 292 | "max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default) 293 | "max-statements": 0, // specify the maximum number of statement allowed in a function (off by default) 294 | "no-bitwise": 0, // disallow use of bitwise operators (off by default) 295 | "no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default) 296 | } 297 | } 298 | -------------------------------------------------------------------------------- /.jsbeautifyrc: -------------------------------------------------------------------------------- 1 | { 2 | "indent_size": 2, 3 | "indent_char": " ", 4 | "indent_level": 0, 5 | "var_line_reindented": true, 6 | "chain_extra_indentation": 2, 7 | "indent_with_tabs": false, 8 | "preserve_newlines": true, 9 | "max_preserve_newlines": 2, 10 | "jslint_happy": true, 11 | "brace_style": "collapse", 12 | "keep_array_indentation": false, 13 | "keep_function_indentation": false, 14 | "eval_code": false, 15 | "unescape_strings": false, 16 | "break_chained_methods": false, 17 | "space_before_conditional": true, 18 | "wrap_line_length": 0 19 | } 20 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | //.jscsrc 2 | // tested with jscs v1.11.3 3 | { 4 | "excludeFiles": [".meteor/**"], 5 | //"disallowAnonymousFunctions": true, // Requires that a function expression be named. 6 | //"disallowCapitalizedComments": true, // Requires the first alphabetical character of a comment to be lowercase. 7 | //"disallowCommaBeforeLineBreak": true, // Disallows commas as last token on a line in lists. 8 | //"disallowCurlyBraces": true, // Disallows curly braces after statements. 9 | //"disallowDanglingUnderscores": true, // Disallows identifiers that start or end in _. Some popular identifiers are automatically listed as exceptions 10 | //"disallowEmptyBlocks": true, // Disallows empty blocks (except for catch blocks). 11 | //"disallowFunctionDeclarations": true, // Disallows function declarations. 12 | //"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"], // Disallows implicit type conversion. 13 | //"disallowKeywordsInComments": true, // Disallows keywords in your comments, such as TODO or FIXME 14 | //"disallowKeywordsOnNewLine": ["else"], // Disallows placing keywords on a new line. 15 | //"disallowKeywords": ["with"], // Disallows usage of specified keywords. 16 | "disallowMixedSpacesAndTabs": true, // Requires lines to not contain both spaces and tabs consecutively, 17 | //"disallowMultipleLineBreaks": true, // Disallows multiple blank lines in a row. 18 | //"disallowMultipleLineStrings": true, // Disallows strings that span multiple lines without using concatenation. 19 | //"disallowMultipleVarDecl": true, // Disallows multiple var declaration (except for-loop). 20 | //"disallowNewlineBeforeBlockStatements": true, // Disallows newline before opening curly brace of all block statements. 21 | //"disallowOperatorBeforeLineBreak": true, // Requires putting certain operators on the next line rather than on the current line before a line break. 22 | //"disallowPaddingNewlinesBeforeKeywords": true, // Disallow an empty line above the specified keywords. 23 | //"disallowPaddingNewlinesInBlocks": true, // Disallows blocks from beginning and ending with 2 newlines. 24 | //"disallowPaddingNewLinesInObjects": true, // Disallows newline inside curly braces of all objects. 25 | //"disallowQuotedKeysInObjects": true, // Disallows quoted keys in object if possible. 26 | //"disallowSemicolons": true, // Disallows lines from ending in a semicolon. 27 | //"disallowSpaceAfterBinaryOperators": true, // Requires sticking binary operators to the right. 28 | //"disallowSpaceAfterKeywords": true, // Disallows space after keyword. 29 | //"disallowSpaceAfterLineComment": true, // Requires that a line comment (//) not be followed by a space. 30 | //"disallowSpaceAfterObjectKeys": true, // Disallows space after object keys. 31 | "disallowSpaceAfterPrefixUnaryOperators": true, // Requires sticking unary operators to the right. 32 | //"disallowSpaceBeforeBinaryOperators": true, // Requires sticking binary operators to the left. 33 | //"disallowSpaceBeforeBlockStatements": true, // Disallows space before block statements (for loops, control structures). 34 | //"disallowSpaceBeforeKeywords": true, // Disallows space before keyword. 35 | //"disallowSpaceBeforeObjectValues": true, // Disallows space after object keys. 36 | //"disallowSpaceBeforePostfixUnaryOperators": true, // Requires sticking unary operators to the left. 37 | //"disallowSpaceBetweenArguments": true, // Ensure there are no spaces after argument separators in call expressions. 38 | //"disallowSpacesInAnonymousFunctionExpression": { // Disallows space before () or {} in anonymous function expressions. 39 | // "beforeOpeningRoundBrace": true, 40 | // "beforeOpeningCurlyBrace": true 41 | //}, 42 | //"disallowSpacesInCallExpression": true, // Disallows space before () in call expressions. 43 | //"disallowSpacesInConditionalExpression": true, // Disallows space before and/or after ? or : in conditional expressions. 44 | //"disallowSpacesInForStatement": true, // Disallow spaces in between for statement. 45 | //"disallowSpacesInFunctionDeclaration": { // Disallows space before () or {} in function declarations. 46 | // "beforeOpeningRoundBrace": true, 47 | // "beforeOpeningCurlyBrace": true 48 | // }, 49 | //"disallowSpacesInFunctionExpression": { // Disallows space before () or {} in function expressions (both named and anonymous). 50 | // "beforeOpeningRoundBrace": true, 51 | // "beforeOpeningCurlyBrace": true 52 | // }, 53 | //"disallowSpacesInFunction": { // Disallows space before () or {} in function expressions (both named and anonymous). 54 | // "beforeOpeningRoundBrace": true, 55 | // "beforeOpeningCurlyBrace": true 56 | // }, 57 | //"disallowSpacesInNamedFunctionExpression": { // Disallows space before () or {} in named function expressions. 58 | // "beforeOpeningRoundBrace": true, 59 | // "beforeOpeningCurlyBrace": true 60 | // }, 61 | "disallowSpacesInsideArrayBrackets": true, // Disallows space after opening array square bracket and before closing. 62 | //"disallowSpacesInsideBrackets": true, // Disallows space after opening square bracket and before closing. 63 | //"disallowSpacesInsideObjectBrackets": true, // Disallows space after opening object curly brace and before closing. 64 | //"disallowSpacesInsideParentheses": true, // Disallows space after opening round bracket and before closing. 65 | //"disallowTrailingComma": true, // Disallows an extra comma following the final element of an array or object literal. 66 | "disallowTrailingWhitespace": true, // Requires all lines to end on a non-whitespace character 67 | //"disallowYodaConditions": true, // Requires the variable to be the left hand operator when doing a boolean comparison 68 | "maximumLineLength": 80, // Requires all lines to be at most the number of characters specified 69 | //"requireAlignedObjectValues": "all", // Requires proper alignment in object literals. 70 | //"requireAnonymousFunctions": true, // Requires that a function expression be anonymous. 71 | //"requireBlocksOnNewline": true, // Requires blocks to begin and end with a newline 72 | "requireCamelCaseOrUpperCaseIdentifiers": true, // Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORES 73 | //"requireCapitalizedComments": true, // Requires the first alphabetical character of a comment to be uppercase, unless it is part of a multi-line textblock. 74 | //"requireCapitalizedConstructors": true, // Requires constructors to be capitalized (except for this) 75 | //"requireCommaBeforeLineBreak": true, // Requires commas as last token on a line in lists. 76 | //"requireCurlyBraces": true, // Requires curly braces after statements. 77 | //"requireDotNotation": true, // Requires member expressions to use dot notation when possible 78 | //"requireFunctionDeclarations": true, // Requires function declarations by disallowing assignment of functions 79 | //"requireKeywordsOnNewLine": ["else"], // Requires placing keywords on a new line. 80 | //"requireLineBreakAfterVariableAssignment": true, // Requires placing line feed after assigning a variable. 81 | //"requireLineFeedAtFileEnd": true, // Requires placing line feed at file end. 82 | //"requireMultipleVarDecl": true, // Requires multiple var declaration. 83 | //"requireNewlineBeforeBlockStatements": true, // Requires newline before opening curly brace of all block statements. 84 | //"requireOperatorBeforeLineBreak": true, // Requires operators to appear before line breaks and not after. 85 | //"requirePaddingNewlinesBeforeKeywords": true, // Requires an empty line above the specified keywords unless the keyword is the first expression in a block. 86 | //"requirePaddingNewlinesInBlocks": true, // Requires blocks to begin and end with 2 newlines 87 | //"requirePaddingNewLinesInObjects": true, // Requires newline inside curly braces of all objects. 88 | //"requireParenthesesAroundIIFE": true, // Requires parentheses around immediately invoked function expressions. 89 | //"requireQuotedKeysInObjects": true, // Requires quoted keys in objects. 90 | "requireSpaceAfterBinaryOperators": true, // Disallows sticking binary operators to the right. 91 | //"requireSpaceAfterKeywords": true, // Requires space after keyword. 92 | //"requireSpaceAfterLineComment": true, // Requires that a line comment (//) be followed by a space. 93 | //"requireSpaceAfterObjectKeys": true, // Requires space after object keys. 94 | //"requireSpaceAfterPrefixUnaryOperators": true, // Disallows sticking unary operators to the right. 95 | "requireSpaceBeforeBinaryOperators": true, // Disallows sticking binary operators to the left. 96 | //"requireSpaceBeforeBlockStatements": true, // Requires space before block statements (for loops, control structures). 97 | //"requireSpaceBeforeKeywords": true, // Requires space before keyword. 98 | "requireSpaceBeforeObjectValues": true, 99 | // Requires space after object keys. 100 | "requireSpaceBeforePostfixUnaryOperators": true, // Disallows sticking unary operators to the left. 101 | "requireSpaceBetweenArguments": true, // Ensure there are spaces after argument separators in call expressions. 102 | //"requireSpacesInAnonymousFunctionExpression": { // Requires space before () or {} in anonymous function expressions. 103 | // "beforeOpeningRoundBrace": true, 104 | // "beforeOpeningCurlyBrace": true 105 | //}, 106 | //"requireSpacesInCallExpression": true, // Requires space before () in call expressions. 107 | //"requireSpacesInConditionalExpression": true, // Requires space before and/or after ? or : in conditional expressions. 108 | //"requireSpacesInForStatement": true, // Requires spaces inbetween for statement. 109 | //"requireSpacesInFunctionDeclaration": { // Requires space before () or {} in function declarations. 110 | // "beforeOpeningRoundBrace": true, 111 | // "beforeOpeningCurlyBrace": true 112 | //}, 113 | //"requireSpacesInFunctionExpression": { // Requires space before () or {} in function expressions (both named and anonymous). 114 | // "beforeOpeningRoundBrace": true, 115 | // "beforeOpeningCurlyBrace": true 116 | //}, 117 | //"requireSpacesInFunction": { // Requires space before () or {} in function expressions (both named and anonymous). 118 | // "beforeOpeningRoundBrace": true, 119 | // "beforeOpeningCurlyBrace": true 120 | //}, 121 | //"requireSpacesInNamedFunctionExpression": { // Requires space before () or {} in named function expressions. 122 | // "beforeOpeningRoundBrace": true, 123 | // "beforeOpeningCurlyBrace": true 124 | //}, 125 | //"requireSpacesInsideArrayBrackets": "all", // Requires space after opening array square bracket and before closing. 126 | //"requireSpacesInsideBrackets": true, // Requires space after opening square bracket and before closing. 127 | "requireSpacesInsideObjectBrackets": "all", // Requires space after opening object curly brace and before closing. 128 | //"requireSpacesInsideParentheses": "all", // Requires space after opening round bracket and before closing. 129 | //"requireTrailingComma": true, // Requires an extra comma following the final element of an array or object literal. 130 | //"requireYodaConditions": true, // Requires the variable to be the right hand operator when doing a boolean comparison 131 | "safeContextKeyword": ["self"], // Option to check var that = this expressions 132 | "validateIndentation": 2 // Validates indentation for switch statements and block statements 133 | //"validateLineBreaks": "LF", // Option to check line break characters 134 | //"validateParameterSeparator": ", ", // Enable validation of separators between function parameters. Will ignore newlines. 135 | //"validateQuoteMarks": true // Requires all quote marks to be either the supplied value, or consistent if true 136 | } 137 | -------------------------------------------------------------------------------- /.jshintignore: -------------------------------------------------------------------------------- 1 | .meteor 2 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | //.jshintrc 2 | { 3 | // JSHint Meteor Configuration File 4 | // Match the Meteor Style Guide 5 | // 6 | // By @raix with contributions from @aldeed and @awatson1978 7 | // Source https://github.com/raix/Meteor-jshintrc 8 | // 9 | // See http://jshint.com/docs/ for more details 10 | 11 | "maxerr": 50, 12 | // {int} Maximum error before stopping 13 | 14 | // Enforcing 15 | "bitwise": true, // true: Prohibit bitwise operators (&, |, ^, etc.) 16 | "camelcase": true, // true: Identifiers must be in camelCase 17 | "curly": true, // true: Require {} for every new block or scope 18 | "eqeqeq": true, // true: Require triple equals (===) for comparison 19 | "forin": true, // true: Require filtering for..in loops with obj.hasOwnProperty() 20 | "immed": false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` 21 | "indent": 2, // {int} Number of spaces to use for indentation 22 | "latedef": true, // true: Require variables/functions to be defined before being used 23 | "newcap": false, // true: Require capitalization of all constructor functions e.g. `new F()` 24 | "noarg": true, // true: Prohibit use of `arguments.caller` and `arguments.callee` 25 | "noempty": true, // true: Prohibit use of empty blocks 26 | "nonew": false, // true: Prohibit use of constructors for side-effects (without assignment) 27 | "plusplus": false, // true: Prohibit use of `++` & `--` 28 | "quotmark": true, // Quotation mark consistency: 29 | // false : do nothing (default) 30 | // true : ensure whatever is used is consistent 31 | // "single" : require single quotes 32 | // "double" : require double quotes 33 | "undef": false, // true: Require all non-global variables to be declared (prevents global leaks) 34 | "unused": true, // true: Require all defined variables be used 35 | "strict": false, // true: Requires all functions run in ES5 Strict Mode 36 | "trailing": true, // true: Prohibit trailing whitespaces 37 | "maxparams": false, // {int} Max number of formal params allowed per function 38 | "maxdepth": false, // {int} Max depth of nested blocks (within functions) 39 | "maxstatements": false, // {int} Max number statements per function 40 | "maxcomplexity": false, // {int} Max cyclomatic complexity per function 41 | "maxlen": 80, // {int} Max number of characters per line 42 | 43 | // Relaxing 44 | "asi": false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) 45 | "boss": false, // true: Tolerate assignments where comparisons would be expected 46 | "debug": false, // true: Allow debugger statements e.g. browser breakpoints. 47 | "eqnull": false, // true: Tolerate use of `== null` 48 | "es5": false, // true: Allow ES5 syntax (ex: getters and setters) 49 | "esnext": false, // true: Allow ES.next (ES6) syntax (ex: `const`) 50 | "moz": false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) 51 | // (ex: `for each`, multiple try/catch, function expression…) 52 | "evil": false, // true: Tolerate use of `eval` and `new Function()` 53 | "expr": false, // true: Tolerate `ExpressionStatement` as Programs 54 | "funcscope": false, // true: Tolerate defining variables inside control statements" 55 | "globalstrict": true, // true: Allow global "use strict" (also enables 'strict') 56 | "iterator": false, // true: Tolerate using the `__iterator__` property 57 | "lastsemic": false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block 58 | "laxbreak": false, // true: Tolerate possibly unsafe line breakings 59 | "laxcomma": false, // true: Tolerate comma-first style coding 60 | "loopfunc": false, // true: Tolerate functions being defined in loops 61 | "multistr": false, // true: Tolerate multi-line strings 62 | "proto": false, // true: Tolerate using the `__proto__` property 63 | "scripturl": false, // true: Tolerate script-targeted URLs 64 | "smarttabs": false, // true: Tolerate mixed tabs/spaces when used for alignment 65 | "shadow": false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` 66 | "sub": false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation 67 | "supernew": false, // true: Tolerate `new function () { ... };` and `new Object;` 68 | "validthis": false, // true: Tolerate using this in a non-constructor function 69 | 70 | // Environments 71 | "browser": true, // Web Browser (window, document, etc) 72 | "couch": false, // CouchDB 73 | "devel": true, // Development/debugging (alert, confirm, etc) 74 | "dojo": false, // Dojo Toolkit 75 | "jquery": false, // jQuery 76 | "mootools": false, // MooTools 77 | "node": false, // Node.js 78 | "nonstandard": false, // Widely adopted globals (escape, unescape, etc) 79 | "prototypejs": false, // Prototype and Scriptaculous 80 | "rhino": false, // Rhino 81 | "worker": false, // Web Workers 82 | "wsh": false, // Windows Scripting Host 83 | "yui": false, // Yahoo User Interface 84 | //"meteor" : false, // Meteor.js 85 | 86 | // Legacy 87 | "nomen": false, // true: Prohibit dangling `_` in variables 88 | "onevar": false, // true: Allow only one `var` statement per function 89 | "passfail": false, // true: Stop on first error 90 | "white": true, // true: Check against strict whitespace and indentation rules 91 | 92 | // Custom globals, from http://docs.meteor.com, in alphabetical order 93 | "globals": { 94 | "Accounts": false, 95 | "App": false, //mobile-config.js 96 | "Assets": false, 97 | "Blaze": false, //UI is being renamed Blaze 98 | "check": false, 99 | "DDP": false, 100 | "Deps": false, 101 | "EJSON": false, 102 | "Email": false, 103 | "Handlebars": false, // https://github.com/meteor/meteor/wiki/Handlebars 104 | "HTTP": false, 105 | "Match": false, 106 | "Meteor": false, 107 | "Mongo": false, //Meteor.Collection renamed to Mongo.Collection 108 | "Package": false, 109 | "ReactiveVar": false, 110 | "Session": false, 111 | "Template": false, 112 | "Tracker": false, //Deps renamed to Tracker 113 | "UI": false, // Meteor internals 114 | "DDPServer": false, 115 | "global": false, 116 | "Log": false, 117 | "MongoInternals": false, 118 | "process": false, 119 | "WebApp": false, 120 | "WebAppInternals": false, // globals useful when creating Meteor packages 121 | "Npm": false, 122 | "Tinytest": false, // Velocity support 123 | "MochaWeb": false, // common Meteor packages 124 | "Random": false, 125 | "_": false, // Underscore.js 126 | "$": false, // jQuery 127 | "Router": false // iron-router 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /Beautify.md: -------------------------------------------------------------------------------- 1 | # Beautifying Meteor Projects 2 | 3 | Beautifying your code means you get it in shape to meet certain style (or quality) criteria. 4 | 5 | A convenient tool to use is [js-beautify](https://github.com/beautify-web/js-beautify). It can be configured using a `.jsbeautifyrc` file in the root of your project. 6 | 7 | Similar to `.editorconfig` it is not capable of automatically meeting every style convention, but most of the big ones. 8 | -------------------------------------------------------------------------------- /Editing.md: -------------------------------------------------------------------------------- 1 | # Editing with style support 2 | 3 | Most editor allow you to define certain style aspects, such as how many spaces to use for indenting code. When using different editors or using different editors it can become quite tedious to manage the correct editor settings by hand. [Editorconfig](http://editorconfig.org/) is a simple tool to take care of unified editor settings across different editors or machines. 4 | 5 | The [list of supported options](https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties) is different between editors. 6 | 7 | Note that only a small fraction of what can be part of a style guide can be addressed using editor settings or even editorconfig. Try to include tools to [beautify code adhering to style conventions](Beautify.md). 8 | -------------------------------------------------------------------------------- /Linting.md: -------------------------------------------------------------------------------- 1 | # Linting Meteor Projects 2 | 3 | Linting your files means you check whether you meet the conventions you defined for your code. It's like doing a quality check. 4 | 5 | There are several tools you can use to lint JavaScript code: 6 | 7 | * [JSHint](http://jshint.com/) 8 | * [JSCS](http://jscs.info/) 9 | * [ESLint](http://eslint.org/) 10 | 11 | They have slightly different approaches. They all have in common that they can check whether code adheres to certain quality or styles standards. 12 | 13 | If you only wish to pick one, I'd recommend [ESLint](http://eslint.org/). 14 | 15 | ## Usage 16 | 17 | ### Prerequisites 18 | 19 | Make sure that `npm` is available on your machine as all of these tools come as node packages. 20 | 21 | ### [JSHint](http://jshint.com/) 22 | 23 | JSHint is a tool that helps to detect errors and potential problems in JavaScript code. 24 | 25 | ### Installation 26 | 27 | Issue the following command inside a terminal: 28 | 29 | `$ npm install -g jshint` 30 | 31 | ### Configuration 32 | 33 | In order to use JShint you need a `.jshintrc file in the root directory. It can be used to configure [77 options](http://jshint.com/docs/options/). 34 | 35 | In order to exclude files or directories from linting you can use a `.jshintignore` file. 36 | 37 | ### Linting 38 | 39 | Inside the root directory of your project issue 40 | 41 | `$ jshint . ` 42 | 43 | ## [JSCS](http://jscs.info/) - JavaScript Code Style 44 | 45 | JSCS is a code style linter for programmatically enforcing a style guide. 46 | 47 | ### Installation 48 | 49 | Issue the following command inside a terminal: 50 | 51 | `$ npm install -g jscs` 52 | 53 | ### Configuration 54 | 55 | In order to use JavaScript Code Style (jscs) you need a `.jscsrc` file in the root directory. It can be used to configure [100 rules](http://jscs.info/rules.html). 56 | 57 | In order to exclude files or directories from linting you can set the `excludeFiles` option to an array of files or locations. 58 | 59 | ### Linting 60 | 61 | Inside the root directory of your project issue 62 | 63 | `$ jscs . ` 64 | 65 | ## [ESLint](http://eslint.org/) 66 | 67 | ### Installation 68 | 69 | Issue the following command inside a terminal: 70 | 71 | `$ npm install -g eslint` 72 | 73 | ### Configuration 74 | 75 | In order to use ESlint you need a `.eslintrc file in the root directory. It can be used to configure [143 rules](http://eslint.org/docs/rules/). 76 | 77 | In order to exclude files or directories from linting you can use a `.eslintgnore` file. 78 | 79 | ### Linting 80 | 81 | Inside the root directory of your project issue 82 | 83 | `$ eslint . ` 84 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Meteor code in style 2 | 3 | This repository contains a simple Meteor application that shows how to 4 | 5 | * set defaults for your editor of choice 6 | * perform linting on Meteor (JavaScript) code 7 | * utilize js-beautify to format code according to style requirements 8 | 9 | You can find the associated slides [on slideshare](http://de.slideshare.net/stephanhochhaus/writing-meteor-code-with-style) and [an associated post on my blog](https://www.yauh.de/writing-clean-javascript-code-with-eslint-and-js-beautify/). Also this repository contains a sample Meteor application so you can get started with some style experiments on your own. 10 | 11 | ## Why worry about style? 12 | 13 | Two reasons why you should decide on a style and enforce it: 14 | 15 | 1. It becomes easier to understand code written by other developers 16 | 1. (Dumb) compile errors can be avoided 17 | 18 | Style includes naming conventions, formatting, commenting, patterns, and other areas teams would like to keep consistent. 19 | 20 | ## How to find the right style? 21 | 22 | A good coding style minimizes ambiguity and makes it easy for team members to read other developer's code. 23 | 24 | For Meteor projects it is a good idea to look at [the offical MDG Style Guide](https://github.com/meteor/meteor/wiki/Meteor-Style-Guide). 25 | 26 | ## How to enforce a certain style? 27 | 28 | Before there were computers there were code reviews to identify violations of style guidelines. Static code analysis tools will produce reports of all found violations. 29 | 30 | Enforcing a certain style becomes easier when using a [supporting editor configuration](Editing.md) as well as tools that are capable of [pointing out violations of style rules](Linting.md). Ideally the editor is capable of [beautifiying the code adhering to style conventions](Beautify.md). 31 | -------------------------------------------------------------------------------- /app/.meteor/.finished-upgraders: -------------------------------------------------------------------------------- 1 | # This file contains information which helps Meteor properly upgrade your 2 | # app when you run 'meteor update'. You should check it into version control 3 | # with your project. 4 | 5 | notices-for-0.9.0 6 | notices-for-0.9.1 7 | 0.9.4-platform-file 8 | -------------------------------------------------------------------------------- /app/.meteor/.gitignore: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /app/.meteor/.id: -------------------------------------------------------------------------------- 1 | # This file contains a token that is unique to your project. 2 | # Check it into your repository along with the rest of this directory. 3 | # It can be used for purposes such as: 4 | # - ensuring you don't accidentally deploy one app on top of another 5 | # - providing package authors with aggregated statistics 6 | 7 | 13u0roxd07n2fojjw7k 8 | -------------------------------------------------------------------------------- /app/.meteor/.meteor/.finished-upgraders: -------------------------------------------------------------------------------- 1 | # This file contains information which helps Meteor properly upgrade your 2 | # app when you run 'meteor update'. You should check it into version control 3 | # with your project. 4 | 5 | notices-for-0.9.0 6 | notices-for-0.9.1 7 | 0.9.4-platform-file 8 | -------------------------------------------------------------------------------- /app/.meteor/.meteor/.gitignore: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /app/.meteor/.meteor/.id: -------------------------------------------------------------------------------- 1 | # This file contains a token that is unique to your project. 2 | # Check it into your repository along with the rest of this directory. 3 | # It can be used for purposes such as: 4 | # - ensuring you don't accidentally deploy one app on top of another 5 | # - providing package authors with aggregated statistics 6 | 7 | 13u0roxd07n2fojjw7k 8 | -------------------------------------------------------------------------------- /app/.meteor/.meteor/packages: -------------------------------------------------------------------------------- 1 | # Meteor packages used by this project, one per line. 2 | # Check this file (and the other files in this directory) into your repository. 3 | # 4 | # 'meteor add' and 'meteor remove' will edit this file for you, 5 | # but you can also edit it by hand. 6 | 7 | meteor-platform 8 | twbs:bootstrap 9 | accounts-password 10 | ian:accounts-ui-bootstrap-3 11 | iron:router 12 | -------------------------------------------------------------------------------- /app/.meteor/.meteor/platforms: -------------------------------------------------------------------------------- 1 | server 2 | browser 3 | -------------------------------------------------------------------------------- /app/.meteor/.meteor/release: -------------------------------------------------------------------------------- 1 | METEOR@1.0.3.1 2 | -------------------------------------------------------------------------------- /app/.meteor/.meteor/versions: -------------------------------------------------------------------------------- 1 | accounts-base@1.1.3 2 | accounts-password@1.0.6 3 | anti:i18n@0.4.3 4 | application-configuration@1.0.4 5 | autoupdate@1.1.5 6 | base64@1.0.2 7 | binary-heap@1.0.2 8 | blaze@2.0.4 9 | blaze-tools@1.0.2 10 | boilerplate-generator@1.0.2 11 | callback-hook@1.0.2 12 | check@1.0.4 13 | ddp@1.0.14 14 | deps@1.0.6 15 | ejson@1.0.5 16 | email@1.0.5 17 | fastclick@1.0.2 18 | follower-livedata@1.0.3 19 | geojson-utils@1.0.2 20 | handlebars@1.0.2 21 | html-tools@1.0.3 22 | htmljs@1.0.3 23 | http@1.0.10 24 | ian:accounts-ui-bootstrap-3@1.2.33 25 | id-map@1.0.2 26 | iron:controller@1.0.7 27 | iron:core@1.0.7 28 | iron:dynamic-template@1.0.7 29 | iron:layout@1.0.7 30 | iron:location@1.0.7 31 | iron:middleware-stack@1.0.7 32 | iron:router@1.0.7 33 | iron:url@1.0.7 34 | jquery@1.11.3 35 | json@1.0.2 36 | launch-screen@1.0.1 37 | livedata@1.0.12 38 | localstorage@1.0.2 39 | logging@1.0.6 40 | meteor@1.1.4 41 | meteor-platform@1.2.1 42 | minifiers@1.1.3 43 | minimongo@1.0.6 44 | mobile-status-bar@1.0.2 45 | mongo@1.0.11 46 | npm-bcrypt@0.7.7 47 | observe-sequence@1.0.4 48 | ordered-dict@1.0.2 49 | random@1.0.2 50 | reactive-dict@1.0.5 51 | reactive-var@1.0.4 52 | reload@1.1.2 53 | retry@1.0.2 54 | routepolicy@1.0.4 55 | service-configuration@1.0.3 56 | session@1.0.5 57 | sha@1.0.2 58 | spacebars@1.0.5 59 | spacebars-compiler@1.0.4 60 | srp@1.0.2 61 | stylus@1.0.6 62 | templating@1.0.11 63 | tracker@1.0.5 64 | twbs:bootstrap@3.3.2 65 | ui@1.0.5 66 | underscore@1.0.2 67 | url@1.0.3 68 | webapp@1.1.6 69 | webapp-hashing@1.0.2 70 | -------------------------------------------------------------------------------- /app/.meteor/packages: -------------------------------------------------------------------------------- 1 | # Meteor packages used by this project, one per line. 2 | # Check this file (and the other files in this directory) into your repository. 3 | # 4 | # 'meteor add' and 'meteor remove' will edit this file for you, 5 | # but you can also edit it by hand. 6 | 7 | meteor-platform 8 | twbs:bootstrap 9 | accounts-password 10 | ian:accounts-ui-bootstrap-3 11 | iron:router 12 | -------------------------------------------------------------------------------- /app/.meteor/platforms: -------------------------------------------------------------------------------- 1 | server 2 | browser 3 | -------------------------------------------------------------------------------- /app/.meteor/release: -------------------------------------------------------------------------------- 1 | METEOR@1.0.3.1 2 | -------------------------------------------------------------------------------- /app/.meteor/versions: -------------------------------------------------------------------------------- 1 | accounts-base@1.1.3 2 | accounts-password@1.0.6 3 | anti:i18n@0.4.3 4 | application-configuration@1.0.4 5 | autoupdate@1.1.5 6 | base64@1.0.2 7 | binary-heap@1.0.2 8 | blaze@2.0.4 9 | blaze-tools@1.0.2 10 | boilerplate-generator@1.0.2 11 | callback-hook@1.0.2 12 | check@1.0.4 13 | ddp@1.0.14 14 | deps@1.0.6 15 | ejson@1.0.5 16 | email@1.0.5 17 | fastclick@1.0.2 18 | follower-livedata@1.0.3 19 | geojson-utils@1.0.2 20 | handlebars@1.0.2 21 | html-tools@1.0.3 22 | htmljs@1.0.3 23 | http@1.0.10 24 | ian:accounts-ui-bootstrap-3@1.2.33 25 | id-map@1.0.2 26 | iron:controller@1.0.7 27 | iron:core@1.0.7 28 | iron:dynamic-template@1.0.7 29 | iron:layout@1.0.7 30 | iron:location@1.0.7 31 | iron:middleware-stack@1.0.7 32 | iron:router@1.0.7 33 | iron:url@1.0.7 34 | jquery@1.11.3 35 | json@1.0.2 36 | launch-screen@1.0.1 37 | livedata@1.0.12 38 | localstorage@1.0.2 39 | logging@1.0.6 40 | meteor@1.1.4 41 | meteor-platform@1.2.1 42 | minifiers@1.1.3 43 | minimongo@1.0.6 44 | mobile-status-bar@1.0.2 45 | mongo@1.0.11 46 | npm-bcrypt@0.7.7 47 | observe-sequence@1.0.4 48 | ordered-dict@1.0.2 49 | random@1.0.2 50 | reactive-dict@1.0.5 51 | reactive-var@1.0.4 52 | reload@1.1.2 53 | retry@1.0.2 54 | routepolicy@1.0.4 55 | service-configuration@1.0.3 56 | session@1.0.5 57 | sha@1.0.2 58 | spacebars@1.0.5 59 | spacebars-compiler@1.0.4 60 | srp@1.0.2 61 | stylus@1.0.6 62 | templating@1.0.11 63 | tracker@1.0.5 64 | twbs:bootstrap@3.3.2 65 | ui@1.0.5 66 | underscore@1.0.2 67 | url@1.0.3 68 | webapp@1.1.6 69 | webapp-hashing@1.0.2 70 | -------------------------------------------------------------------------------- /app/client/addLink/addLink.html: -------------------------------------------------------------------------------- 1 | 42 | 43 | 44 | 47 | -------------------------------------------------------------------------------- /app/client/addLink/addLink.js: -------------------------------------------------------------------------------- 1 | Template.addLink.events ( { 2 | 'submit form': function (evt) { 3 | evt.preventDefault (); 4 | // Ensure that URL always has a correct prefix 5 | var url = ensureHttpPrefix ( $ ( 'input[id=link-url]' ).val () ); 6 | var text = $ ( 'input[id=link-text]' ).val (); 7 | var category = $ ( 'select[id=link-category]' ).val (); 8 | Meteor.call ( 9 | 'AddLink', 10 | { url: url, text: text, category: category }, 11 | function (error) { 12 | if (error) { 13 | return alert ( 'Error: ' + error.error ); 14 | } 15 | else { 16 | Router.go ( '/' ); 17 | } 18 | } ); 19 | } 20 | } ); 21 | -------------------------------------------------------------------------------- /app/client/client.js: -------------------------------------------------------------------------------- 1 | // defines how many links to load by default 2 | Session.setDefault('linksLimit', 10); 3 | 4 | Tracker.autorun(function () { 5 | Meteor.subscribe('links', { 6 | linksLimit: parseInt(Session.get('linksLimit')) 7 | }); 8 | }); 9 | 10 | Template.registerHelper('isActiveRoute', function (routeName) { 11 | return Router.current().route.getName() === routeName; 12 | }); 13 | 14 | Template.registerHelper('isMyLink', function () { 15 | return Meteor.userId() === this.userId; 16 | }); 17 | 18 | Template.registerHelper('hasMyVote', function () { 19 | var style = ''; 20 | if (this.voters && this.voters.indexOf(Meteor.userId()) > 0) { 21 | style = 'disabled'; 22 | } 23 | return style; 24 | }); -------------------------------------------------------------------------------- /app/client/lib/configuration.js: -------------------------------------------------------------------------------- 1 | Accounts.ui.config({ 2 | passwordSignupFields: 'USERNAME_AND_OPTIONAL_EMAIL' 3 | }); -------------------------------------------------------------------------------- /app/client/lib/helpers.js: -------------------------------------------------------------------------------- 1 | ensureHttpPrefix = function (url) { 2 | // Use http:// as the default URL prefix 3 | var prefix = 'http://'; 4 | // check if http(s) is already present 5 | if (!/^https?:\/\//i.test(url)) { 6 | url = prefix + url; 7 | } 8 | return url; 9 | }; -------------------------------------------------------------------------------- /app/client/lib/router.js: -------------------------------------------------------------------------------- 1 | // Configuration 2 | Router.configure({ 3 | layoutTemplate: 'mainLayout' 4 | }); 5 | 6 | // Routes 7 | Router.route('/', function () { 8 | 9 | this.render('linkList'); 10 | }, { 11 | name: 'home' 12 | }); 13 | 14 | Router.route('/new', { 15 | name: 'new', 16 | subscriptions: function () { 17 | return Meteor.subscribe('categories'); 18 | }, 19 | onBeforeAction: function () { 20 | if (!Meteor.userId()) { 21 | // if the user is not logged in, render the Login template 22 | this.render('loginRequest'); 23 | } else { 24 | // otherwise don't hold up the rest of hooks or our route/action function 25 | // from running 26 | this.next(); 27 | } 28 | }, 29 | 30 | action: function () { 31 | if (this.ready()) { 32 | this.render('addLink'); 33 | } else { 34 | this.render('Loading categories'); 35 | } 36 | }, 37 | data: function () { 38 | return { 39 | categories: CategoriesCollection.find() 40 | }; 41 | } 42 | }); -------------------------------------------------------------------------------- /app/client/linksList/linksList.html: -------------------------------------------------------------------------------- 1 | 27 | 28 | 44 | -------------------------------------------------------------------------------- /app/client/linksList/linksList.js: -------------------------------------------------------------------------------- 1 | Template.linkList.helpers({ 2 | links: function () { 3 | return LinksCollection.find({}, { 4 | sort: { 5 | votes: -1 6 | } 7 | }); 8 | } 9 | }); 10 | 11 | Template.linkList.events({ 12 | 'click button#show-more': function () { 13 | var newLimit = Session.get('linksLimit') + 10; 14 | Session.set('linksLimit', newLimit); 15 | } 16 | }); 17 | 18 | Template.link.events({ 19 | 'click button.btn-danger': function (evt) { 20 | // delete link 21 | evt.preventDefault(); 22 | Meteor.call('RemoveLink', { 23 | linkId: this._id 24 | }, function (error) { 25 | 26 | if (error) { 27 | return alert('Error: ' + error.error); 28 | } else { 29 | console.log('yeah, deleted'); 30 | } 31 | }); 32 | }, 33 | 'click button.btn-success': function (evt) { 34 | // upvote link 35 | evt.preventDefault(); 36 | Meteor.call('AddVote', { 37 | linkId: this._id 38 | }, function (error) { 39 | 40 | if (error) { 41 | return alert('Error: ' + error.error); 42 | } else { 43 | console.log('yeah, upvoted'); 44 | $(evt.currentTarget).addClass('disabled'); 45 | } 46 | }); 47 | } 48 | }); -------------------------------------------------------------------------------- /app/client/loginRequest.html: -------------------------------------------------------------------------------- 1 | 11 | 12 | -------------------------------------------------------------------------------- /app/client/main.html: -------------------------------------------------------------------------------- 1 | 2 | meteor-with-style 3 | 4 | 5 | 6 | 7 | 8 | 9 | 44 | 45 | -------------------------------------------------------------------------------- /app/common/collections.js: -------------------------------------------------------------------------------- 1 | LinksCollection = new Mongo.Collection('links'); 2 | CategoriesCollection = new Mongo.Collection('categories'); -------------------------------------------------------------------------------- /app/common/methods.js: -------------------------------------------------------------------------------- 1 | // methods running both on the server and the client 2 | Meteor.methods({ 3 | 'AddLink': function (data) { 4 | check(data, { 5 | url: String, 6 | text: String, 7 | category: String 8 | }); 9 | if (!this.userId) { 10 | throw new Meteor.Error('You have to login'); 11 | } 12 | data.timestamp = new Date(); 13 | data.votes = 0; 14 | data.userId = this.userId; 15 | data.creator = Meteor.users.findOne(data.userId).username; 16 | return LinksCollection.insert(data); 17 | }, 18 | 'AddVote': function (data) { 19 | check(data, { 20 | linkId: String 21 | }); 22 | if (!this.userId) { 23 | throw new Meteor.Error('You have to login to be able to vote for links'); 24 | } 25 | data.userId = this.userId; 26 | // check if user voted already 27 | if (LinksCollection.find({ 28 | _id: data.linkId, 29 | voters: data.userId 30 | }).count() === 0) { 31 | return LinksCollection.update( 32 | data.linkId, { 33 | $push: { 34 | voters: data.userId 35 | }, 36 | $inc: { 37 | votes: 1 38 | } 39 | } 40 | ); 41 | } else { 42 | throw new Meteor.Error('You have already upvoted this link'); 43 | } 44 | }, 45 | 'RemoveLink': function (data) { 46 | check(data, { 47 | linkId: String 48 | }); 49 | if (this.userId !== LinksCollection.findOne({ 50 | _id: data.linkId 51 | }).userId) { 52 | throw new Meteor.Error( 53 | 'You cannot delete this link because you did not add it' 54 | ); 55 | } 56 | data.userId = this.userId; 57 | LinksCollection.remove({ 58 | _id: data.linkId 59 | }); 60 | } 61 | }); -------------------------------------------------------------------------------- /app/server/app.js: -------------------------------------------------------------------------------- 1 | Meteor.publish('links', function (options) { 2 | console.log(options); 3 | check(options, { 4 | linksLimit: Number 5 | }); 6 | var qryOptions = { 7 | limit: options.linksLimit, 8 | sort: { 9 | votes: -1 10 | } 11 | }; 12 | console.log(qryOptions); 13 | return LinksCollection.find({}, qryOptions); 14 | }); 15 | 16 | Meteor.publish('categories', function () { 17 | return CategoriesCollection.find({}, { 18 | sort: { 19 | name: 1 20 | } 21 | }); 22 | }); -------------------------------------------------------------------------------- /app/server/fixtures.js: -------------------------------------------------------------------------------- 1 | Meteor.startup(function () { 2 | if (CategoriesCollection.find().count() === 0) { 3 | var categories = [{ 4 | name: 'Blogs' 5 | }, { 6 | name: 'News' 7 | }, { 8 | name: 'Projects' 9 | }, { 10 | name: 'Other' 11 | }]; 12 | 13 | while (categories.length > 0) { 14 | CategoriesCollection.insert(categories.pop()); 15 | } 16 | console.log('Added categories'); 17 | } 18 | }); -------------------------------------------------------------------------------- /build/sonar-project.properties: -------------------------------------------------------------------------------- 1 | # project metadata 2 | sonar.projectKey=meteor:static-analysis 3 | sonar.projectName=Meteor Static Code Analysis 4 | sonar.projectVersion=1.0 5 | 6 | sonar.projectDescription=This project is used to show how to do static code analysis for Meteor projects using Jenkins CI and Sonar 7 | 8 | # Path to the parent source code directory. 9 | # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. 10 | # Since SonarQube 4.2, this property is optional if sonar.modules is set. 11 | # If not set, SonarQube starts looking for source code from the directory containing 12 | # the sonar-project.properties file. 13 | sonar.sources=app 14 | 15 | sonar.language=js 16 | sonar.scm.provider=git 17 | sonar.scm.disabled=false # setting to false breaks sonar runner 18 | 19 | sonar.exclusions=**/.meteor/**,app/packages/tests-proxy/** 20 | sonar.sourceEncoding=UTF-8 21 | sonar.scm.threadCount=2 22 | 23 | # Encoding of the source code 24 | sonar.sourceEncoding=UTF-8 25 | 26 | -------------------------------------------------------------------------------- /configs/.eslintrc-base: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaFeatures":{ 3 | "arrowFunctions":false, 4 | "binaryLiterals":false, 5 | "blockBindings":false, 6 | "classes":false, 7 | "defaultParams":false, 8 | "destructuring":false, 9 | "forOf":false, 10 | "generators":false, 11 | "modules":false, 12 | "objectLiteralComputedProperties":false, 13 | "objectLiteralDuplicateProperties":false, 14 | "objectLiteralShorthandMethods":false, 15 | "objectLiteralShorthandProperties":false, 16 | "octalLiterals":false, 17 | "regexUFlag":false, 18 | "regexYFlag":false, 19 | "restParams":false, 20 | "spread":false, 21 | "superInFunctions":false, 22 | "templateStrings":false, 23 | "unicodeCodePointEscapes":false, 24 | "globalReturn":false, 25 | "jsx":false 26 | }, 27 | "env":{ 28 | "browser":false, 29 | "node":false, 30 | "worker":false, 31 | "amd":false, 32 | "mocha":false, 33 | "jasmine":false, 34 | "phantomjs":false, 35 | "jquery":false, 36 | "prototypejs":false, 37 | "shelljs":false, 38 | "meteor":false, 39 | "mongo":false, 40 | "applescript":false, 41 | "es6":false 42 | }, 43 | "globals":{ 44 | "meteor":false 45 | }, 46 | "plugins":[ 47 | 48 | ], 49 | "rules":{ 50 | "comma-dangle":0, 51 | "no-comma-dangle":0, 52 | "no-cond-assign":0, 53 | "no-console":0, 54 | "no-constant-condition":0, 55 | "no-control-regex":0, 56 | "no-debugger":0, 57 | "no-dupe-args":0, 58 | "no-dupe-keys":0, 59 | "no-duplicate-case":0, 60 | "no-empty-character-class":0, 61 | "no-empty-class":0, 62 | "no-empty":0, 63 | "no-ex-assign":0, 64 | "no-extra-boolean-cast":0, 65 | "no-extra-parens":0, 66 | "no-extra-semi":0, 67 | "no-func-assign":0, 68 | "no-inner-declarations":0, 69 | "no-invalid-regexp":0, 70 | "no-irregular-whitespace":0, 71 | "no-negated-in-lhs":0, 72 | "no-obj-calls":0, 73 | "no-regex-spaces":0, 74 | "no-reserved-keys":0, 75 | "no-sparse-arrays":0, 76 | "no-unreachable":0, 77 | "use-isnan":0, 78 | "valid-jsdoc":0, 79 | "valid-typeof":0, 80 | "accessor-pairs":0, 81 | "block-scoped-var":0, 82 | "complexity":0, 83 | "consistent-return":0, 84 | "curly":0, 85 | "default-case":0, 86 | "dot-notation":0, 87 | "dot-location":0, 88 | "eqeqeq":0, 89 | "guard-for-in":0, 90 | "no-alert":0, 91 | "no-caller":0, 92 | "no-div-regex":0, 93 | "no-else-return":0, 94 | "no-empty-label":0, 95 | "no-eq-null":0, 96 | "no-eval":0, 97 | "no-extend-native":0, 98 | "no-extra-bind":0, 99 | "no-fallthrough":0, 100 | "no-floating-decimal":0, 101 | "no-implied-eval":0, 102 | "no-iterator":0, 103 | "no-labels":0, 104 | "no-lone-blocks":0, 105 | "no-loop-func":0, 106 | "no-multi-spaces":0, 107 | "no-multi-str":0, 108 | "no-native-reassign":0, 109 | "no-new-func":0, 110 | "no-new-wrappers":0, 111 | "no-new":0, 112 | "no-octal-escape":0, 113 | "no-octal":0, 114 | "no-param-reassign":0, 115 | "no-process-env":0, 116 | "no-proto":0, 117 | "no-redeclare":0, 118 | "no-return-assign":0, 119 | "no-script-url":0, 120 | "no-self-compare":0, 121 | "no-sequences":0, 122 | "no-throw-literal":0, 123 | "no-unused-expressions":0, 124 | "no-void":0, 125 | "no-warning-comments":0, 126 | "no-with":0, 127 | "radix":0, 128 | "vars-on-top":0, 129 | "wrap-iife":0, 130 | "yoda":0, 131 | "global-strict":0, 132 | "no-extra-strict":0, 133 | "strict":0, 134 | "no-catch-shadow":0, 135 | "no-delete-var":0, 136 | "no-label-var":0, 137 | "no-shadow-restricted-names":0, 138 | "no-shadow":0, 139 | "no-undef-init":0, 140 | "no-undef":0, 141 | "no-undefined":0, 142 | "no-unused-vars":0, 143 | "no-use-before-define":0, 144 | "handle-callback-err":0, 145 | "no-mixed-requires":0, 146 | "no-new-require":0, 147 | "no-path-concat":0, 148 | "no-process-exit":0, 149 | "no-restricted-modules":0, 150 | "no-sync":0, 151 | "brace-style":0, 152 | "camelcase":0, 153 | "comma-spacing":0, 154 | "comma-style":0, 155 | "computed-property-spacing":0, 156 | "consistent-this":0, 157 | "eol-last":0, 158 | "func-names":0, 159 | "func-style":0, 160 | "indent":0, 161 | "key-spacing":0, 162 | "lines-around-comment":0, 163 | "linebreak-style":0, 164 | "max-nested-callbacks":0, 165 | "new-cap":0, 166 | "new-parens":0, 167 | "newline-after-var":0, 168 | "no-array-constructor":0, 169 | "no-continue":0, 170 | "no-inline-comments":0, 171 | "no-lonely-if":0, 172 | "no-mixed-spaces-and-tabs":0, 173 | "no-multiple-empty-lines":0, 174 | "no-nested-ternary":0, 175 | "no-new-object":0, 176 | "no-space-before-semi":0, 177 | "no-spaced-func":0, 178 | "no-ternary":0, 179 | "no-trailing-spaces":0, 180 | "no-underscore-dangle":0, 181 | "no-unneeded-ternary":0, 182 | "no-wrap-func":0, 183 | "object-curly-spacing":0, 184 | "one-var":0, 185 | "operator-assignment":0, 186 | "operator-linebreak":0, 187 | "padded-blocks":0, 188 | "quote-props":0, 189 | "quotes":0, 190 | "semi-spacing":0, 191 | "semi":0, 192 | "sort-vars":0, 193 | "space-after-function-name":0, 194 | "space-after-keywords":0, 195 | "space-before-blocks":0, 196 | "space-before-function-paren":0, 197 | "space-before-function-parentheses":0, 198 | "space-in-brackets":0, 199 | "space-in-parens":0, 200 | "space-infix-ops":0, 201 | "space-return-throw-case":0, 202 | "space-unary-ops":0, 203 | "space-unary-word-ops":0, 204 | "spaced-comment":0, 205 | "spaced-line-comment":0, 206 | "wrap-regex":0, 207 | "generator-star-spacing":0, 208 | "generator-star":0, 209 | "no-var":0, 210 | "object-shorthand":0, 211 | "prefer-const":0, 212 | "max-depth":0, 213 | "max-len":0, 214 | "max-params":0, 215 | "max-statements":0, 216 | "no-bitwise":0, 217 | "no-plusplus":0 218 | } 219 | } 220 | -------------------------------------------------------------------------------- /configs/.eslintrc-base-commented: -------------------------------------------------------------------------------- 1 | //.eslintrc for use with v0.21.0 2 | // inspired by https://gist.github.com/cletusw/e01a85e399ab563b1236 3 | // use 0 for no action, 1 for warning, 2 for error 4 | // ESLint Meteor Configuration File 5 | { 6 | // http://eslint.org/docs/rules/ 7 | 8 | "ecmaFeatures": { 9 | "arrowFunctions": false, // enable arrow functions 10 | "binaryLiterals": false, // enable binary literals 11 | "blockBindings": false, // enable let and const (aka block bindings) 12 | "classes": false, // enable classes 13 | "defaultParams": false, // enable default function parameters 14 | "destructuring": false, // enable destructuring 15 | "forOf": false, // enable for-of loops 16 | "generators": false, // enable generators 17 | "modules": false, // enable modules and global strict mode 18 | "objectLiteralComputedProperties": false, // enable computed object literal property names 19 | "objectLiteralDuplicateProperties": false, // enable duplicate object literal properties in strict mode 20 | "objectLiteralShorthandMethods": false, // enable object literal shorthand methods 21 | "objectLiteralShorthandProperties": false, // enable object literal shorthand properties 22 | "octalLiterals": false, // enable octal literals 23 | "regexUFlag": false, // enable the regular expression u flag 24 | "regexYFlag": false, // enable the regular expression y flag 25 | "restParams": false, // enable the rest parameters 26 | "spread": false, // enable the spread operator 27 | "superInFunctions": false, // enable super references inside of functions 28 | "templateStrings": false, // enable template strings 29 | "unicodeCodePointEscapes": false, // enable code point escapes 30 | "globalReturn": false, // allow return statements in the global scope 31 | "jsx": false // enable JSX 32 | }, 33 | 34 | "env": { 35 | "browser": false, // browser global variables. 36 | "node": false, // Node.js global variables and Node.js-specific rules. 37 | "worker": false, // web workers global variables. 38 | "amd": false, // defines require() and define() as global variables as per the amd spec. 39 | "mocha": false, // adds all of the Mocha testing global variables. 40 | "jasmine": false, // adds all of the Jasmine testing global variables for version 1.3 and 2.0. 41 | "phantomjs": false, // phantomjs global variables. 42 | "jquery": false, // jquery global variables. 43 | "prototypejs": false, // prototypejs global variables. 44 | "shelljs": false, // shelljs global variables. 45 | "meteor": false, // meteor global variables. 46 | "mongo": false, // mongo global variables. 47 | "applescript": false, // applescript global variables. 48 | "es6": false // enable all ECMAScript 6 features except for modules. 49 | }, 50 | 51 | "globals": { 52 | "meteor": false 53 | }, 54 | 55 | "plugins": [ 56 | // (must run `npm install eslint-plugin-*` as well ) 57 | ], 58 | 59 | "rules": { 60 | /////////// Rules /////////// 61 | // Rules in ESLint are divided into several categories to help you better understand their value. 62 | // Additionally, not all rules are enabled by default. 63 | // Those that are not enabled by default are marked as being off. 64 | 65 | /////////// Possible Errors /////////// 66 | // The following rules point out areas where you might have made mistakes. 67 | "comma-dangle": 0, // disallow or enforce trailing commas 68 | "no-comma-dangle": 0, // (deprecated) disallow trailing commas in object literals (off by default) 69 | "no-cond-assign": 0, // disallow assignment in conditional expressions 70 | "no-console": 0, // disallow use of console (off by default in the node environment) 71 | "no-constant-condition": 0, // disallow use of constant expressions in conditions 72 | "no-control-regex": 0, // disallow control characters in regular expressions 73 | "no-debugger": 0, // disallow use of debugger 74 | "no-dupe-args": 0, // disallow duplicate arguments in functions 75 | "no-dupe-keys": 0, // disallow duplicate keys when creating object literals 76 | "no-duplicate-case": 0, // disallow a duplicate case label. 77 | "no-empty-character-class": 0, // disallow the use of empty character classes in regular expressions 78 | "no-empty-class": 0, // (deprecated) disallow the use of empty character classes in regular expressions (off by default) 79 | "no-empty": 0, // disallow empty statements 80 | "no-ex-assign": 0, // disallow assigning to the exception in a catch block 81 | "no-extra-boolean-cast": 0, // disallow double-negation boolean casts in a boolean context 82 | "no-extra-parens": 0, // disallow unnecessary parentheses (off by default) 83 | "no-extra-semi": 0, // disallow unnecessary semicolons 84 | "no-func-assign": 0, // disallow overwriting functions written as function declarations 85 | "no-inner-declarations": 0, // disallow function or variable declarations in nested blocks 86 | "no-invalid-regexp": 0, // disallow invalid regular expression strings in the RegExp constructor 87 | "no-irregular-whitespace": 0, // disallow irregular whitespace outside of strings and comments 88 | "no-negated-in-lhs": 0, // disallow negation of the left operand of an in expression 89 | "no-obj-calls": 0, // disallow the use of object properties of the global object (Math and JSON) as functions 90 | "no-regex-spaces": 0, // disallow multiple spaces in a regular expression literal 91 | "no-reserved-keys": 0, // disallow reserved words being used as object literal keys (off by default) 92 | "no-sparse-arrays": 0, // disallow sparse arrays 93 | "no-unreachable": 0, // disallow unreachable statements after a return, throw, continue, or break statement 94 | "use-isnan": 0, // disallow comparisons with the value NaN 95 | "valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default) 96 | "valid-typeof": 0, // Ensure that the results of typeof are compared against a valid string 97 | 98 | /////////// Best Practices /////////// 99 | // These are rules designed to prevent you from making mistakes. They either prescribe a better way of doing something or help you avoid footguns. 100 | "accessor-pairs": 0, // Enforces getter/setter pairs in objects (off by default) 101 | "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default) 102 | "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default) 103 | "consistent-return": 0, // require return statements to either always or never specify values 104 | "curly": 0, // specify curly brace conventions for all control statements 105 | "default-case": 0, // require default case in switch statements (off by default) 106 | "dot-notation": 0, // encourages use of dot notation whenever possible 107 | "dot-location": 0, // enforces consistent newlines before or after dots (off by default) 108 | "eqeqeq": 0, // require the use of === and !== 109 | "guard-for-in": 0, // make sure for-in loops have an if statement (off by default) 110 | "no-alert": 0, // disallow the use of alert, confirm, and prompt 111 | "no-caller": 0, // disallow use of arguments.caller or arguments.callee 112 | "no-div-regex": 0, // disallow division operators explicitly at beginning of regular expression (off by default) 113 | "no-else-return": 0, // disallow else after a return in an if (off by default) 114 | "no-empty-label": 0, // disallow use of labels for anything other than loops and switches 115 | "no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default) 116 | "no-eval": 0, // disallow use of eval() 117 | "no-extend-native": 0, // disallow adding to native types 118 | "no-extra-bind": 0, // disallow unnecessary function binding 119 | "no-fallthrough": 0, // disallow fallthrough of case statements 120 | "no-floating-decimal": 0, // disallow the use of leading or trailing decimal points in numeric literals (off by default) 121 | "no-implied-eval": 0, // disallow use of eval()-like methods 122 | "no-iterator": 0, // disallow usage of __iterator__ property 123 | "no-labels": 0, // disallow use of labeled statements 124 | "no-lone-blocks": 0, // disallow unnecessary nested blocks 125 | "no-loop-func": 0, // disallow creation of functions within loops 126 | "no-multi-spaces": 0, // disallow use of multiple spaces 127 | "no-multi-str": 0, // disallow use of multiline strings 128 | "no-native-reassign": 0, // disallow reassignments of native objects 129 | "no-new-func": 0, // disallow use of new operator for Function object 130 | "no-new-wrappers": 0, // disallows creating new instances of String,Number, and Boolean 131 | "no-new": 0, // disallow use of new operator when not part of the assignment or comparison 132 | "no-octal-escape": 0, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251"; 133 | "no-octal": 0, // disallow use of octal literals 134 | "no-param-reassign": 0, // disallow reassignment of function parameters (off by default) 135 | "no-process-env": 0, // disallow use of process.env (off by default) 136 | "no-proto": 0, // disallow usage of __proto__ property 137 | "no-redeclare": 0, // disallow declaring the same variable more than once 138 | "no-return-assign": 0, // disallow use of assignment in return statement 139 | "no-script-url": 0, // disallow use of javascript: urls. 140 | "no-self-compare": 0, // disallow comparisons where both sides are exactly the same (off by default) 141 | "no-sequences": 0, // disallow use of comma operator 142 | "no-throw-literal": 0, // restrict what can be thrown as an exception (off by default) 143 | "no-unused-expressions": 0, // disallow usage of expressions in statement position 144 | "no-void": 0, // disallow use of void operator (off by default) 145 | "no-warning-comments": 0, // disallow usage of configurable warning terms in comments e.g. TODO or FIXME (off by default) 146 | "no-with": 0, // disallow use of the with statement 147 | "radix": 0, // require use of the second argument for parseInt() (off by default) 148 | "vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default) 149 | "wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default) 150 | "yoda": 0, // require or disallow Yoda conditions 151 | 152 | /////////// Strict Mode /////////// 153 | // These rules relate to using strict mode. 154 | "global-strict": 0, // (deprecated) require or disallow the "use strict" pragma in the global scope (on by default)(off by default in the node environment) 155 | "no-extra-strict": 0, // (deprecated) disallow unnecessary use of "use strict"; when already in strict mode 156 | "strict": 0, // controls location of Use Strict Directives 157 | 158 | /////////// Variables /////////// 159 | // These rules have to do with variable declarations. 160 | "no-catch-shadow": 0, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) 161 | "no-delete-var": 0, // disallow deletion of variables 162 | "no-label-var": 0, // disallow labels that share a name with a variable 163 | "no-shadow-restricted-names": 0, // disallow shadowing of names such as arguments 164 | "no-shadow": 0, // disallow declaration of variables already declared in the outer scope 165 | "no-undef-init": 0, // disallow use of undefined when initializing variables 166 | "no-undef": 0, // disallow use of undeclared variables unless mentioned in a /*global */ block 167 | "no-undefined": 0, // disallow use of undefined variable (off by default) 168 | "no-unused-vars": 0, // disallow declaration of variables that are not used in the code 169 | "no-use-before-define": 0, // disallow use of variables before they are defined 170 | 171 | /////////// Node.js /////////// 172 | // These rules are specific to JavaScript running on Node.js. 173 | "handle-callback-err": 0, // enforces error handling in callbacks (off by default) (on by default in the node environment) 174 | "no-mixed-requires": 0, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment) 175 | "no-new-require": 0, // disallow use of new operator with the require function (off by default) (on by default in the node environment) 176 | "no-path-concat": 0, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment) 177 | "no-process-exit": 0, // disallow process.exit() (on by default in the node environment) 178 | "no-restricted-modules": 0, // restrict usage of specified node modules (off by default) 179 | "no-sync": 0, // disallow use of synchronous methods (off by default) 180 | 181 | /////////// Stylistic Issues /////////// 182 | // These rules are purely matters of style and are quite subjective. 183 | "brace-style": 0, // enforce one true brace style (off by default) 184 | "camelcase": 0, // require camel case names 185 | "comma-spacing": 0, // enforce spacing before and after comma 186 | "comma-style": 0, // enforce one true comma style (off by default) 187 | "computed-property-spacing": 0, // require or disallow padding inside computed properties (off by default) 188 | "consistent-this": 0, // enforces consistent naming when capturing the current execution context (off by default) 189 | "eol-last": 0, // enforce newline at the end of file, with no multiple empty lines 190 | "func-names": 0, // require function expressions to have a name (off by default) 191 | "func-style": 0, // enforces use of function declarations or expressions (off by default) 192 | "indent": 0, // this option sets a specific tab width for your code (off by default) 193 | "key-spacing": 0, // enforces spacing between keys and values in object literal properties 194 | "lines-around-comment": 0, // enforces empty lines around comments (off by default) 195 | "linebreak-style": 0, // disallow mixed LF and CRLF as linebreaks (off by default) 196 | "max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default) 197 | "new-cap": 0, // require a capital letter for constructors 198 | "new-parens": 0, // disallow the omission of parentheses when invoking a constructor with no arguments 199 | "newline-after-var": 0, // allow/disallow an empty newline after var statement (off by default) 200 | "no-array-constructor": 0, // disallow use of the Array constructor 201 | "no-continue": 0, // disallow use of the continue statement (off by default) 202 | "no-inline-comments": 0, // disallow comments inline after code (off by default) 203 | "no-lonely-if": 0, // disallow if as the only statement in an else block (off by default) 204 | "no-mixed-spaces-and-tabs": 0, // disallow mixed spaces and tabs for indentation 205 | "no-multiple-empty-lines": 0, // disallow multiple empty lines (off by default) 206 | "no-nested-ternary": 0, // disallow nested ternary expressions (off by default) 207 | "no-new-object": 0, // disallow use of the Object constructor 208 | "no-space-before-semi": 0, // (deprecated) disallow space before semicolon (off by default) 209 | "no-spaced-func": 0, // disallow space between function identifier and application 210 | "no-ternary": 0, // disallow the use of ternary operators (off by default) 211 | "no-trailing-spaces": 0, // disallow trailing whitespace at the end of lines 212 | "no-underscore-dangle": 0, // disallow dangling underscores in identifiers 213 | "no-unneeded-ternary": 0, // disallow the use of Boolean literals in conditional expressions (off by default) 214 | "no-wrap-func": 0, // (deprecated) disallow wrapping of non-IIFE statements in parens 215 | "object-curly-spacing": 0, // require or disallow padding inside curly braces (off by default) 216 | "one-var": 0, // allow or disallow one variable declaration per function (off by default) 217 | "operator-assignment": 0, // require assignment operator shorthand where possible or prohibit it entirely (off by default) 218 | "operator-linebreak": 0, // enforce operators to be placed before or after line breaks (off by default) 219 | "padded-blocks": 0, // enforce padding within blocks (off by default) 220 | "quote-props": 0, // require quotes around object literal property names (off by default) 221 | "quotes": 0, // specify whether backticks, double or single quotes should be used 222 | "semi-spacing": 0, // enforce spacing before and after semicolons 223 | "semi": 0, // require or disallow use of semicolons instead of ASI 224 | "sort-vars": 0, // sort variables within the same declaration block (off by default) 225 | "space-after-function-name": 0, // (deprecated) require a space after function names (off by default) 226 | "space-after-keywords": 0, // require a space after certain keywords (off by default) 227 | "space-before-blocks": 0, // require or disallow space before blocks (off by default) 228 | "space-before-function-paren": 0, // require or disallow space before function opening parenthesis (off by default) 229 | "space-before-function-parentheses": 0, // (deprecated) require or disallow space before function parentheses (off by default) 230 | "space-in-brackets": 0, // (deprecated) require or disallow spaces inside brackets (off by default) 231 | "space-in-parens": 0, // require or disallow spaces inside parentheses (off by default) 232 | "space-infix-ops": 0, // require spaces around operators 233 | "space-return-throw-case": 0, // require a space after return, throw, and case 234 | "space-unary-ops": 0, // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) 235 | "space-unary-word-ops": 0, // (deprecated) Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) 236 | "spaced-comment": 0, // require or disallow a space immediately following the // or /* in a comment (off by default) 237 | "spaced-line-comment": 0, // (deprecated) require or disallow a space immediately following the // in a line comment (off by default) 238 | "wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default) 239 | 240 | /////////// ECMAScript 6 /////////// 241 | // These rules are only relevant to ES6 environments and are off by default. 242 | "generator-star-spacing": 0, // enforce the spacing around the * in generator functions (off by default) 243 | "generator-star": 0, // (deprecated) enforce the position of the * in generator functions (off by default) 244 | "no-var": 0, // require let or const instead of var (off by default) 245 | "object-shorthand": 0, // require method and property shorthand syntax for object literals (off by default) 246 | "prefer-const": 0, // suggest using of const declaration for variables that are never modified after declared (off by default) 247 | 248 | /////////// Legacy /////////// 249 | // The following rules are included for compatibility with JSHint and JSLint. While the names of the rules may not match up with the JSHint/JSLint counterpart, the functionality is the same. 250 | "max-depth": 0, // specify the maximum depth that blocks can be nested (off by default) 251 | "max-len": 0, // specify the maximum length of a line in your program (off by default) 252 | "max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default) 253 | "max-statements": 0, // specify the maximum number of statement allowed in a function (off by default) 254 | "no-bitwise": 0, // disallow use of bitwise operators (off by default) 255 | "no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default) 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /configs/.jscsrc-base: -------------------------------------------------------------------------------- 1 | //.jscsrc 2 | // tested with jscs v1.11.3 3 | { 4 | //"disallowAnonymousFunctions": true, // Requires that a function expression be named. 5 | //"disallowCapitalizedComments": true, // Requires the first alphabetical character of a comment to be lowercase. 6 | //"disallowCommaBeforeLineBreak": true, // Disallows commas as last token on a line in lists. 7 | //"disallowCurlyBraces": true, // Disallows curly braces after statements. 8 | //"disallowDanglingUnderscores": true, // Disallows identifiers that start or end in _. Some popular identifiers are automatically listed as exceptions 9 | //"disallowEmptyBlocks": true, // Disallows empty blocks (except for catch blocks). 10 | //"disallowFunctionDeclarations": true, // Disallows function declarations. 11 | //"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"], // Disallows implicit type conversion. 12 | //"disallowKeywordsInComments": true, // Disallows keywords in your comments, such as TODO or FIXME 13 | //"disallowKeywordsOnNewLine": ["else"], // Disallows placing keywords on a new line. 14 | //"disallowKeywords": ["with"], // Disallows usage of specified keywords. 15 | //"disallowMixedSpacesAndTabs": true, // Requires lines to not contain both spaces and tabs consecutively, 16 | //"disallowMultipleLineBreaks": true, // Disallows multiple blank lines in a row. 17 | //"disallowMultipleLineStrings": true, // Disallows strings that span multiple lines without using concatenation. 18 | //"disallowMultipleVarDecl": true, // Disallows multiple var declaration (except for-loop). 19 | //"disallowNewlineBeforeBlockStatements": true, // Disallows newline before opening curly brace of all block statements. 20 | //"disallowOperatorBeforeLineBreak": true, // Requires putting certain operators on the next line rather than on the current line before a line break. 21 | //"disallowPaddingNewlinesBeforeKeywords": true, // Disallow an empty line above the specified keywords. 22 | //"disallowPaddingNewlinesInBlocks": true, // Disallows blocks from beginning and ending with 2 newlines. 23 | //"disallowPaddingNewLinesInObjects": true, // Disallows newline inside curly braces of all objects. 24 | //"disallowQuotedKeysInObjects": true, // Disallows quoted keys in object if possible. 25 | //"disallowSemicolons": true, // Disallows lines from ending in a semicolon. 26 | //"disallowSpaceAfterBinaryOperators": true, // Requires sticking binary operators to the right. 27 | //"disallowSpaceAfterKeywords": true, // Disallows space after keyword. 28 | //"disallowSpaceAfterLineComment": true, // Requires that a line comment (//) not be followed by a space. 29 | //"disallowSpaceAfterObjectKeys": true, // Disallows space after object keys. 30 | //"disallowSpaceAfterPrefixUnaryOperators": true, // Requires sticking unary operators to the right. 31 | //"disallowSpaceBeforeBinaryOperators": true, // Requires sticking binary operators to the left. 32 | //"disallowSpaceBeforeBlockStatements": true, // Disallows space before block statements (for loops, control structures). 33 | //"disallowSpaceBeforeKeywords": true, // Disallows space before keyword. 34 | //"disallowSpaceBeforeObjectValues": true, // Disallows space after object keys. 35 | //"disallowSpaceBeforePostfixUnaryOperators": true, // Requires sticking unary operators to the left. 36 | //"disallowSpaceBetweenArguments": true, // Ensure there are no spaces after argument separators in call expressions. 37 | //"disallowSpacesInAnonymousFunctionExpression": { // Disallows space before () or {} in anonymous function expressions. 38 | // "beforeOpeningRoundBrace": true, 39 | // "beforeOpeningCurlyBrace": true 40 | // }, 41 | //"disallowSpacesInCallExpression": true, // Disallows space before () in call expressions. 42 | //"disallowSpacesInConditionalExpression": true, // Disallows space before and/or after ? or : in conditional expressions. 43 | //"disallowSpacesInForStatement": true, // Disallow spaces in between for statement. 44 | //"disallowSpacesInFunctionDeclaration": { // Disallows space before () or {} in function declarations. 45 | // "beforeOpeningRoundBrace": true, 46 | // "beforeOpeningCurlyBrace": true 47 | // }, 48 | //"disallowSpacesInFunctionExpression": { // Disallows space before () or {} in function expressions (both named and anonymous). 49 | // "beforeOpeningRoundBrace": true, 50 | // "beforeOpeningCurlyBrace": true 51 | // }, 52 | //"disallowSpacesInFunction": { // Disallows space before () or {} in function expressions (both named and anonymous). 53 | // "beforeOpeningRoundBrace": true, 54 | // "beforeOpeningCurlyBrace": true 55 | // }, 56 | //"disallowSpacesInNamedFunctionExpression": { // Disallows space before () or {} in named function expressions. 57 | // "beforeOpeningRoundBrace": true, 58 | // "beforeOpeningCurlyBrace": true 59 | // }, 60 | //"disallowSpacesInsideArrayBrackets": true, // Disallows space after opening array square bracket and before closing. 61 | //"disallowSpacesInsideBrackets": true, // Disallows space after opening square bracket and before closing. 62 | //"disallowSpacesInsideObjectBrackets": true, // Disallows space after opening object curly brace and before closing. 63 | //"disallowSpacesInsideParentheses": true, // Disallows space after opening round bracket and before closing. 64 | //"disallowTrailingComma": true, // Disallows an extra comma following the final element of an array or object literal. 65 | //"disallowTrailingWhitespace": true // Requires all lines to end on a non-whitespace character 66 | //"disallowYodaConditions": true, // Requires the variable to be the left hand operator when doing a boolean comparison 67 | //"maximumLineLength": 60, // Requires all lines to be at most the number of characters specified 68 | //"requireAlignedObjectValues": "all", // Requires proper alignment in object literals. 69 | //"requireAnonymousFunctions": true, // Requires that a function expression be anonymous. 70 | //"requireBlocksOnNewline": true, // Requires blocks to begin and end with a newline 71 | //"requireCamelCaseOrUpperCaseIdentifiers": true, // Requires identifiers to be camelCased or UPPERCASE_WITH_UNDERSCORES 72 | //"requireCapitalizedComments": true, // Requires the first alphabetical character of a comment to be uppercase, unless it is part of a multi-line textblock. 73 | //"requireCapitalizedConstructors": true, // Requires constructors to be capitalized (except for this) 74 | //"requireCommaBeforeLineBreak": true, // Requires commas as last token on a line in lists. 75 | //"requireCurlyBraces": true, // Requires curly braces after statements. 76 | //"requireDotNotation": true, // Requires member expressions to use dot notation when possible 77 | //"requireFunctionDeclarations": true, // Requires function declarations by disallowing assignment of functions 78 | //"requireKeywordsOnNewLine": ["else"], // Requires placing keywords on a new line. 79 | //"requireLineBreakAfterVariableAssignment": true, // Requires placing line feed after assigning a variable. 80 | //"requireLineFeedAtFileEnd": true, // Requires placing line feed at file end. 81 | //"requireMultipleVarDecl": true, // Requires multiple var declaration. 82 | //"requireNewlineBeforeBlockStatements": true, // Requires newline before opening curly brace of all block statements. 83 | //"requireOperatorBeforeLineBreak": true, // Requires operators to appear before line breaks and not after. 84 | //"requirePaddingNewlinesBeforeKeywords": true, // Requires an empty line above the specified keywords unless the keyword is the first expression in a block. 85 | //"requirePaddingNewlinesInBlocks": true, // Requires blocks to begin and end with 2 newlines 86 | //"requirePaddingNewLinesInObjects": true, // Requires newline inside curly braces of all objects. 87 | //"requireParenthesesAroundIIFE": true, // Requires parentheses around immediately invoked function expressions. 88 | //"requireQuotedKeysInObjects": true, // Requires quoted keys in objects. 89 | //"requireSpaceAfterBinaryOperators": true, // Disallows sticking binary operators to the right. 90 | //"requireSpaceAfterKeywords": true, // Requires space after keyword. 91 | //"requireSpaceAfterLineComment": true, // Requires that a line comment (//) be followed by a space. 92 | //"requireSpaceAfterObjectKeys": true, // Requires space after object keys. 93 | //"requireSpaceAfterPrefixUnaryOperators": true, // Disallows sticking unary operators to the right. 94 | //"requireSpaceBeforeBinaryOperators": true, // Disallows sticking binary operators to the left. 95 | //"requireSpaceBeforeBlockStatements": true, // Requires space before block statements (for loops, control structures). 96 | //"requireSpaceBeforeKeywords": true, // Requires space before keyword. 97 | //"requireSpaceBeforeObjectValues": true, // Requires space after object keys. 98 | //"requireSpaceBeforePostfixUnaryOperators": true, // Disallows sticking unary operators to the left. 99 | //"requireSpaceBetweenArguments": true, // Ensure there are spaces after argument separators in call expressions. 100 | //"requireSpacesInAnonymousFunctionExpression": { // Requires space before () or {} in anonymous function expressions. 101 | // "beforeOpeningRoundBrace": true, 102 | // "beforeOpeningCurlyBrace": true 103 | // }, 104 | //"requireSpacesInCallExpression": true, // Requires space before () in call expressions. 105 | //"requireSpacesInConditionalExpression": true, // Requires space before and/or after ? or : in conditional expressions. 106 | //"requireSpacesInForStatement": true, // Requires spaces inbetween for statement. 107 | //"requireSpacesInFunctionDeclaration": { // Requires space before () or {} in function declarations. 108 | // "beforeOpeningRoundBrace": true, 109 | // "beforeOpeningCurlyBrace": true 110 | // }, 111 | //"requireSpacesInFunctionExpression": { // Requires space before () or {} in function expressions (both named and anonymous). 112 | // "beforeOpeningRoundBrace": true, 113 | // "beforeOpeningCurlyBrace": true 114 | // }, 115 | //"requireSpacesInFunction": { // Requires space before () or {} in function expressions (both named and anonymous). 116 | // "beforeOpeningRoundBrace": true, 117 | // "beforeOpeningCurlyBrace": true 118 | // }, 119 | //"requireSpacesInNamedFunctionExpression": { // Requires space before () or {} in named function expressions. 120 | // "beforeOpeningRoundBrace": true, 121 | // "beforeOpeningCurlyBrace": true 122 | // }, 123 | //"requireSpacesInsideArrayBrackets": "all", // Requires space after opening array square bracket and before closing. 124 | //"requireSpacesInsideBrackets": true, // Requires space after opening square bracket and before closing. 125 | //"requireSpacesInsideObjectBrackets": "all", // Requires space after opening object curly brace and before closing. 126 | //"requireSpacesInsideParentheses": "all", // Requires space after opening round bracket and before closing. 127 | //"requireTrailingComma": true, // Requires an extra comma following the final element of an array or object literal. 128 | //"requireYodaConditions": true, // Requires the variable to be the right hand operator when doing a boolean comparison 129 | //"safeContextKeyword": ["that"], // Option to check var that = this expressions 130 | //"validateIndentation": 2, // Validates indentation for switch statements and block statements 131 | //"validateLineBreaks": "LF", // Option to check line break characters 132 | //"validateParameterSeparator": ", ", // Enable validation of separators between function parameters. Will ignore newlines. 133 | //"validateQuoteMarks": true // Requires all quote marks to be either the supplied value, or consistent if true 134 | } 135 | -------------------------------------------------------------------------------- /configs/.jshintrc-base: -------------------------------------------------------------------------------- 1 | { 2 | // JSHint Reset Configuration File 3 | // See http://jshint.com/docs/ for more details 4 | // tested with jsHint v2.6.0 5 | 6 | "maxerr" : 50, // {int} Maximum error before stopping 7 | 8 | // Enforcing 9 | "bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.) 10 | "camelcase" : false, // true: Identifiers must be in camelCase 11 | "curly" : false, // true: Require {} for every new block or scope 12 | "eqeqeq" : false, // true: Require triple equals (===) for comparison 13 | "forin" : false, // true: Require filtering for..in loops with obj.hasOwnProperty() 14 | "freeze" : false, // true: prohibits overwriting prototypes of native objects such as Array, Date etc. 15 | "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` 16 | "indent" : 4, // {int} Number of spaces to use for indentation 17 | "latedef" : false, // true: Require variables/functions to be defined before being used 18 | "newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()` 19 | "noarg" : false, // true: Prohibit use of `arguments.caller` and `arguments.callee` 20 | "noempty" : false, // true: Prohibit use of empty blocks 21 | "nonbsp" : false, // true: Prohibit "non-breaking whitespace" characters. 22 | "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) 23 | "plusplus" : false, // true: Prohibit use of `++` & `--` 24 | "quotmark" : false, // Quotation mark consistency: 25 | // false : do nothing (default) 26 | // true : ensure whatever is used is consistent 27 | // "single" : require single quotes 28 | // "double" : require double quotes 29 | "undef" : false, // true: Require all non-global variables to be declared (prevents global leaks) 30 | "unused" : false, // true: Require all defined variables be used 31 | "strict" : false, // true: Requires all functions run in ES5 Strict Mode 32 | "maxparams" : false, // {int} Max number of formal params allowed per function 33 | "maxdepth" : false, // {int} Max depth of nested blocks (within functions) 34 | "maxstatements" : false, // {int} Max number statements per function 35 | "maxcomplexity" : false, // {int} Max cyclomatic complexity per function 36 | "maxlen" : false, // {int} Max number of characters per line 37 | 38 | // Relaxing 39 | "asi" : true, // true: Tolerate Automatic Semicolon Insertion (no semicolons) 40 | "boss" : true, // true: Tolerate assignments where comparisons would be expected 41 | "debug" : true, // true: Allow debugger statements e.g. browser breakpoints. 42 | "eqnull" : true, // true: Tolerate use of `== null` 43 | "es5" : true, // true: Allow ES5 syntax (ex: getters and setters) 44 | "esnext" : true, // true: Allow ES.next (ES6) syntax (ex: `const`) 45 | "moz" : true, // true: Allow Mozilla specific syntax (extends and overrides esnext features) 46 | // (ex: `for each`, multiple try/catch, function expression…) 47 | "evil" : true, // true: Tolerate use of `eval` and `new Function()` 48 | "expr" : true, // true: Tolerate `ExpressionStatement` as Programs 49 | "funcscope" : true, // true: Tolerate defining variables inside control statements 50 | "globalstrict" : true, // true: Allow global "use strict" (also enables 'strict') 51 | "iterator" : true, // true: Tolerate using the `__iterator__` property 52 | "lastsemic" : true, // true: Tolerate omitting a semicolon for the last statement of a 1-line block 53 | "laxbreak" : true, // true: Tolerate possibly unsafe line breakings 54 | "laxcomma" : true, // true: Tolerate comma-first style coding 55 | "loopfunc" : true, // true: Tolerate functions being defined in loops 56 | "multistr" : true, // true: Tolerate multi-line strings 57 | "noyield" : true, // true: Tolerate generator functions with no yield statement in them. 58 | "notypeof" : true, // true: Tolerate invalid typeof operator values 59 | "proto" : true, // true: Tolerate using the `__proto__` property 60 | "scripturl" : true, // true: Tolerate script-targeted URLs 61 | "shadow" : true, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` 62 | "sub" : true, // true: Tolerate using `[]` notation when it can still be expressed in dot notation 63 | "supernew" : true, // true: Tolerate `new function () { ... };` and `new Object;` 64 | "validthis" : true, // true: Tolerate using this in a non-constructor function 65 | 66 | // Environments 67 | "browser" : true, // Web Browser (window, document, etc) 68 | "browserify" : false, // Browserify (node.js code in the browser) 69 | "couch" : false, // CouchDB 70 | "devel" : true, // Development/debugging (alert, confirm, etc) 71 | "dojo" : false, // Dojo Toolkit 72 | "jasmine" : false, // Jasmine 73 | "jquery" : false, // jQuery 74 | "mocha" : false, // Mocha 75 | "mootools" : false, // MooTools 76 | "node" : false, // Node.js 77 | "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) 78 | "prototypejs" : false, // Prototype and Scriptaculous 79 | "qunit" : false, // QUnit 80 | "rhino" : false, // Rhino 81 | "shelljs" : false, // ShellJS 82 | "worker" : false, // Web Workers 83 | "wsh" : false, // Windows Scripting Host 84 | "yui" : false, // Yahoo User Interface 85 | 86 | // Custom Globals 87 | "globals" : {} // additional predefined global variables 88 | } 89 | --------------------------------------------------------------------------------