Is there an eslint rule to enforce types for useState()?

Viewed 187

I would like to make sure that all our team members properly type their hooks.

const [users, setUsers] = useState<User>([]); // --> should work
const [users, setUsers] = useState([]); // --> should throw a linting error

So far I couldn't find such a rule. How could I do it myself if there is no existing plugin?

1 Answers
Related