|
1 | 1 | {
|
2 | 2 | "parser": "babel-eslint",
|
| 3 | + "extends": [ |
| 4 | + "plugin:flowtype/recommended", |
| 5 | + "plugin:react/recommended" |
| 6 | + ], |
3 | 7 | "plugins": [
|
4 | 8 | "babel",
|
5 | 9 | "flowtype",
|
6 | 10 | "react"
|
7 | 11 | ],
|
8 | 12 | "env": {
|
9 |
| - "browser": true, |
10 | 13 | "node": true
|
11 | 14 | },
|
12 | 15 | "globals": {
|
13 |
| - "Map": false |
| 16 | + "Map": false, |
| 17 | + "Set": false, |
| 18 | + "Promise": false |
14 | 19 | },
|
15 | 20 | "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 |
16 | 29 | "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 |
18 | 31 | "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 | + }], |
22 | 39 | "no-control-regex": 1, // disallow control characters in regular expressions
|
23 | 40 | "no-debugger": 1, // disallow use of debugger
|
24 | 41 | "no-dupe-keys": 1, // disallow duplicate keys when creating object literals
|
|
116 | 133 | // React (eslint-plugin-react)
|
117 | 134 |
|
118 | 135 | "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" /> |
119 | 148 | "react/jsx-curly-spacing": [ // Enforce or disallow spaces inside of curly braces in JSX attributes
|
120 | 149 | 1, "never"
|
121 | 150 | ],
|
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 |
128 | 151 |
|
129 | 152 | // Stylistic (these rules are purely matters of style and are quite subjective)
|
130 | 153 |
|
|
154 | 177 | "no-ternary": 0, // disallow the use of ternary operators
|
155 | 178 | "no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
|
156 | 179 | "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 |
158 | 182 | "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, |
160 | 185 | "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} |
162 | 187 | ],
|
163 | 188 | "quote-props": [1, "as-needed"], // require quotes around object literal property names
|
164 | 189 | "semi": 1, // require or disallow use of semicolons instead of ASI
|
165 | 190 | "sort-vars": 0, // sort variables within the same declaration block
|
166 | 191 | "keyword-spacing": 1, // require a space around certain keywords
|
167 | 192 | "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 |
172 | 199 | 1, "never"
|
173 | 200 | ],
|
174 | 201 | "array-bracket-spacing": [ // disallow spaces inside of curly braces in array literals
|
|
0 commit comments