-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc
225 lines (213 loc) · 10.7 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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
env:
browser: true
node: true
mocha: true
plugins:
- react # https://github.com/yannickcr/eslint-plugin-react
ecmaFeatures:
arrowFunctions: true # enable arrow functions
binaryLiterals: true # enable binary literals
blockBindings: true # enable let and const (aka block bindings)
classes: true # enable classes
defaultParams: true # enable default function parameters
destructuring: true # enable destructuring
forOf: true # enable for-of loops
generators: false # enable generators
globalReturn: false # allow return statements in the global scope
jsx: true # enable JSX
modules: true # enable modules and global strict mode
objectLiteralComputedProperties: false # enable computed object literal property names
objectLiteralDuplicateProperties: false # enable duplicate object literal properties in strict mode
objectLiteralShorthandMethods: true # enable object literal shorthand methods
objectLiteralShorthandProperties: true # enable object literal shorthand properties
octalLiterals: true # enable octal literals
regexUFlag: true # enable the regular expression u flag
regexYFlag: true # enable the regular expression y flag
restParams: true # enable the rest parameters
spread: true # enable the spread operator
superInFunctions: true # enable super references inside of functions
templateStrings: true # enable template strings
unicodeCodePointEscapes: false # enable code point escapes
# http://eslint.org/docs/user-guide/configuring#configuring-rules
# 0 - turn the rule off
# 1 - turn the rule on as a warning (doesn't affect exit code)
# 2 - turn the rule on as an error (exit code is 1 when triggered)
rules:
# http://eslint.org/docs/rules/#possible-errors
comma-dangle: # disallow or enforce trailing commas
- 0
- "always-multiline"
no-reserved-keys: 0 # disallow reserved words being used as object literal keys (off by default)
# http://eslint.org/docs/rules/#best-practices
accessor-pairs: 2 # Enforces getter/setter pairs in objects (off by default)
block-scoped-var: 2 # treat var statements as if they were block scoped (off by default)
complexity: 2 # specify the maximum cyclomatic complexity allowed in a program (off by default)
consistent-return: 2 # require return statements to either always or never specify values
curly: # specify curly brace conventions for all control statements
- 2
- "multi-line"
default-case: 1 # require default case in switch statements (off by default)
dot-notation: # encourages use of dot notation whenever possible
- 2
-
allowKeywords: true
dot-location: # enforces consistent newlines before or after dots (off by default)
- 2
- "property"
eqeqeq: 1 # require the use of === and !==
no-alert: 2 # disallow the use of alert, confirm, and prompt
no-caller: 2 # disallow use of arguments.caller or arguments.callee
no-div-regex: 2 # disallow division operators explicitly at beginning of regular expression (off by default)
no-else-return: 0 # disallow else after a return in an if (off by default)
no-empty-label: 2 # disallow use of labels for anything other than loops and switches
no-eq-null: 2 # disallow comparisons to null without a type-checking operator (off by default)
no-eval: 2 # disallow use of eval()
no-extend-native: 2 # disallow adding to native types
no-extra-bind: 2 # disallow unnecessary function binding
no-fallthrough: 2 # disallow fallthrough of case statements
no-floating-decimal: 2 # disallow the use of leading or trailing decimal points in numeric literals (off by default)
no-implied-eval: 2 # disallow use of eval()-like methods
no-iterator: 2 # disallow usage of __iterator__ property
no-labels: 2 # disallow use of labeled statements
no-lone-blocks: 2 # disallow unnecessary nested blocks
no-loop-func: 2 # disallow creation of functions within loops
no-multi-spaces: 2 # disallow use of multiple spaces
no-multi-str: 2 # disallow use of multiline strings
no-native-reassign: 2 # disallow reassignments of native objects
no-new-func: 2 # disallow use of new operator for Function object
no-new-wrappers: 2 # disallows creating new instances of String,Number, and Boolean
no-new: 2 # disallow use of new operator when not part of the assignment or comparison
no-octal-escape: 2 # disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
no-octal: 2 # disallow use of octal literals
no-param-reassign: 2 # disallow reassignment of function parameters (off by default)
no-process-env: 2 # disallow use of process.env (off by default)
no-proto: 2 # disallow usage of __proto__ property
no-redeclare: 2 # disallow declaring the same variable more than once
no-return-assign: 2 # disallow use of assignment in return statement
no-script-url: 2 # disallow use of javascript: urls.
no-self-compare: 2 # disallow comparisons where both sides are exactly the same (off by default)
no-sequences: 2 # disallow use of comma operator
no-throw-literal: 2 # restrict what can be thrown as an exception (off by default)
no-unused-expressions: 2 # disallow usage of expressions in statement position
no-void: 2 # disallow use of void operator (off by default)
# disallow usage of configurable warning terms in comments e.g. TODO or FIXME (off by default)
no-warning-comments: [1, { "terms": ["fixme", "hack", "xxx"], "location": "start" }]
no-with: 2 # disallow use of the with statement
radix: 2 # require use of the second argument for parseInt() (off by default)
wrap-iife: 2 # require immediate function invocation to be wrapped in parentheses (off by default)
yoda: 2 # require or disallow Yoda conditions
# http://eslint.org/docs/rules/#strict-mode
strict: 0
# http://eslint.org/docs/rules/#variables
no-shadow: 1 # disallow use of undefined variable (off by default)
no-unused-vars: # disallow use of undefined variable (off by default)
- 1
-
args: none
# http://eslint.org/docs/rules/#stylistic-issues
comma-style: # enforce one true comma style (off by default)
- 2
- "last"
computed-property-spacing: # require or disallow padding inside computed properties (off by default)
- 2
- "never"
consistent-this: 0 # enforces consistent naming when capturing the current execution context (off by default)
key-spacing: # enforces spacing between keys and values in object literal properties
- 2
-
beforeColon: false
afterColon: true
indent: # this option sets a specific tab width for your code (off by default)
- 2
- 2
linebreak-style: 2 # disallow mixed 'LF' and 'CRLF' as linebreaks (off by default)
max-nested-callbacks: # specify the maximum depth callbacks can be nested (off by default)
- 2
- 3
new-cap: # require a capital letter for constructors
- 2
-
capIsNew: false
no-continue: 2 # disallow use of the continue statement (off by default)
no-lonely-if: 2 # disallow if as the only statement in an else block (off by default)
no-multiple-empty-lines: 2 # disallow multiple empty lines (off by default)
no-nested-ternary: 1 # disallow nested ternary expressions (off by default)
no-underscore-dangle: 0 # disallow dangling underscores in identifiers
no-unneeded-ternary: 2 # disallow the use of Boolean literals in conditional expressions (off by default)
operator-linebreak: # enforce operators to be placed before or after line breaks (off by default)
- 1
- "after"
quotes: # require quotes around object literal property names (off by default)
- 0
- "double"
- "avoid-escape"
quote-props: # require quotes around object literal property names (off by default)
- 0 # our legacy APIs return values like 'start_date' and we prefer to quote them to maintain symbol casing
- "as-needed"
semi-spacing: # enforce spacing before and after semicolons
- 2
-
before: false
after: true
semi: # require or disallow use of semicolons instead of ASI
- 2
- "always"
sort-vars: 1 # sort variables within the same declaration block (off by default)
space-after-keywords: 2 # require a space after certain keywords (off by default)
space-before-blocks: 2 # require or disallow space before blocks (off by default)
space-before-function-paren: # require or disallow space before function opening parenthesis (off by default)
- 2
- "never"
space-infix-ops: 2 # require spaces around operators
spaced-comment: 0 # require or disallow a space immediately following the # or /* in a comment (off by default)
# http://eslint.org/docs/rules/#legacy
max-len: # specify the maximum length of a line in your program (off by default)
- 1
- 120
no-bitwise: 2 # disallow use of bitwise operators (off by default)
no-plusplus: 2 # disallow use of unary operators, ++ and -- (off by default)
# https://github.com/yannickcr/eslint-plugin-react
react/display-name: 0 # Prevent missing displayName in a React component definition
react/jsx-boolean-value: 2 # Enforce boolean attributes notation in JSX
react/jsx-no-undef: 2 # Disallow undeclared variables in JSX
react/jsx-quotes: # Enforce quote style for JSX attributes
- 2
- "double"
react/jsx-sort-prop-types: 0 # Enforce propTypes declarations alphabetical sorting
react/jsx-sort-props: 0 # Enforce props alphabetical sorting
react/jsx-uses-react: 2 # Prevent React to be incorrectly marked as unused
react/jsx-uses-vars: 2 # Prevent variables used in JSX to be incorrectly marked as unused
react/no-did-mount-set-state: 0 # Prevent usage of setState in componentDidMount
react/no-did-update-set-state: 0 # Prevent usage of setState in componentDidUpdate
react/no-multi-comp: 0 # Prevent multiple component definition per file
react/no-unknown-property: 2 # Prevent usage of unknown DOM property
react/prop-types: 2 # Prevent missing props validation in a React component definition
react/react-in-jsx-scope: 2 # Prevent missing React when using JSX
react/require-extension: 0 # Restrict file extensions that may be required
react/self-closing-comp: 2 # Prevent extra closing tags for components without children
react/sort-comp: 1 # Enforce component methods order
- 1
-
order:
- "displayName"
- "propTypes"
- "contextTypes"
- "childContextTypes"
- "mixins"
- "statics"
- "defaultProps"
- "getDefaultProps"
- "getInitialState"
- "getChildContext"
- "componentWillMount"
- "componentDidMount"
- "componentWillReceiveProps"
- "shouldComponentUpdate"
- "componentWillUpdate"
- "componentDidUpdate"
- "componentWillUnmount"
- "/^on.+$/"
- "/^get.+$/"
- "/^render.+$/"
- "render"
react/wrap-multilines: 2 # Prevent missing parentheses around multilines JSX