logoESLint React
Rules

no-flush-sync

Disallows 'flushSync'.

Full Name in eslint-plugin-react-dom

react-dom/no-flush-sync

Full Name in @eslint-react/eslint-plugin

@eslint-react/dom-no-flush-sync

Presets

dom recommended recommended-typescript recommended-type-checked strict strict-typescript strict-type-checked

Rule Details

flushSync can significantly hurt performance and may unexpectedly force pending Suspense boundaries to show their fallback state.

Most of the time, flushSync can be avoided, so use flushSync as a last resort.

Common Violations

Invalid

import { flushSync } from "react-dom";

flushSync(() => {
  setSomething(123);
});

Resources

Further Reading


See Also

On this page