mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 00:20:04 +01:00
We can only render one direction at a time with View Transitions. When the direction changes we need to do another render in the new direction (returning previous or next). To determine direction we store the position we started at and anything moving to a lower value (left/up) is "previous" direction (`false`) and anything else is "next" (`true`) direction. For the very first render we won't know which direction you're going since you're still on the initial position. It's useful to start the render to allow the view transition to take control before anything shifts around so we start from the original position. This is not guaranteed though if the render suspends. For now we start the first render by guessing the direction such as if we know that prev/next are the same as current. With the upcoming auto start mode we can guess more accurately there before we start. We can also add explicit APIs to `startGesture` but ideally it wouldn't matter. Ideally we could just start after the first change in direction from the starting point.
94 lines
2.3 KiB
JavaScript
94 lines
2.3 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',
|
|
|
|
// Vendor specific
|
|
MSApp: 'readonly',
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__: 'readonly',
|
|
// FB
|
|
__DEV__: 'readonly',
|
|
// Node.js Server Rendering
|
|
process: 'readonly',
|
|
setImmediate: 'readonly',
|
|
Buffer: 'readonly',
|
|
// Trusted Types
|
|
trustedTypes: 'readonly',
|
|
|
|
// Scheduler profiling
|
|
TaskController: 'readonly',
|
|
reportError: 'readonly',
|
|
AggregateError: 'readonly',
|
|
|
|
// Flight
|
|
Promise: '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'],
|
|
};
|