Origin-aware scale
A menu that scales in should grow out of the button that opened it. Without a transform origin it grows from its own center, detached from where you clicked.
12345{ "rules": { "systomic/origin-aware-scale": "error" }}See the difference
className="data-[state=open]:zoom-in-95"className="origin-(--radix-…-transform-origin) data-[state=open]:zoom-in-95"What doesn't work
Oxlint
1 finding123456789import { DropdownMenu } from "radix-ui";
export function Menu() { return ( <DropdownMenu.Root> <DropdownMenu.Content className="data-[state=open]:animate-in data-[state=open]:zoom-in-95" /> </DropdownMenu.Root> );}systomic/origin-aware-scale <DropdownMenu.Content> scales from its center, away from the trigger. Set the transform origin to var(--radix-dropdown-menu-content-transform-origin) (origin-(--radix-dropdown-menu-content-transform-origin)).
Stylelint
1 finding123456.menu[data-side] { transition: transform 150ms;}.menu[data-state="closed"] { transform: scale(0.95);}systomic/origin-aware-scale .menu is a positioned overlay that scales from its center, away from the trigger. Set transform-origin to the trigger side (Radix --radix-…-transform-origin, Base UI --transform-origin).
What works
No findingsOxlint
1234567891011import { DropdownMenu } from "radix-ui";
export function Menu() { return ( <DropdownMenu.Root> <DropdownMenu.Content className="origin-(--radix-dropdown-menu-content-transform-origin) data-[state=open]:animate-in data-[state=open]:zoom-in-95" /> {/* A button scaling itself is not an overlay. */} <button className="transition-transform active:scale-95" /> </DropdownMenu.Root> );}Stylelint
1234567.menu[data-side] { transform-origin: var(--radix-dropdown-menu-content-transform-origin); transition: transform 150ms;}.menu[data-state="closed"] { transform: scale(0.95);}Details
A positioned overlay that scales in should grow out of its trigger, not out of its own center. The rule reports scale animations on overlays that don’t set transform-origin.
12<DropdownMenu.Content className="data-[state=open]:zoom-in-95" />// add origin-(--radix-dropdown-menu-content-transform-origin)Only positioned overlays are checked, so scaling elsewhere doesn’t fire (icon swaps in an icon button, active:scale-95, hover scale on cards, scaling children inside a menu). An element is a positioned overlay when:
- its name matches
overlayPattern(DropdownMenu.Content,PopoverContent,Popover.Popup,Menu.Positioner,Select.Content,Tooltip.Content,HoverCard.Content, …) or is listed inoverlays, - it has
role="menu","listbox"or"tooltip", or - it uses
data-[side=…]variants (set by Floating UI based libraries).
Dialogs, sheets and drawers are not overlays here: they are centered or slide in, so the default origin is right.
<Content asChild><motion.div /></Content> and Base UI’s render={<motion.div />} are checked as one element, since their props end up on the same DOM node.
What counts as scaling:
- Tailwind:
zoom-in-*/zoom-out-*, orscale-*with a variant (data-[state=open]:,data-[starting-style]:,starting:) or next to atransition/animate-*class. - Motion:
scale,scaleX,scaleYininitial,animate,exit,while*orvariants. - Inline styles / StyleX:
scale, ortransform: scale(…)with conditional values or atransition, and StyleXkeyframeswith scale.
What counts as an origin: origin-* classes, transformOrigin (inline, StyleX, Motion style) and Motion’s originX / originY. With requireVariable: true, only a CSS variable counts (the trigger-aware origin of the library), so origin-top is reported too.
For Radix and Base UI imports, the message names the right variable and offers a quick-fix that adds the class.
| Option | Default |
|---|---|
overlayPattern |
Radix / Base UI / shadcn overlay content names |
overlays |
[]: extra overlay component names |
roles |
["menu", "listbox", "tooltip"] |
requireVariable |
false |
Stylelint
For .css / .scss files (see Stylelint): A class with an overlay selector ([data-side], [role=menu|listbox|tooltip], popper wrappers) or @apply data-[side=…] that scales (state rule with transform: scale(), a transition, @keyframes with scale, zoom-*) without transform-origin. Option requireVariable as in Oxlint.
See Styling for how classes, inline styles, StyleX and stylesheets are read.