|
| 1 | +/** |
| 2 | + * Copyright (c) 2015-present, Facebook, Inc. |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * This source code is licensed under the BSD-style license found in the |
| 6 | + * LICENSE file in the root directory of this source tree. An additional grant |
| 7 | + * of patent rights can be found in the PATENTS file in the same directory. |
| 8 | + */ |
| 9 | +'use strict'; |
| 10 | +module.exports = { |
| 11 | + root: true, |
| 12 | + |
| 13 | + parser: 'babel-eslint', |
| 14 | + |
| 15 | + plugins: ['import', 'flowtype', 'react'], |
| 16 | + |
| 17 | + env: { |
| 18 | + commonjs: true, |
| 19 | + es6: true, |
| 20 | + jest: true, |
| 21 | + node: true, |
| 22 | + }, |
| 23 | + |
| 24 | + globals: { |
| 25 | + document: true, |
| 26 | + window: true, |
| 27 | + console: true, |
| 28 | + navigator: true, |
| 29 | + fetch: true |
| 30 | + }, |
| 31 | + |
| 32 | + parserOptions: { |
| 33 | + ecmaVersion: 6, |
| 34 | + sourceType: 'module', |
| 35 | + ecmaFeatures: { |
| 36 | + jsx: true, |
| 37 | + generators: true, |
| 38 | + experimentalObjectRestSpread: true, |
| 39 | + }, |
| 40 | + }, |
| 41 | + |
| 42 | + settings: { |
| 43 | + 'import/ignore': ['node_modules'], |
| 44 | + 'import/extensions': ['.js'], |
| 45 | + 'import/resolver': { |
| 46 | + node: { |
| 47 | + extensions: ['.js', '.json'], |
| 48 | + }, |
| 49 | + }, |
| 50 | + }, |
| 51 | + |
| 52 | + rules: { |
| 53 | + 'array-callback-return': 'warn', |
| 54 | + 'default-case': ['warn', { commentPattern: '^no default$' }], |
| 55 | + 'dot-location': ['warn', 'property'], |
| 56 | + eqeqeq: ['warn', 'allow-null'], |
| 57 | + 'new-parens': 'warn', |
| 58 | + 'no-array-constructor': 'warn', |
| 59 | + 'no-caller': 'warn', |
| 60 | + 'no-cond-assign': ['warn', 'always'], |
| 61 | + 'no-const-assign': 'warn', |
| 62 | + 'no-control-regex': 'warn', |
| 63 | + 'no-delete-var': 'warn', |
| 64 | + 'no-dupe-args': 'warn', |
| 65 | + 'no-dupe-class-members': 'warn', |
| 66 | + 'no-dupe-keys': 'warn', |
| 67 | + 'no-duplicate-case': 'warn', |
| 68 | + 'no-empty-character-class': 'warn', |
| 69 | + 'no-empty-pattern': 'warn', |
| 70 | + 'no-eval': 'warn', |
| 71 | + 'no-ex-assign': 'warn', |
| 72 | + 'no-extend-native': 'warn', |
| 73 | + 'no-extra-bind': 'warn', |
| 74 | + 'no-extra-label': 'warn', |
| 75 | + 'no-fallthrough': 'warn', |
| 76 | + 'no-func-assign': 'warn', |
| 77 | + 'no-implied-eval': 'warn', |
| 78 | + 'no-invalid-regexp': 'warn', |
| 79 | + 'no-iterator': 'warn', |
| 80 | + 'no-label-var': 'warn', |
| 81 | + 'no-labels': ['warn', { allowLoop: true, allowSwitch: false }], |
| 82 | + 'no-lone-blocks': 'warn', |
| 83 | + 'no-loop-func': 'warn', |
| 84 | + 'no-mixed-operators': [ |
| 85 | + 'warn', |
| 86 | + { |
| 87 | + groups: [ |
| 88 | + ['&', '|', '^', '~', '<<', '>>', '>>>'], |
| 89 | + ['==', '!=', '===', '!==', '>', '>=', '<', '<='], |
| 90 | + ['&&', '||'], |
| 91 | + ['in', 'instanceof'], |
| 92 | + ], |
| 93 | + allowSamePrecedence: false, |
| 94 | + }, |
| 95 | + ], |
| 96 | + 'no-multi-str': 'warn', |
| 97 | + 'no-native-reassign': 'warn', |
| 98 | + 'no-negated-in-lhs': 'warn', |
| 99 | + 'no-new-func': 'warn', |
| 100 | + 'no-new-object': 'warn', |
| 101 | + 'no-new-symbol': 'warn', |
| 102 | + 'no-new-wrappers': 'warn', |
| 103 | + 'no-obj-calls': 'warn', |
| 104 | + 'no-octal': 'warn', |
| 105 | + 'no-octal-escape': 'warn', |
| 106 | + 'no-redeclare': 'warn', |
| 107 | + 'no-regex-spaces': 'warn', |
| 108 | + 'no-restricted-syntax': ['warn', 'WithStatement'], |
| 109 | + 'no-script-url': 'warn', |
| 110 | + 'no-self-assign': 'warn', |
| 111 | + 'no-self-compare': 'warn', |
| 112 | + 'no-sequences': 'warn', |
| 113 | + 'no-shadow-restricted-names': 'warn', |
| 114 | + 'no-sparse-arrays': 'warn', |
| 115 | + 'no-template-curly-in-string': 'warn', |
| 116 | + 'no-this-before-super': 'warn', |
| 117 | + 'no-throw-literal': 'warn', |
| 118 | + 'no-undef': 'error', |
| 119 | + 'no-restricted-globals': ['error', 'event'], |
| 120 | + 'no-unexpected-multiline': 'warn', |
| 121 | + 'no-unreachable': 'warn', |
| 122 | + 'no-unused-expressions': [ |
| 123 | + 'warn', |
| 124 | + { |
| 125 | + allowShortCircuit: true, |
| 126 | + allowTernary: true, |
| 127 | + }, |
| 128 | + ], |
| 129 | + 'no-unused-labels': 'warn', |
| 130 | + 'no-unused-vars': [ |
| 131 | + 'warn', |
| 132 | + { |
| 133 | + vars: 'local', |
| 134 | + varsIgnorePattern: '^_', |
| 135 | + args: 'none', |
| 136 | + ignoreRestSiblings: true, |
| 137 | + }, |
| 138 | + ], |
| 139 | + 'no-use-before-define': ['warn', 'nofunc'], |
| 140 | + 'no-useless-computed-key': 'warn', |
| 141 | + 'no-useless-concat': 'warn', |
| 142 | + 'no-useless-constructor': 'warn', |
| 143 | + 'no-useless-escape': 'warn', |
| 144 | + 'no-useless-rename': [ |
| 145 | + 'warn', |
| 146 | + { |
| 147 | + ignoreDestructuring: false, |
| 148 | + ignoreImport: false, |
| 149 | + ignoreExport: false, |
| 150 | + }, |
| 151 | + ], |
| 152 | + 'no-with': 'warn', |
| 153 | + 'no-whitespace-before-property': 'warn', |
| 154 | + 'operator-assignment': ['warn', 'always'], |
| 155 | + radix: 'warn', |
| 156 | + 'require-yield': 'warn', |
| 157 | + 'rest-spread-spacing': ['warn', 'never'], |
| 158 | + strict: ['warn', 'never'], |
| 159 | + 'unicode-bom': ['warn', 'never'], |
| 160 | + 'use-isnan': 'warn', |
| 161 | + 'valid-typeof': 'warn', |
| 162 | + 'no-restricted-properties': [ |
| 163 | + 'error', |
| 164 | + { |
| 165 | + object: 'require', |
| 166 | + property: 'ensure', |
| 167 | + message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import', |
| 168 | + }, |
| 169 | + { |
| 170 | + object: 'System', |
| 171 | + property: 'import', |
| 172 | + message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import', |
| 173 | + }, |
| 174 | + ], |
| 175 | + 'import/no-webpack-loader-syntax': 'error', |
| 176 | + 'react/jsx-equals-spacing': ['warn', 'never'], |
| 177 | + 'react/jsx-no-duplicate-props': ['warn', { ignoreCase: true }], |
| 178 | + 'react/jsx-no-undef': 'error', |
| 179 | + 'react/jsx-pascal-case': [ |
| 180 | + 'warn', |
| 181 | + { |
| 182 | + allowAllCaps: true, |
| 183 | + ignore: [], |
| 184 | + }, |
| 185 | + ], |
| 186 | + 'react/jsx-uses-react': 'warn', |
| 187 | + 'react/jsx-uses-vars': 'warn', |
| 188 | + 'react/no-danger-with-children': 'warn', |
| 189 | + 'react/no-deprecated': 'warn', |
| 190 | + 'react/no-direct-mutation-state': 'warn', |
| 191 | + 'react/no-is-mounted': 'warn', |
| 192 | + 'react/react-in-jsx-scope': 'error', |
| 193 | + 'react/require-render-return': 'warn', |
| 194 | + 'react/style-prop-object': 'warn', |
| 195 | + 'flowtype/define-flow-type': 'warn', |
| 196 | + 'flowtype/require-valid-file-annotation': 'warn', |
| 197 | + 'flowtype/use-flow-type': 'warn', |
| 198 | + }, |
| 199 | +}; |
0 commit comments