-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
92 lines (87 loc) · 5.6 KB
/
.eslintrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{
"extends": ["eslint:recommended"],
"env": {
"node": true,
"browser": true,
"es6": true,
"jasmine": true
},
"globals": {
"Modernizr": true,
"Uint8Array": true,
"ga": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {}
},
"rules": {
"max-params": [1, 4],
"no-inner-declarations": 0,
// 2 --> error
"no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments
"no-shadow": 2, // disallow declaration of variables already declared in the outer scope
"eol-last": 2, // last line should have an end-of-line character so that you can easily use linux commands with them (cat etc.)
"key-spacing": 2, // there should be no space before colon and a space after one. e.g. {a: 5}. Not {a:5} or {a :5}
"semi-spacing": 2, // must have no space before a ; but must have one after (if not eol)
"space-infix-ops": 2, // infix operators should be spaced. e.g.: a + b rather than a+b
"space-unary-ops": 2, // e.g. typeof 5. rather than typeof5
"keyword-spacing": 2, // there should be a space after & before keywords. e.g. no return5; should be return 5;
"comma-spacing": 2, // space after a comma
"indent": [2, 4], // indent is 2 spaces (softtab)
"no-unused-expressions": 1, // no unused expressions. aka one that is evaluated to a value but never used;
"semi": 1, // every statement should end with ;
"comma-dangle": 2, // No dangling comma at the end of last element in arrays or objects
"new-cap": 1, // require constructor function names to begin with a capital letter
"curly": [2, "all"], // never omit curly braces around blocks (even single line blocks)
"dot-notation": [2, { "allowKeywords": true }], // enforce dot notation whenever possible
"eqeqeq": 2, // use === and !== instead of == and !=
"no-else-return": 2, // Else is never required if if block ends with return statement, so just omit it
"no-eval": 2, // don't use eval() function
"space-before-blocks": 2, //There should be a space before curly brackets. e.g. no function(){}, shoule be function() {}
"no-extend-native": 2, // disallow extending native types
"no-extra-bind": 2, // disallow unnecessary calls to .bind()
"no-floating-decimal": 2, // no leading or trailing decimal point in numeric literals like .2, 5., -.7 Use 0.2, 5.0, -0.7 etc
"no-implied-eval": 2, // disallow the use of eval()-like methods
"no-lone-blocks": 2, // disallow unnecessary nested blocks
"no-loop-func": 2, // disallow function declarations and expressions inside loop statements
"no-multi-str": 2, // don't allow multiple spaces where no needed like var a = b;
"no-new": 2, // no new operators outside of assignments or comparisons
"no-new-func": 0, // disallow new operators with the Function object
"no-new-wrappers": 2, // disallow new operators with the String, Number, and Boolean objects
"no-octal-escape": 2, // disallow octal escape sequences in string literals
"no-proto": 2, // disallow the use of the __proto__ property
"no-return-assign": 2, // disallow assignment operators in return statements
"no-script-url": 2, // disallow javascript: urls
"no-self-compare": 2, //disallow comparisons where both sides are exactly the same
"no-sequences": 2, // disallow comma operators
"no-throw-literal": 2, // disallow throwing literals as exceptions
"no-with": 2, // disallow with statements
"radix": 0, // enforce the consistent use of the radix argument when using parseInt()
"vars-on-top": 2, // require var declarations be placed at the top of their containing scope
"wrap-iife": 2, // require parentheses around immediate function invocations
"yoda": 0, // don't allow comparisons like 5 === count. Use count === 5 instead.
"quotes": [1, "single", {"avoidEscape": true}], // enforce single quotes for strings. allow double quotes to avoid escaping single quotes like "say 'hello world'"
"no-extra-parens": 2, // don't allow unnecessary parenthesis. It causes confusion
"no-multiple-empty-lines": [2, {"max": 2, "maxEOF": 1, "maxBOF": 1 }], // Don't allow unnecessary multiple empty lines
"no-var": 2, // don't use var, use const or let instead
"array-callback-return": 2, // Enforces return statements in callbacks of array’s methods
"dot-location": [2, "property"], // use consistent dot location before property name when breaking property chain in multiline
"no-useless-call": 2, // disallow unnecessary calls to .call() and .apply()
"array-bracket-spacing": 2, // disallows spaces inside array brackets like [2, 3]
"brace-style": [2, "1tbs", {"allowSingleLine": false}], // enforce one true brace style even for single line blocks
"comma-style": 2, // Place commas at the EOL in arrays etc while breaking in multiline
"max-depth": 2, // enforce a maximum depth of 4 in nested code blocks
"no-nested-ternary": 2, // disallow nested ternary expressions
"prefer-arrow-callback": 2, // Suggest using arrow functions as callbacks
"prefer-const": 2, // Suggest using const for variables which are declared using let but never reassigned
"object-curly-spacing": 2, // don't allow extra spaces in object curly braces. {a: 5 } should be {a: 5}
"max-len": [0, 120, {"ignoreComments": true, "ignoreUrls": true, "ignorePattern": "^import"}], // max length of a line should not exceed 120 chars excepts for comments, urls and import statements.
"camelcase": 2, // naming should be in camelCase. No snake_case
"no-console": 1,
"no-case-declarations": 0,
"no-fallthrough": 1,
"no-unused-vars": 2
}
}