Added few eslint rules checking promises

Summary:
Added rules to ensure we properly propagate errors from promises.

Also found and fixed a place where promise function parameter was mismatched.

Reviewed By: mweststrate

Differential Revision: D28537820

fbshipit-source-id: b93f44274fc76544049813f645508cb78e432880
This commit is contained in:
Anton Nikolaev
2021-05-19 09:29:41 -07:00
committed by Facebook GitHub Bot
parent c897d92df8
commit 3f55ceac8f
4 changed files with 19 additions and 2 deletions

View File

@@ -43,6 +43,7 @@ module.exports = {
'node',
'react-hooks',
'flipper',
'promise',
],
rules: {
// disable rules from eslint-config-fbjs
@@ -96,6 +97,14 @@ module.exports = {
'flipper/no-relative-imports-across-packages': [2],
'flipper/no-electron-remote-imports': [1],
'flipper/no-console-error-without-context': [1],
// promise rules, see https://github.com/xjamundx/eslint-plugin-promise for details on each of them
'promise/catch-or-return': 'warn',
'promise/no-nesting': 'warn',
'promise/no-promise-in-callback': 'warn',
'promise/no-callback-in-promise': 'warn',
'promise/no-return-in-finally': 'warn',
'promise/valid-params': 'error',
},
settings: {
'import/resolver': {