Skip to content

Commit e8803e0

Browse files
committed
Update eslintrc
1 parent 06ec2f5 commit e8803e0

File tree

1 file changed

+46
-19
lines changed

1 file changed

+46
-19
lines changed

.eslintrc

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
11
{
22
"parser": "babel-eslint",
3+
"extends": [
4+
"plugin:flowtype/recommended",
5+
"plugin:react/recommended"
6+
],
37
"plugins": [
48
"babel",
59
"flowtype",
610
"react"
711
],
812
"env": {
9-
"browser": true,
1013
"node": true
1114
},
1215
"globals": {
13-
"Map": false
16+
"Map": false,
17+
"Set": false,
18+
"Promise": false
1419
},
1520
"rules": {
21+
// flowtype rules
22+
"flowtype/delimiter-dangle": [1, "always-multiline"],
23+
"flowtype/no-dupe-keys": 2,
24+
"flowtype/object-type-delimiter": [1, "semicolon"],
25+
// "flowtype/require-valid-file-annotation": [1, "always"],
26+
"flowtype/semi": 1,
27+
"flowtype/type-id-match": [1, "^[A-Z]"],
28+
// generic rules
1629
"no-cond-assign": 1, // disallow assignment in conditional expressions
17-
"no-console": 0, // disallow use of console: should use nuclide-logging instead
30+
"no-console": 1, // disallow use of console
1831
"no-constant-condition": 1, // disallow use of constant expressions in conditions
19-
"comma-dangle": [ // disallow trailing commas in object and array literals
20-
1, "always-multiline"
21-
],
32+
"comma-dangle": [1, {
33+
"arrays": "always-multiline",
34+
"objects": "always-multiline",
35+
"imports": "always-multiline",
36+
"exports": "always-multiline",
37+
"functions": "always-multiline"
38+
}],
2239
"no-control-regex": 1, // disallow control characters in regular expressions
2340
"no-debugger": 1, // disallow use of debugger
2441
"no-dupe-keys": 1, // disallow duplicate keys when creating object literals
@@ -116,15 +133,21 @@
116133
// React (eslint-plugin-react)
117134

118135
"jsx-quotes": [1, "prefer-double"], // <Foo bar="x" /> not <Foo bar='x' />
136+
"react/jsx-closing-bracket-location": [
137+
1
138+
],
139+
// Disable to not interfere with Prettier
140+
"react/jsx-indent": 0,
141+
"react/jsx-tag-spacing": [ // <Foo bar="x" /> not <Foo bar="x"/>
142+
1,
143+
{
144+
"beforeSelfClosing": "always",
145+
},
146+
],
147+
"react/jsx-equals-spacing": 1, // <Foo bar="x" /> not <Foo bar = "x" />
119148
"react/jsx-curly-spacing": [ // Enforce or disallow spaces inside of curly braces in JSX attributes
120149
1, "never"
121150
],
122-
"react/jsx-no-undef": 1, // Disallow undeclared variables in JSX
123-
"react/jsx-uses-react": 1, // Prevent React to be incorrectly marked as unused
124-
"react/jsx-uses-vars": 1, // Prevent variables used in JSX to be incorrectly marked as unused
125-
"react/no-unknown-property": 1, // Prevent usage of unknown DOM property
126-
"react/prop-types": 1, // Prevent missing props validation in a React component definition
127-
"react/react-in-jsx-scope": 2, // Prevent missing React when using JSX
128151

129152
// Stylistic (these rules are purely matters of style and are quite subjective)
130153

@@ -154,21 +177,25 @@
154177
"no-ternary": 0, // disallow the use of ternary operators
155178
"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
156179
"no-underscore-dangle": 0, // disallow dangling underscores in identifiers
157-
"no-extra-parens": [1, "functions"], // disallow wrapping of non-IIFE statements in parens
180+
// Disable to not interfere with Prettier
181+
// "no-extra-parens": [1, "functions"], // disallow wrapping of non-IIFE statements in parens
158182
"no-mixed-spaces-and-tabs": 1, // disallow mixed spaces and tabs for indentation
159-
"indent": [1, 2, {"SwitchCase": 1}], // indentation should be two spaces
183+
// Disable to not interfere with Prettier
184+
"indent": 0,
160185
"quotes": [ // enforce single quotes, allow double to avoid escaping ("don't escape" instead of 'don\'t escape')
161-
1, "single", "avoid-escape"
186+
1, "single", {"avoidEscape": true, "allowTemplateLiterals": true}
162187
],
163188
"quote-props": [1, "as-needed"], // require quotes around object literal property names
164189
"semi": 1, // require or disallow use of semicolons instead of ASI
165190
"sort-vars": 0, // sort variables within the same declaration block
166191
"keyword-spacing": 1, // require a space around certain keywords
167192
"space-before-blocks": 1, // require a space before blocks
168-
"space-before-function-paren": [ // disallow a space before function parenthesis
169-
1, "never"
170-
],
171-
"object-curly-spacing": [ // disallow spaces inside of curly braces in object literals
193+
"space-before-function-paren": [1, {
194+
"anonymous": "never",
195+
"named": "never",
196+
"asyncArrow": "always"
197+
}],
198+
"babel/object-curly-spacing": [ // disallow spaces inside of curly braces in object literals
172199
1, "never"
173200
],
174201
"array-bracket-spacing": [ // disallow spaces inside of curly braces in array literals

0 commit comments

Comments
 (0)