mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Stacked on #33160. By default, if `onDefaultTransitionIndicator` is not overridden, this will trigger a fake Navigation event using the Navigation API. This is intercepted to create an on-going navigation until we complete the Transition. Basically each default Transition is simulated as a Navigation. This triggers the native browser loading state (in Chrome at least). So now by default the browser spinner spins during a Transition if no other loading state is provided. Firefox and Safari hasn't shipped Navigation API yet and even in the flag Safari has, it doesn't actually trigger the native loading state. To ensures that you can still use other Navigations concurrently, we don't start our fake Navigation if there's one on-going already. Similarly if our fake Navigation gets interrupted by another. We wait for on-going ones to finish and then start a new fake one if we're supposed to be still pending. There might be other routers on the page that might listen to intercept Navigation Events. Typically you'd expect them not to trigger a refetch when navigating to the same state. However, if they want to detect this we provide the `"react-transition"` string in the `info` field for this purpose.
97 lines
2.4 KiB
JavaScript
97 lines
2.4 KiB
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
env: {
|
|
commonjs: true,
|
|
browser: true,
|
|
},
|
|
globals: {
|
|
// ES6
|
|
BigInt: 'readonly',
|
|
Map: 'readonly',
|
|
Set: 'readonly',
|
|
Symbol: 'readonly',
|
|
Proxy: 'readonly',
|
|
WeakMap: 'readonly',
|
|
WeakSet: 'readonly',
|
|
|
|
Int8Array: 'readonly',
|
|
Uint8Array: 'readonly',
|
|
Uint8ClampedArray: 'readonly',
|
|
Int16Array: 'readonly',
|
|
Uint16Array: 'readonly',
|
|
Int32Array: 'readonly',
|
|
Uint32Array: 'readonly',
|
|
Float32Array: 'readonly',
|
|
Float64Array: 'readonly',
|
|
BigInt64Array: 'readonly',
|
|
BigUint64Array: 'readonly',
|
|
DataView: 'readonly',
|
|
ArrayBuffer: 'readonly',
|
|
|
|
Reflect: 'readonly',
|
|
globalThis: 'readonly',
|
|
|
|
FinalizationRegistry: 'readonly',
|
|
|
|
ScrollTimeline: 'readonly',
|
|
navigation: 'readonly',
|
|
|
|
// Vendor specific
|
|
MSApp: 'readonly',
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly',
|
|
// FB
|
|
__DEV__: 'readonly',
|
|
// Fabric. See https://github.com/facebook/react/pull/15490
|
|
// for more information
|
|
nativeFabricUIManager: 'readonly',
|
|
// RN flag to enable microtasks
|
|
RN$enableMicrotasksInReact: 'readonly',
|
|
// Trusted Types
|
|
trustedTypes: 'readonly',
|
|
// RN supports this
|
|
setImmediate: 'readonly',
|
|
// Scheduler profiling
|
|
TaskController: 'readonly',
|
|
reportError: 'readonly',
|
|
AggregateError: 'readonly',
|
|
|
|
// Node Feature Detection
|
|
process: 'readonly',
|
|
|
|
// Temp
|
|
AsyncLocalStorage: 'readonly',
|
|
async_hooks: 'readonly',
|
|
|
|
// jest
|
|
jest: 'readonly',
|
|
|
|
// act
|
|
IS_REACT_ACT_ENVIRONMENT: 'readonly',
|
|
},
|
|
parserOptions: {
|
|
ecmaVersion: 5,
|
|
sourceType: 'script',
|
|
},
|
|
rules: {
|
|
'no-undef': 'error',
|
|
'no-shadow-restricted-names': 'error',
|
|
'no-restricted-syntax': [
|
|
'error',
|
|
// TODO: Can be removed once we upgrade GCC to a version without `optimizeArgumentsArray` optimization.
|
|
{
|
|
selector: 'Identifier[name=/^JSCompiler_OptimizeArgumentsArray_/]',
|
|
message:
|
|
'Google Closure Compiler optimized `arguments` access. ' +
|
|
'This affects function arity. ' +
|
|
'Create a reference to `arguments` to avoid this optimization',
|
|
},
|
|
],
|
|
},
|
|
|
|
// These plugins aren't used, but eslint complains if an eslint-ignore comment
|
|
// references unused plugins. An alternate approach could be to strip
|
|
// eslint-ignore comments as part of the build.
|
|
plugins: ['ft-flow', 'jest', 'no-for-of-loops', 'react', 'react-internal'],
|
|
};
|