react-doctor/no-document-start-view-transition
Render a <ViewTransition> component and update inside startTransition / useDeferredValue — React calls startViewTransition for you
- Category: Correctness
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: always
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Confirm a direct document.startViewTransition(...) MemberExpression call. False positive: imperative callers outside React (a vanilla DOM helper, a non-React micro-frontend, or a script tag) where the <ViewTransition> component is not in scope and React is not orchestrating the update.
Fix prompt
Use this once validation confirms the diagnostic is real.
Wrap the DOM-mutating state update in startTransition (or useDeferredValue / Suspense) and render a <ViewTransition> boundary around the affected subtree — React's integration calls document.startViewTransition for you and assigns matching viewTransitionName values, so manual calls fight the auto-generated names. See https://react.dev/reference/react/ViewTransition
Related rules
More Correctness rules from the rules reference:
react-doctor/no-find-dom-node: Use refs (useRef/createRef) to access DOM nodes instead of the removed findDOMNode API.react-doctor/no-jsx-element-type: Widen the return type from JSX.Element to React.ReactNode: function App(): React.ReactNodereact-doctor/no-legacy-class-lifecycles: Move side effects in `componentWillMount` to `componentDidMount`; replace `componentWillReceiveProps` with `componentDidUpdate` (compare prevProps) or the static `getDerivedStateFromProps` for pure state derivation; replace `componentWillUpdate` with `getSnapshotBeforeUpdate` paired with `componentDidUpdate`. The `UNSAFE_` prefix only silences the warning — React 19 removes both forms.react-doctor/no-legacy-context-api: Replace `childContextTypes` + `getChildContext` with `const MyContext = createContext(...)` + `<MyContext.Provider value={...}>`; replace `contextTypes` with `static contextType = MyContext` (single context) or `useContext()` / `use()` from a function component. The provider and every consumer must migrate together — partial migrations leave consumers reading the wrong context.react-doctor/no-namespace: Drop the namespace and use a plain (Pascal-cased) component or DOM tag.