diff --git a/.eslintrc.js b/.eslintrc.js index 414adb07f9..0bc90137a5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,11 +26,8 @@ module.exports = { parser: 'babel-eslint', parserOptions: { - ecmaVersion: 8, + ecmaVersion: 9, sourceType: 'script', - ecmaFeatures: { - experimentalObjectRestSpread: true, - }, }, // We're stricter than the default config, mostly. We'll override a few rules @@ -248,36 +245,36 @@ module.exports = { 'packages/react-server-native-relay/**/*.js', ], globals: { - nativeFabricUIManager: true, + nativeFabricUIManager: 'readonly', }, }, { files: ['packages/react-server-dom-webpack/**/*.js'], globals: { - __webpack_chunk_load__: true, - __webpack_require__: true, + __webpack_chunk_load__: 'readonly', + __webpack_require__: 'readonly', }, }, { files: ['packages/scheduler/**/*.js'], globals: { - TaskController: true, + TaskController: 'readonly', }, }, ], globals: { - spyOnDev: true, - spyOnDevAndProd: true, - spyOnProd: true, - __EXPERIMENTAL__: true, - __EXTENSION__: true, - __PROFILE__: true, - __TEST__: true, - __UMD__: true, - __VARIANT__: true, - gate: true, - trustedTypes: true, - IS_REACT_ACT_ENVIRONMENT: true, + spyOnDev: 'readonly', + spyOnDevAndProd: 'readonly', + spyOnProd: 'readonly', + __EXPERIMENTAL__: 'readonly', + __EXTENSION__: 'readonly', + __PROFILE__: 'readonly', + __TEST__: 'readonly', + __UMD__: 'readonly', + __VARIANT__: 'readonly', + gate: 'readonly', + trustedTypes: 'readonly', + IS_REACT_ACT_ENVIRONMENT: 'readonly', }, }; diff --git a/scripts/rollup/validate/eslintrc.cjs.js b/scripts/rollup/validate/eslintrc.cjs.js index e75f5967ee..45b7a41e7e 100644 --- a/scripts/rollup/validate/eslintrc.cjs.js +++ b/scripts/rollup/validate/eslintrc.cjs.js @@ -7,45 +7,45 @@ module.exports = { }, globals: { // ES 6 - Map: true, - Set: true, - Proxy: true, - Symbol: true, - WeakMap: true, - WeakSet: true, - Uint16Array: true, - Reflect: true, - globalThis: true, + Map: 'readonly', + Set: 'readonly', + Proxy: 'readonly', + Symbol: 'readonly', + WeakMap: 'readonly', + WeakSet: 'readonly', + Uint16Array: 'readonly', + Reflect: 'readonly', + globalThis: 'readonly', // Vendor specific - MSApp: true, - __REACT_DEVTOOLS_GLOBAL_HOOK__: true, + MSApp: 'readonly', + __REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly', // CommonJS / Node - process: true, - setImmediate: true, - Buffer: true, + process: 'readonly', + setImmediate: 'readonly', + Buffer: 'readonly', // Trusted Types - trustedTypes: true, + trustedTypes: 'readonly', // Scheduler profiling - Int32Array: true, - ArrayBuffer: true, + Int32Array: 'readonly', + ArrayBuffer: 'readonly', - TaskController: true, + TaskController: 'readonly', // Flight - Uint8Array: true, - Promise: true, + Uint8Array: 'readonly', + Promise: 'readonly', // Flight Webpack - __webpack_chunk_load__: true, - __webpack_require__: true, + __webpack_chunk_load__: 'readonly', + __webpack_require__: 'readonly', // jest - expect: true, - jest: true, + expect: 'readonly', + jest: 'readonly', // act - IS_REACT_ACT_ENVIRONMENT: true, + IS_REACT_ACT_ENVIRONMENT: 'readonly', }, parserOptions: { ecmaVersion: 5, diff --git a/scripts/rollup/validate/eslintrc.cjs2015.js b/scripts/rollup/validate/eslintrc.cjs2015.js index 721dd9b026..7135a5a706 100644 --- a/scripts/rollup/validate/eslintrc.cjs2015.js +++ b/scripts/rollup/validate/eslintrc.cjs2015.js @@ -7,44 +7,44 @@ module.exports = { }, globals: { // ES 6 - Map: true, - Set: true, - Proxy: true, - Symbol: true, - WeakMap: true, - WeakSet: true, - Uint16Array: true, - Reflect: true, + Map: 'readonly', + Set: 'readonly', + Proxy: 'readonly', + Symbol: 'readonly', + WeakMap: 'readonly', + WeakSet: 'readonly', + Uint16Array: 'readonly', + Reflect: 'readonly', // Vendor specific - MSApp: true, - __REACT_DEVTOOLS_GLOBAL_HOOK__: true, + MSApp: 'readonly', + __REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly', // CommonJS / Node - process: true, - setImmediate: true, - Buffer: true, + process: 'readonly', + setImmediate: 'readonly', + Buffer: 'readonly', // Trusted Types - trustedTypes: true, + trustedTypes: 'readonly', // Scheduler profiling - Int32Array: true, - ArrayBuffer: true, + Int32Array: 'readonly', + ArrayBuffer: 'readonly', - TaskController: true, + TaskController: 'readonly', // Flight - Uint8Array: true, - Promise: true, + Uint8Array: 'readonly', + Promise: 'readonly', // Flight Webpack - __webpack_chunk_load__: true, - __webpack_require__: true, + __webpack_chunk_load__: 'readonly', + __webpack_require__: 'readonly', // jest - expect: true, - jest: true, + expect: 'readonly', + jest: 'readonly', // act - IS_REACT_ACT_ENVIRONMENT: true, + IS_REACT_ACT_ENVIRONMENT: 'readonly', }, parserOptions: { ecmaVersion: 2015, diff --git a/scripts/rollup/validate/eslintrc.esm.js b/scripts/rollup/validate/eslintrc.esm.js index bbc94a7f4e..34cde55547 100644 --- a/scripts/rollup/validate/eslintrc.esm.js +++ b/scripts/rollup/validate/eslintrc.esm.js @@ -7,44 +7,44 @@ module.exports = { }, globals: { // ES 6 - Map: true, - Set: true, - Proxy: true, - Symbol: true, - WeakMap: true, - WeakSet: true, - Uint16Array: true, - Reflect: true, + Map: 'readonly', + Set: 'readonly', + Proxy: 'readonly', + Symbol: 'readonly', + WeakMap: 'readonly', + WeakSet: 'readonly', + Uint16Array: 'readonly', + Reflect: 'readonly', // Vendor specific - MSApp: true, - __REACT_DEVTOOLS_GLOBAL_HOOK__: true, + MSApp: 'readonly', + __REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly', // CommonJS / Node - process: true, - setImmediate: true, - Buffer: true, + process: 'readonly', + setImmediate: 'readonly', + Buffer: 'readonly', // Trusted Types - trustedTypes: true, + trustedTypes: 'readonly', // Scheduler profiling - Int32Array: true, - ArrayBuffer: true, + Int32Array: 'readonly', + ArrayBuffer: 'readonly', - TaskController: true, + TaskController: 'readonly', // Flight - Uint8Array: true, - Promise: true, + Uint8Array: 'readonly', + Promise: 'readonly', // Flight Webpack - __webpack_chunk_load__: true, - __webpack_require__: true, + __webpack_chunk_load__: 'readonly', + __webpack_require__: 'readonly', // jest - expect: true, - jest: true, + expect: 'readonly', + jest: 'readonly', // act - IS_REACT_ACT_ENVIRONMENT: true, + IS_REACT_ACT_ENVIRONMENT: 'readonly', }, parserOptions: { ecmaVersion: 2017, diff --git a/scripts/rollup/validate/eslintrc.fb.js b/scripts/rollup/validate/eslintrc.fb.js index bd5881ca47..d267ca2bec 100644 --- a/scripts/rollup/validate/eslintrc.fb.js +++ b/scripts/rollup/validate/eslintrc.fb.js @@ -7,40 +7,40 @@ module.exports = { }, globals: { // ES6 - Map: true, - Set: true, - Symbol: true, - Proxy: true, - WeakMap: true, - WeakSet: true, - Uint16Array: true, - Reflect: true, + Map: 'readonly', + Set: 'readonly', + Symbol: 'readonly', + Proxy: 'readonly', + WeakMap: 'readonly', + WeakSet: 'readonly', + Uint16Array: 'readonly', + Reflect: 'readonly', // Vendor specific - MSApp: true, - __REACT_DEVTOOLS_GLOBAL_HOOK__: true, + MSApp: 'readonly', + __REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly', // FB - __DEV__: true, + __DEV__: 'readonly', // Node.js Server Rendering - setImmediate: true, - Buffer: true, + setImmediate: 'readonly', + Buffer: 'readonly', // Trusted Types - trustedTypes: true, + trustedTypes: 'readonly', // Scheduler profiling - Int32Array: true, - ArrayBuffer: true, + Int32Array: 'readonly', + ArrayBuffer: 'readonly', - TaskController: true, + TaskController: 'readonly', // Flight - Uint8Array: true, - Promise: true, + Uint8Array: 'readonly', + Promise: 'readonly', // jest - jest: true, + jest: 'readonly', // act - IS_REACT_ACT_ENVIRONMENT: true, + IS_REACT_ACT_ENVIRONMENT: 'readonly', }, parserOptions: { ecmaVersion: 5, diff --git a/scripts/rollup/validate/eslintrc.rn.js b/scripts/rollup/validate/eslintrc.rn.js index 0f2d7f808d..e466784e8f 100644 --- a/scripts/rollup/validate/eslintrc.rn.js +++ b/scripts/rollup/validate/eslintrc.rn.js @@ -7,36 +7,36 @@ module.exports = { }, globals: { // ES6 - Map: true, - Set: true, - Symbol: true, - Proxy: true, - WeakMap: true, - WeakSet: true, - Reflect: true, + Map: 'readonly', + Set: 'readonly', + Symbol: 'readonly', + Proxy: 'readonly', + WeakMap: 'readonly', + WeakSet: 'readonly', + Reflect: 'readonly', // Vendor specific - MSApp: true, - __REACT_DEVTOOLS_GLOBAL_HOOK__: true, + MSApp: 'readonly', + __REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly', // FB - __DEV__: true, + __DEV__: 'readonly', // Fabric. See https://github.com/facebook/react/pull/15490 // for more information - nativeFabricUIManager: true, + nativeFabricUIManager: 'readonly', // Trusted Types - trustedTypes: true, + trustedTypes: 'readonly', // RN supports this - setImmediate: true, + setImmediate: 'readonly', // Scheduler profiling - Int32Array: true, - ArrayBuffer: true, + Int32Array: 'readonly', + ArrayBuffer: 'readonly', - TaskController: true, + TaskController: 'readonly', // jest - jest: true, + jest: 'readonly', // act - IS_REACT_ACT_ENVIRONMENT: true, + IS_REACT_ACT_ENVIRONMENT: 'readonly', }, parserOptions: { ecmaVersion: 5, diff --git a/scripts/rollup/validate/eslintrc.umd.js b/scripts/rollup/validate/eslintrc.umd.js index 2077eec029..2d274375cc 100644 --- a/scripts/rollup/validate/eslintrc.umd.js +++ b/scripts/rollup/validate/eslintrc.umd.js @@ -6,50 +6,50 @@ module.exports = { }, globals: { // ES6 - Map: true, - Set: true, - Symbol: true, - Proxy: true, - WeakMap: true, - WeakSet: true, - Uint16Array: true, - Reflect: true, + Map: 'readonly', + Set: 'readonly', + Symbol: 'readonly', + Proxy: 'readonly', + WeakMap: 'readonly', + WeakSet: 'readonly', + Uint16Array: 'readonly', + Reflect: 'readonly', // Vendor specific - MSApp: true, - __REACT_DEVTOOLS_GLOBAL_HOOK__: true, + MSApp: 'readonly', + __REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly', // UMD wrapper code // TODO: this is too permissive. // Ideally we should only allow these *inside* the UMD wrapper. - exports: true, - module: true, - define: true, - require: true, - globalThis: true, - global: true, + exports: 'readonly', + module: 'readonly', + define: 'readonly', + require: 'readonly', + globalThis: 'readonly', + global: 'readonly', // Internet Explorer - setImmediate: true, + setImmediate: 'readonly', // Trusted Types - trustedTypes: true, + trustedTypes: 'readonly', // Scheduler profiling - Int32Array: true, - ArrayBuffer: true, + Int32Array: 'readonly', + ArrayBuffer: 'readonly', - TaskController: true, + TaskController: 'readonly', // Flight - Uint8Array: true, - Promise: true, + Uint8Array: 'readonly', + Promise: 'readonly', // Flight Webpack - __webpack_chunk_load__: true, - __webpack_require__: true, + __webpack_chunk_load__: 'readonly', + __webpack_require__: 'readonly', // jest - jest: true, + jest: 'readonly', // act - IS_REACT_ACT_ENVIRONMENT: true, + IS_REACT_ACT_ENVIRONMENT: 'readonly', }, parserOptions: { ecmaVersion: 5,