Skip to content

no-useless-use-spring

errorSuggestion

Reports spring hook calls whose config is static and whose dependencies never update.

By default, this rule checks useSpring. It reports calls where the config object is fully static and the dependency array is missing, omitted, or static. Empty dependency arrays are also reported by default.

Calls with both from and to in the config are skipped, because they can still represent a one-time mount animation.

Option Type Default What it does
springHooks string[] ["useSpring"] Hook names treated as spring hooks
staticGlobalFactories string[] Roblox value constructors such as Vector3, UDim2, Color3, and CFrame Names treated as static constructors
treatEmptyDepsAsViolation boolean true Reports [] when the config is static
Incorrect
const spring = useSpring({ opacity: 1 });
const DEFAULT_SCALE = 1.5;
const scale = useSpring({ scale: DEFAULT_SCALE }, [DEFAULT_SCALE]);
Correct
const spring = useSpring({ opacity: isOpen ? 1 : 0 }, [isOpen]);
const intro = useSpring({
from: { scale: 0 },
to: { scale: 1 },
}, []);