Skip to content

Commit 6f75e1a

Browse files
fix(no-floating-observables): handle sequence expression
1 parent 04f3baf commit 6f75e1a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/rules/no-floating-observables.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ export const noFloatingObservablesRule = ruleCreator({
7171

7272
checkNode(node.expression);
7373
},
74+
'ExpressionStatement > SequenceExpression': (node: es.SequenceExpression) => {
75+
node.expressions.forEach(expression => {
76+
if (isCallExpression(expression)) {
77+
checkNode(expression);
78+
}
79+
});
80+
},
7481
};
7582
},
7683
});

tests/rules/no-floating-observables.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,15 @@ ruleTester({ types: true }).run('no-floating-observables', noFloatingObservables
9090
options: [{ ignoreVoid: false }],
9191
},
9292
),
93+
fromFixture(
94+
stripIndent`
95+
// sequence expression
96+
import { of } from "rxjs";
97+
98+
of(42), of(42), void of(42);
99+
~~~~~~ [forbidden]
100+
~~~~~~ [forbidden]
101+
`,
102+
),
93103
],
94104
});

0 commit comments

Comments
 (0)