News for hackers. Stuff that matters.
Re:Hooks Considered Harmful by bilalq on Monday March 21, 2022 @03:16PM (#30758461)
>> failing to catch errors and handle rejected promises, etc.

> This is an issue and has led to bugs.

> Pretty much anything where there's some implicit details that the compiler or linters can't reason about programmers find a way to get wrong. One thing I like about the hooks linter setup is that what it encourages you to do by default will prevent most bugs, only lead to potential performance issues, unnecessary rerenders, unnecessary refetches.

This is something that can be mitigated via the no-floating-promises linter rule if you're using TypeScript[0]. For the cases where you actually want to just swallow errors, you can just add a `.catch(noop)`. This makes such situations explicit. You can get even stricter with the no-misued-promises rule[1].

[0]: https://github.com/typescript-eslint/typescript-eslint/blob/...

[1]: https://github.com/typescript-eslint/typescript-eslint/blob/...

Re:Hooks Considered Harmful by silverhydradev on Monday March 21, 2022 @10:42PM (#30762212)
Thanks for those references, I've recently been handed an overwhelmingly "JavaScript" project and this'll be a great way to expose some overlooked code paths.