|
11 | 11 | },
|
12 | 12 |
|
13 | 13 | "plugins": [
|
14 |
| - "react" |
| 14 | + "react", |
| 15 | + "prettier", |
15 | 16 | ],
|
16 | 17 |
|
17 | 18 | // Map from global var to bool specifying if it can be redefined
|
18 | 19 | "globals": {
|
19 |
| - "__BUNDLE_START_TIME__": false, |
20 | 20 | "__DEV__": true,
|
21 | 21 | "__dirname": false,
|
22 |
| - "__filename": false, |
23 | 22 | "__fbBatchedBridgeConfig": false,
|
24 | 23 | "alert": false,
|
25 | 24 | "cancelAnimationFrame": false,
|
| 25 | + "cancelIdleCallback": false, |
26 | 26 | "clearImmediate": true,
|
27 | 27 | "clearInterval": false,
|
28 | 28 | "clearTimeout": false,
|
29 | 29 | "console": false,
|
30 | 30 | "document": false,
|
31 | 31 | "escape": false,
|
| 32 | + "Event": false, |
| 33 | + "EventTarget": false, |
32 | 34 | "exports": false,
|
| 35 | + "fetch": false, |
| 36 | + "FormData": false, |
33 | 37 | "global": false,
|
34 | 38 | "jest": false,
|
35 |
| - "pit": false, |
36 | 39 | "Map": true,
|
37 | 40 | "module": false,
|
38 | 41 | "navigator": false,
|
39 | 42 | "process": false,
|
40 |
| - "Promise": false, |
| 43 | + "Promise": true, |
41 | 44 | "requestAnimationFrame": true,
|
| 45 | + "requestIdleCallback": true, |
42 | 46 | "require": false,
|
43 | 47 | "Set": true,
|
44 | 48 | "setImmediate": true,
|
45 | 49 | "setInterval": false,
|
46 | 50 | "setTimeout": false,
|
47 | 51 | "window": false,
|
48 |
| - "FormData": true, |
49 | 52 | "XMLHttpRequest": false,
|
| 53 | + "pit": false, |
50 | 54 |
|
51 |
| - // Flow "known-globals" annotations: |
52 |
| - "ReactElement": false, |
| 55 | + // Flow global types. |
| 56 | + "ReactComponent": false, |
53 | 57 | "ReactClass": false,
|
54 |
| - "Class": false |
| 58 | + "ReactElement": false, |
| 59 | + "ReactPropsCheckType": false, |
| 60 | + "ReactPropsChainableTypeChecker": false, |
| 61 | + "ReactPropTypes": false, |
| 62 | + "SyntheticEvent": false, |
| 63 | + "$Either": false, |
| 64 | + "$All": false, |
| 65 | + "$ArrayBufferView": false, |
| 66 | + "$Tuple": false, |
| 67 | + "$Supertype": false, |
| 68 | + "$Subtype": false, |
| 69 | + "$Shape": false, |
| 70 | + "$Diff": false, |
| 71 | + "$Keys": false, |
| 72 | + "$Enum": false, |
| 73 | + "$Exports": false, |
| 74 | + "$FlowIssue": false, |
| 75 | + "$FlowFixMe": false, |
| 76 | + "$FixMe": false |
55 | 77 | },
|
56 | 78 |
|
57 | 79 | "rules": {
|
58 |
| - "comma-dangle": 0, // disallow trailing commas in object literals |
| 80 | + "comma-dangle": 0, // disallow trailing commas in object literals |
59 | 81 | "no-cond-assign": 1, // disallow assignment in conditional expressions
|
60 | 82 | "no-console": 0, // disallow use of console (off by default in the node environment)
|
| 83 | + "no-const-assign": 2, // disallow assignment to const-declared variables |
61 | 84 | "no-constant-condition": 0, // disallow use of constant expressions in conditions
|
62 | 85 | "no-control-regex": 1, // disallow control characters in regular expressions
|
63 | 86 | "no-debugger": 1, // disallow use of debugger
|
64 |
| - "no-dupe-keys": 2, // disallow duplicate keys when creating object literals |
| 87 | + "no-dupe-keys": 1, // disallow duplicate keys when creating object literals |
65 | 88 | "no-empty": 0, // disallow empty statements
|
66 |
| - "no-empty-character-class": 1, // disallow the use of empty character classes in regular expressions |
67 | 89 | "no-ex-assign": 1, // disallow assigning to the exception in a catch block
|
68 | 90 | "no-extra-boolean-cast": 1, // disallow double-negation boolean casts in a boolean context
|
69 | 91 | "no-extra-parens": 0, // disallow unnecessary parentheses (off by default)
|
70 | 92 | "no-extra-semi": 1, // disallow unnecessary semicolons
|
71 |
| - "no-func-assign": 0, // disallow overwriting functions written as function declarations |
| 93 | + "no-func-assign": 1, // disallow overwriting functions written as function declarations |
72 | 94 | "no-inner-declarations": 0, // disallow function or variable declarations in nested blocks
|
73 | 95 | "no-invalid-regexp": 1, // disallow invalid regular expression strings in the RegExp constructor
|
74 | 96 | "no-negated-in-lhs": 1, // disallow negation of the left operand of an in expression
|
75 | 97 | "no-obj-calls": 1, // disallow the use of object properties of the global object (Math and JSON) as functions
|
76 | 98 | "no-regex-spaces": 1, // disallow multiple spaces in a regular expression literal
|
77 | 99 | "no-reserved-keys": 0, // disallow reserved words being used as object literal keys (off by default)
|
78 | 100 | "no-sparse-arrays": 1, // disallow sparse arrays
|
79 |
| - "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement |
| 101 | + "no-unreachable": 1, // disallow unreachable statements after a return, throw, continue, or break statement |
80 | 102 | "use-isnan": 1, // disallow comparisons with the value NaN
|
81 | 103 | "valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default)
|
82 | 104 | "valid-typeof": 1, // Ensure that the results of typeof are compared against a valid string
|
|
89 | 111 | "consistent-return": 0, // require return statements to either always or never specify values
|
90 | 112 | "curly": 1, // specify curly brace conventions for all control statements
|
91 | 113 | "default-case": 0, // require default case in switch statements (off by default)
|
92 |
| - "dot-notation": 0, // encourages use of dot notation whenever possible |
93 |
| - "eqeqeq": 1, // require the use of === and !== |
| 114 | + "dot-notation": 1, // encourages use of dot notation whenever possible |
| 115 | + "eqeqeq": [1, "allow-null"], // require the use of === and !== |
94 | 116 | "guard-for-in": 0, // make sure for-in loops have an if statement (off by default)
|
95 |
| - "no-alert": 0, // disallow the use of alert, confirm, and prompt |
| 117 | + "no-alert": 1, // disallow the use of alert, confirm, and prompt |
96 | 118 | "no-caller": 1, // disallow use of arguments.caller or arguments.callee
|
97 | 119 | "no-div-regex": 1, // disallow division operators explicitly at beginning of regular expression (off by default)
|
98 | 120 | "no-else-return": 0, // disallow else after a return in an if (off by default)
|
|
130 | 152 | "wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default)
|
131 | 153 | "yoda": 1, // require or disallow Yoda conditions
|
132 | 154 |
|
133 |
| - // Strict Mode |
134 |
| - // These rules relate to using strict mode. |
135 |
| - |
136 |
| - // "strict": [2, "global"], // require or disallow the "use strict" pragma in the global scope (off by default in the node environment) |
137 |
| - |
138 | 155 | // Variables
|
139 | 156 | // These rules have to do with variable declarations.
|
140 | 157 |
|
|
143 | 160 | "no-label-var": 1, // disallow labels that share a name with a variable
|
144 | 161 | "no-shadow": 1, // disallow declaration of variables already declared in the outer scope
|
145 | 162 | "no-shadow-restricted-names": 1, // disallow shadowing of names such as arguments
|
146 |
| - "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block. |
| 163 | + "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block |
147 | 164 | "no-undefined": 0, // disallow use of undefined variable (off by default)
|
148 | 165 | "no-undef-init": 1, // disallow use of undefined when initializing variables
|
149 | 166 | "no-unused-vars": [1, {"vars": "all", "args": "none"}], // disallow declaration of variables that are not used in the code
|
|
164 | 181 | // These rules are purely matters of style and are quite subjective.
|
165 | 182 |
|
166 | 183 | "key-spacing": 0,
|
| 184 | + "keyword-spacing": 1, // enforce spacing before and after keywords |
| 185 | + "jsx-quotes": [1, "prefer-double"], |
167 | 186 | "comma-spacing": 0,
|
168 | 187 | "no-multi-spaces": 0,
|
169 | 188 | "brace-style": 0, // enforce one true brace style (off by default)
|
170 | 189 | "camelcase": 0, // require camel case names
|
171 |
| - "consistent-this": 1, // enforces consistent naming when capturing the current execution context (off by default) |
| 190 | + "consistent-this": [1, "self"], // enforces consistent naming when capturing the current execution context (off by default) |
172 | 191 | "eol-last": 1, // enforce newline at the end of file, with no multiple empty lines
|
173 | 192 | "func-names": 0, // require function expressions to have a name (off by default)
|
174 | 193 | "func-style": 0, // enforces use of function declarations or expressions (off by default)
|
|
183 | 202 | "no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
|
184 | 203 | "no-underscore-dangle": 0, // disallow dangling underscores in identifiers
|
185 | 204 | "no-mixed-spaces-and-tabs": 1, // disallow mixed spaces and tabs for indentation
|
186 |
| - "quotes": [1, "single", "avoid-escape"], // specify whether double or single quotes should be used |
| 205 | + "quotes": [1, "double", "avoid-escape"], // specify whether double or single quotes should be used |
187 | 206 | "quote-props": 0, // require quotes around object literal property names (off by default)
|
188 | 207 | "semi": 1, // require or disallow use of semicolons instead of ASI
|
189 | 208 | "sort-vars": 0, // sort variables within the same declaration block (off by default)
|
190 |
| - "keyword-spacing": [1, { "before": true, "after": true }], // require a space after certain keywords (off by default) |
191 | 209 | "space-in-brackets": 0, // require or disallow spaces inside brackets (off by default)
|
192 | 210 | "space-in-parens": 0, // require or disallow spaces inside parentheses (off by default)
|
193 | 211 | "space-infix-ops": 1, // require spaces around operators
|
|
206 | 224 | "no-bitwise": 1, // disallow use of bitwise operators (off by default)
|
207 | 225 | "no-plusplus": 0, // disallow use of unary operators, ++ and -- (off by default)
|
208 | 226 |
|
| 227 | + // React Plugin |
| 228 | + // The following rules are made available via `eslint-plugin-react`. |
| 229 | + |
209 | 230 | "react/display-name": 0,
|
210 | 231 | "react/jsx-boolean-value": 0,
|
211 |
| - "jsx-quotes": [1, "prefer-double"], |
| 232 | + "react/jsx-no-duplicate-props": 2, |
| 233 | + "react/jsx-no-undef": 1, |
212 | 234 | "react/jsx-sort-props": 0,
|
213 | 235 | "react/jsx-uses-react": 1,
|
214 | 236 | "react/jsx-uses-vars": 1,
|
215 |
| - "react/no-did-mount-set-state": [1, "allow-in-func"], |
216 |
| - "react/no-did-update-set-state": [1, "allow-in-func"], |
| 237 | + "react/no-did-mount-set-state": 1, |
| 238 | + "react/no-did-update-set-state": 1, |
217 | 239 | "react/no-multi-comp": 0,
|
| 240 | + "react/no-string-refs": 1, |
218 | 241 | "react/no-unknown-property": 0,
|
219 | 242 | "react/prop-types": 0,
|
220 |
| - "react/react-in-jsx-scope": 0, |
| 243 | + "react/react-in-jsx-scope": 1, |
221 | 244 | "react/self-closing-comp": 1,
|
222 | 245 | "react/wrap-multilines": 0,
|
223 |
| - "react/jsx-no-undef": 2 |
| 246 | + |
| 247 | + // Prettier Plugin |
| 248 | + // The following rules are made available via `eslint-plugin-prettier`. |
| 249 | + "prettier/prettier": "error", |
224 | 250 | }
|
225 | 251 | }
|
0 commit comments