Skip to content

Commit a007ecc

Browse files
committed
fix: Fix no-assigning-return-values no callee exception (fixes #8)
1 parent 13ff374 commit a007ecc

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/rules/no-assigning-return-values.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ function isCypressCommandDeclaration(declarator) {
4040

4141
while (object.callee) {
4242
object = object.callee.object;
43+
if (!object) {
44+
return;
45+
}
4346
}
4447

4548
return object.name === 'cy';

tests/lib/rules/no-assigning-return-values.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ruleTester.run('no-assigning-return-values', rule, {
1414
{ code: 'let foo = true;', parserOptions },
1515
{ code: 'const foo = true;', parserOptions },
1616
{ code: 'const foo = bar();', parserOptions },
17+
{ code: 'const foo = bar().baz();', parserOptions },
1718
{ code: 'cy.get("foo");', parserOptions },
1819
{ code: 'cy.contains("foo").click();', parserOptions }
1920
],

0 commit comments

Comments
 (0)