Skip to content

Commit

Permalink
fix(eslint-no-floating-promises): added no-floating-promises rule (#1488
Browse files Browse the repository at this point in the history
)

Co-authored-by: Haddas Bronfman <[email protected]>
  • Loading branch information
samimusallam and haddasbronfman authored May 9, 2023
1 parent 1f6299d commit 4eb405e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
{
files: ['*.ts'],
rules: {
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/naming-convention": [
"error",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,18 @@ export class GraphQLInstrumentation extends InstrumentationBase {
}

if (isPromise(result)) {
(result as Promise<graphqlTypes.ExecutionResult>).then(resultData => {
if (typeof config.responseHook !== 'function') {
endSpan(span);
return;
(result as Promise<graphqlTypes.ExecutionResult>).then(
resultData => {
if (typeof config.responseHook !== 'function') {
endSpan(span);
return;
}
this._executeResponseHook(span, resultData);
},
error => {
endSpan(span, error);
}
this._executeResponseHook(span, resultData);
});
);
} else {
if (typeof config.responseHook !== 'function') {
endSpan(span);
Expand Down

0 comments on commit 4eb405e

Please sign in to comment.