UNPKG

3.75 kBPlain TextView Raw
1{
2 "parser": "babel-eslint",
3
4 "root": true,
5
6 "env": {
7 // I write for browser
8 "browser": true,
9 // in CommonJS
10 "node": true,
11 "mocha": true
12 },
13
14 "extends": "eslint:recommended",
15
16 // plugins let use use custom rules below
17 "plugins": [
18 "babel",
19 "react"
20 ],
21
22 "ecmaFeatures": {
23 "jsx": true,
24 "es6": true,
25 },
26
27 "rules": {
28 // 0 = off
29 // 1 = warn
30 // 2 = error
31
32 // React specifc rules
33 "react/jsx-boolean-value": 0,
34 "react/jsx-closing-bracket-location": 1,
35 "react/jsx-curly-spacing": [2, "always"],
36 "react/jsx-indent-props": [1, 2],
37 "react/jsx-no-undef": 1,
38 "react/jsx-uses-react": 1,
39 "react/jsx-uses-vars": 1,
40 "react/wrap-multilines": 1,
41 "react/react-in-jsx-scope": 1,
42 "react/prefer-es6-class": 1,
43 // no binding functions in render for perf
44 "react/jsx-no-bind": 1,
45
46 // handle async/await functions correctly
47 // handle object spread
48 "babel/object-shorthand": 1,
49
50 // handle potential errors
51 "brace-style": [2, "1tbs", { "allowSingleLine": true }],
52 "comma-dangle": [2, "always-multiline"],
53 "consistent-return": 0,
54 "indent": [2, 2, {"SwitchCase": 1}],
55 "max-len": [1, 100, 2, {"ignoreComments": true}],
56 "no-cond-assign": [2, "always"],
57 "no-console": 0,
58 "no-constant-condition": 2,
59 "no-control-regex": 2,
60 "no-debugger": 2,
61 "no-dupe-args": 2,
62 "no-dupe-keys": 2,
63 "no-duplicate-case": 2,
64 "no-empty-character-class": 2,
65 "no-empty": 2,
66 "no-ex-assign": 2,
67 "no-extra-boolean-cast": 2,
68 "no-extra-semi": 2,
69 "no-func-assign": 2,
70 "no-invalid-regexp": 2,
71 "no-irregular-whitespace": 2,
72 "no-negated-in-lhs": 2,
73 "no-obj-calls": 2,
74 "no-regex-spaces": 2,
75 "no-sparse-arrays": 2,
76 "no-unexpected-multiline": 2,
77 "no-unreachable": 2,
78 "no-underscore-dangle": 0,
79 "quotes": [2, "single"],
80 "semi": [2, "always"],
81 "space-after-keywords": [2, "always"],
82 "space-before-blocks": [2, "always"],
83 "space-before-function-parentheses": [0, "never"],
84 "space-in-brackets": [0, "never"],
85 "space-in-parens": [2, "never"],
86 "space-return-throw-case": 1,
87 "space-unary-ops": [1, { "words": true, "nonwords": false }],
88 "strict": [2, "never"],
89 "use-isnan": 2,
90
91 // style
92 "curly": 2,
93 "dot-location": [2, 'property'],
94 "dot-notation": 2,
95 "eqeqeq": 2,
96 "no-alert": 2,
97 "no-else-return": 2,
98 "no-eval": 2,
99 "no-extra-bind": 2,
100 "no-fallthrough": 2,
101 "no-floating-decimal": 2,
102 "no-implied-eval": 2,
103 "no-iterator": 2,
104 "no-labels": 2,
105 "no-lone-blocks": 2,
106 "no-loop-func": 2,
107 "no-multi-spaces": 2,
108 "no-multi-str": 2,
109 "no-native-reassign": 2,
110 "no-new-func": 2,
111 "no-new-wrappers": 2,
112 "no-new": 2,
113 "no-octal-escape": 2,
114 "no-octal": 2,
115 "no-proto": 2,
116 "no-redeclare": 2,
117 "no-return-assign": 2,
118 "no-self-compare": 2,
119 "no-sequences": 2,
120 "no-throw-literal": 1,
121 "no-unused-expressions": 2,
122 "no-useless-call": 2,
123 "no-useless-concat": 2,
124 "no-void": 2,
125 "no-warning-comments": [1, { "terms": ["todo", "fixme", "xxx"], "location": "start" }],
126 "no-with": 2,
127 "yoda": 2,
128 "no-delete-var": 2,
129 "no-shadow-restricted-names": 2,
130 "no-shadow": [0, { "hoist": "never" }],
131 "no-undef-init": 2,
132 "no-undef": 2,
133 "no-unused-vars": 2,
134 "callback-return": 2,
135
136 // es6-specific
137 "prefer-template": 1,
138 "no-var": 1,
139 "constructor-super": 2,
140 "prefer-const": 1,
141 "prefer-spread": 2,
142 "no-dupe-class-members": 2,
143 // commented out; there's a bug where `async` functions throw an error here.
144 //"generator-star-spacing": [0, { "before": true, "after": false }],
145 }
146}