-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
191 lines (140 loc) · 5.36 KB
/
index.js
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
module.exports = {
"parser": "babel-eslint",
"extends": ["eslint:recommended", "airbnb"],
"plugins": [
"react",
"mocha"
],
"rules": {
// Single quotes instead of double quotes
"quotes": ["error", "single", { "allowTemplateLiterals": true }],
// Allow leading underscores for "private" methods
"no-underscore-dangle": "off",
// Don't require source files to include "use strict"
// as babel enforces that automatically
"strict": ["error", "never"],
// JSX syntax masks the need for the `React` import, but
// it is still needed. Essentially, in a JSX file we should
// never mark it as not needed.
"react/jsx-uses-react": "warn",
// Destructuring siblings are okay
"no-unused-vars": ["error", { "ignoreRestSiblings": true }],
// {bar: baz} bad; { bar: baz } good
"object-curly-spacing": ["error", "always"],
// Place spaces after keywords
"keyword-spacing": "error",
// React components should have double quotes:
// `<Bar baz="foo" />`
"jsx-quotes": ["error", "prefer-double"],
// Unreachable code is an error
"no-unreachable": "error",
// blocks must at least have a comment, except `catch(e) { }`
"no-empty": ["error", { "allowEmptyCatch": true }],
// Ensure JSX variables are marks as used
"react/jsx-uses-vars": "error",
// statements must end with a semicolon
"semi": "error",
// `a+b` bad; `a + b` good
"space-infix-ops": "error",
// `var a = 1` bad; `var a = 1` good
"no-multi-spaces": "error",
// all files should end with a newline
"eol-last": "error",
// One true brace style:
//
// if (bloop) {
// bloop();
// } else {
// bleep();
// }
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
// 2 spaces
"indent": ["error", 2, { "SwitchCase": 1 }],
// Intentional overrides to airbnb's configs
// Don't require function brackets: `const foo = (a) => true;` is okay
"arrow-body-style": "off",
// Don't require parameter parens: `const foo = a => true;` is okay
"arrow-parens": "off",
// Don't allow trailing commas: `{ a: 1, b: 2, };`
"comma-dangle": ["error", "never"] ,
// Anonymous functions are okay
"func-names": "off",
// Allow <label /> tags to not have an `htmlFor=` prop (use <label /> as a
// parent element instead)
"jsx-a11y/label-has-for": "off",
// No blacklisted object / attribute names
"no-restricted-properties": "off",
// `a && b()` is okay; `a ? b() : c()` is okay
"no-unused-expressions": ["error", {
"allowShortCircuit": true,
"allowTernary": true
}],
// `function foo () {}` bad; `function foo() {}` good
"space-before-function-paren": ["error", "never"],
// allow importing without a file extension
"import/extensions": "off",
// Allow statements to precede `import`
"import/first": "off",
// Allow NODE_PATH to do its thing
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
// Allow default import to be declared over a named export
"import/no-named-as-default": "off",
// Allow lookup of named export on a default export
"import/no-named-as-default-member": "off",
// Allow default export to be named
"import/no-named-default": "off",
// Allow for a single named export
"import/prefer-default-export": "off",
// Allow generic propTypes (any, array, object)
"react/forbid-prop-types": "off",
// <Foo
// bloop
// message="Get it bloopin" />
//
"react/jsx-closing-bracket-location": ["error", "after-props"],
// First prop on a new-line if the component takes multiple lines
"react/jsx-first-prop-new-line": ["error", "multiline"],
// This rule was busted with how we prefer to format ternary expressions in
// jsx
"react/jsx-indent": "off",
// Allow classes for stateless functions
"react/prefer-stateless-function": "off",
// Sort-order for react class properties / methods
"react/sort-comp": [2, {
"order": [
"type-annotations",
"static-methods",
"lifecycle",
"everything-else",
"render"
]
}],
// Allow multiple components per file
"react/no-multi-comp": "off",
// Allow `>`, `"`, `'`, `}` and friends in JSX copy
"react/no-unescaped-entities": "off",
// Allow member functions to not access `this`
"class-methods-use-this": "off",
// `<Foo ref={x => this.x = x} />` is okay
"no-return-assign": "off",
// Allow `style=""` prop to be any type
"react/style-prop-object": "off",
// `bloop.select('.bleep').map(a => a.bork)` is okay
"newline-per-chained-call": "off",
// <div onClick={onClick} /> is okay
"jsx-a11y/no-static-element-interactions": "off",
// <div onClick={onClick.bind(this, 2)} /> is okay
"react/jsx-no-bind": "off",
// Man line length is 120
"max-len": ["error", 120],
// Components may define propTypes that aren't used themselves (may pass)
// props as proxy to a child.
"react/no-unused-prop-types": "off",
// Mocha functions should use function expressions, not arrow functions
"mocha/no-mocha-arrows": "error",
// Disallow exclusive tests
"mocha/no-exclusive-tests": "error",
// Either function expressions or arrow callbacks can be used
"prefer-arrow-callback": "off"
}
};