molindo / eslint-config-molindo

ESLint config that implements the Molindo styleguide and helps to catch errors.
MIT License
1 stars 2 forks source link

Relax `@typescript-eslint/no-misused-promises` #86

Closed amannn closed 10 months ago

amannn commented 2 years ago

The scenario here is that a promise-returning function is assigned to an event handler of a React component. There could have been an argument that you'd want to avoid this, since when state is set asynchronously, React could print the "Can not set state in an unmounted component" warning. However, this warning is gone in React 18.

I'd change the configuration of our rule to allow this particular case:

"@typescript-eslint/no-misused-promises": ["error", {"checksVoidReturn": {"attributes": false}}],

The option "attributes" refers to props of JSX elements here.

https://typescript-eslint.io/rules/no-misused-promises/