UNPKG

3.56 kBJavaScriptView Raw
1module.exports = {
2 "root": true,
3
4 "env": {
5 "node": true,
6 "es6": true
7 },
8
9 "parserOptions": {
10 "ecmaVersion": 8
11 },
12
13 /**
14 * ESLint rules
15 *
16 * All available rules: http://eslint.org/docs/rules/
17 *
18 * Rules take the following form:
19 * "rule-name", [severity, { opts }]
20 * Severity: 2 == error, 1 == warning, 0 == off.
21 */
22 "rules": {
23 /**
24 * Enforced rules
25 */
26
27
28 // syntax preferences
29 "quotes": [2, "single", {
30 "avoidEscape": true,
31 "allowTemplateLiterals": true
32 }],
33 "semi": 2,
34 "no-extra-semi": 2,
35 "comma-style": [2, "last"],
36 "wrap-iife": [2, "inside"],
37 "spaced-comment": [2, "always", {
38 "markers": ["*"]
39 }],
40 "eqeqeq": [2],
41 "arrow-body-style": [2, "as-needed"],
42 "accessor-pairs": [2, {
43 "getWithoutSet": false,
44 "setWithoutGet": false
45 }],
46 "curly": [2, "multi-or-nest", "consistent"],
47 "new-parens": 2,
48 "func-call-spacing": 2,
49 "arrow-parens": [2, "as-needed"],
50
51 // anti-patterns
52 "no-var": 2,
53 "no-with": 2,
54 "no-multi-str": 2,
55 "no-caller": 2,
56 "no-implied-eval": 2,
57 "no-labels": 2,
58 "no-new-object": 2,
59 "no-octal-escape": 2,
60 "no-self-compare": 2,
61 "no-shadow-restricted-names": 2,
62 "no-cond-assign": 2,
63 "no-debugger": 2,
64 "no-dupe-keys": 2,
65 "no-duplicate-case": 2,
66 "no-empty-character-class": 2,
67 "no-unreachable": 2,
68 "no-unsafe-negation": 2,
69 "radix": 2,
70 "valid-typeof": 2,
71 "no-unused-vars": [2, { "args": "none", "vars": "local" }],
72
73 // es2015 features
74 "require-yield": 2,
75 "template-curly-spacing": [2, "never"],
76
77 // spacing details
78 "space-infix-ops": 2,
79 "space-in-parens": [2, "never"],
80 "space-before-function-paren": [2, "never"],
81 "no-whitespace-before-property": 2,
82 "keyword-spacing": [2, {
83 "overrides": {
84 "if": {"after": true},
85 "else": {"after": true},
86 "for": {"after": true},
87 "while": {"after": true},
88 "do": {"after": true},
89 "switch": {"after": true},
90 "return": {"after": true}
91 }
92 }],
93 "arrow-spacing": [2, {
94 "after": true,
95 "before": true
96 }],
97
98 // file whitespace
99 "no-multiple-empty-lines": [2, {"max": 2}],
100 "no-mixed-spaces-and-tabs": 2,
101 "no-trailing-spaces": 2,
102 "linebreak-style": [ 2, "unix" ],
103 "indent": [2, 2, { "SwitchCase": 1, "CallExpression": {"arguments": 2}, "MemberExpression": 2 }],
104
105 /**
106 * Disabled, aspirational rules
107 */
108 // brace-style is disabled, as eslint cannot enforce 1tbs as default, but allman for functions
109 "brace-style": [0, "allman", { "allowSingleLine": true }],
110
111 // key-spacing is disabled, as some objects use value-aligned spacing, some not.
112 "key-spacing": [0, {
113 "beforeColon": false,
114 "afterColon": true,
115 "align": "value"
116 }],
117 // quote-props is diabled, as property quoting styles are too varied to enforce.
118 "quote-props": [0, "as-needed"],
119
120 // no-implicit-globals will prevent accidental globals
121 "no-implicit-globals": [0]
122 }
123};