| 1 | 'use strict'; |
| 2 | |
| 3 | module.exports = { |
| 4 | env: { |
| 5 | commonjs: true, |
| 6 | browser: true, |
| 7 | }, |
| 8 | globals: { |
| 9 | // ES 6 |
| 10 | BigInt: 'readonly', |
| 11 | Map: 'readonly', |
| 12 | Set: 'readonly', |
| 13 | Proxy: 'readonly', |
| 14 | Symbol: '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 | // CommonJS / Node |
| 45 | process: 'readonly', |
| 46 | setImmediate: 'readonly', |
| 47 | Buffer: 'readonly', |
| 48 | // Trusted Types |
| 49 | trustedTypes: 'readonly', |
| 50 | |
| 51 | // Scheduler profiling |
| 52 | TaskController: 'readonly', |
| 53 | reportError: 'readonly', |
| 54 | AggregateError: 'readonly', |
| 55 | |
| 56 | // Flight |
| 57 | Promise: 'readonly', |
| 58 | |
| 59 | // Temp |
| 60 | AsyncLocalStorage: 'readonly', |
| 61 | async_hooks: 'readonly', |
| 62 | |
| 63 | // Flight Webpack |
| 64 | __webpack_chunk_load__: 'readonly', |
| 65 | __webpack_get_script_filename__: 'readonly', |
| 66 | __webpack_require__: 'readonly', |
| 67 | |
| 68 | // Flight Turbopack |
| 69 | __turbopack_load_by_url__: 'readonly', |
| 70 | __turbopack_require__: 'readonly', |
| 71 | |
| 72 | // Flight Parcel |
| 73 | parcelRequire: 'readonly', |
| 74 | |
| 75 | // jest |
| 76 | expect: 'readonly', |
| 77 | jest: 'readonly', |
| 78 | |
| 79 | // act |
| 80 | IS_REACT_ACT_ENVIRONMENT: 'readonly', |
| 81 | |
| 82 | Bun: 'readonly', |
| 83 | }, |
| 84 | parserOptions: { |
| 85 | ecmaVersion: 2020, |
| 86 | sourceType: 'module', |
| 87 | }, |
| 88 | rules: { |
| 89 | 'no-undef': 'error', |
| 90 | 'no-shadow-restricted-names': 'error', |
| 91 | 'no-restricted-syntax': [ |
| 92 | 'error', |
| 93 | // TODO: Can be removed once we upgrade GCC to a version without `optimizeArgumentsArray` optimization. |
| 94 | { |
| 95 | selector: 'Identifier[name=/^JSCompiler_OptimizeArgumentsArray_/]', |
| 96 | message: |
| 97 | 'Google Closure Compiler optimized `arguments` access. ' + |
| 98 | 'This affects function arity. ' + |
| 99 | 'Create a reference to `arguments` to avoid this optimization', |
| 100 | }, |
| 101 | ], |
| 102 | }, |
| 103 | |
| 104 | // These plugins aren't used, but eslint complains if an eslint-ignore comment |
| 105 | // references unused plugins. An alternate approach could be to strip |
| 106 | // eslint-ignore comments as part of the build. |
| 107 | plugins: ['ft-flow', 'jest', 'no-for-of-loops', 'react', 'react-internal'], |
| 108 | }; |