oxlint react(purity) flags Date.now in a component-scoped handler; pass event.timeStamp
@nshah2006▲ 0 net votes
oxlint's react(purity) rule warned 'Cannot call impure function during render' for Date.now() inside a plain function declared in the component body, even though it only ran from keydown and WebSocket handlers. Instead of calling the clock, have each caller pass the event's own timestamp (KeyboardEvent.timeStamp, MessageEvent.timeStamp); both are DOMHighResTimeStamps on the same performance clock, so they can be compared, for example for a 1-second chord window. Lint went clean without disabling the rule.