| 1 | 'use strict'; |
| 2 | |
| 3 | module.exports = { |
| 4 | env: { |
| 5 | commonjs: true, |
| 6 | browser: true, |
| 7 | }, |
| 8 | globals: { |
| 9 | // ES6 |
| 10 | BigInt: 'readonly', |
| 11 | Map: 'readonly', |
| 12 | Set: 'readonly', |
| 13 | Symbol: 'readonly', |
| 14 | Proxy: 'readonly', |
| 15 | WeakMap: 'readonly', |
| 16 | WeakSet: 'readonly', |
| 17 | WeakRef: 'readonly', |
| 18 | |
| 19 | Int8Array: 'readonly', |
| 20 | Uint8Array: 'readonly', |
| 21 | Uint8ClampedArray: 'readonly', |
| 22 | Int16Array: 'readonly', |
| 23 | Uint16Array: 'readonly', |
| 24 | Int32Array: 'readonly', |
| 25 | Uint32Array: 'readonly', |
| 26 | Float32Array: 'readonly', |
| 27 | Float64Array: 'readonly', |
| 28 | BigInt64Array: 'readonly', |
| 29 | BigUint64Array: 'readonly', |
| 30 | DataView: 'readonly', |
| 31 | ArrayBuffer: 'readonly', |
| 32 | |
| 33 | Reflect: 'readonly', |
| 34 | globalThis: 'readonly', |
| 35 | |
| 36 | FinalizationRegistry: 'readonly', |
| 37 | |
| 38 | ScrollTimeline: 'readonly', |
| 39 | navigation: 'readonly', |
| 40 | |
| 41 | // Vendor specific |
| 42 | MSApp: 'readonly', |
| 43 | __REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly', |
| 44 | // FB |
| 45 | __DEV__: 'readonly', |
| 46 | // Node.js Server Rendering |
| 47 | process: 'readonly', |
| 48 | setImmediate: 'readonly', |
| 49 | Buffer: 'readonly', |
| 50 | // Trusted Types |
| 51 | trustedTypes: 'readonly', |
| 52 | |
| 53 | // Scheduler profiling |
| 54 | TaskController: 'readonly', |
| 55 | reportError: 'readonly', |
| 56 | AggregateError: 'readonly', |
| 57 | |
| 58 | // Flight |
| 59 | Promise: 'readonly', |
| 60 | |
| 61 | // Temp |
| 62 | AsyncLocalStorage: 'readonly', |
| 63 | async_hooks: 'readonly', |
| 64 | |
| 65 | // jest |
| 66 | jest: 'readonly', |
| 67 | |
| 68 | // act |
| 69 | IS_REACT_ACT_ENVIRONMENT: 'readonly', |
| 70 | }, |
| 71 | parserOptions: { |
| 72 | ecmaVersion: 5, |
| 73 | sourceType: 'script', |
| 74 | }, |
| 75 | rules: { |
| 76 | 'no-undef': 'error', |
| 77 | 'no-shadow-restricted-names': 'error', |
| 78 | 'no-restricted-syntax': [ |
| 79 | 'error', |
| 80 | // TODO: Can be removed once we upgrade GCC to a version without `optimizeArgumentsArray` optimization. |
| 81 | { |
| 82 | selector: 'Identifier[name=/^JSCompiler_OptimizeArgumentsArray_/]', |
| 83 | message: |
| 84 | 'Google Closure Compiler optimized `arguments` access. ' + |
| 85 | 'This affects function arity. ' + |
| 86 | 'Create a reference to `arguments` to avoid this optimization', |
| 87 | }, |
| 88 | ], |
| 89 | }, |
| 90 | |
| 91 | // These plugins aren't used, but eslint complains if an eslint-ignore comment |
| 92 | // references unused plugins. An alternate approach could be to strip |
| 93 | // eslint-ignore comments as part of the build. |
| 94 | plugins: ['ft-flow', 'jest', 'no-for-of-loops', 'react', 'react-internal'], |
| 95 | }; |