You can probably ignore the rule. A (very) quick search revealed the GitHub PR where this rule was added, and it is only intended for use in React components (emphasis mine):
It’s only meant for React components. Not sure if there’s a way to
make it more specific…