Skip to content

Commit

Permalink
fix: Fix no-assigning-return-values 'cannot read property callee of u…
Browse files Browse the repository at this point in the history
…ndefined' error (fixes #8)
  • Loading branch information
chrisbreiding committed Nov 5, 2018
2 parents 27c2b12 + c7b96f7 commit 13ff374
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rules/no-assigning-return-values.js
Expand Up @@ -35,6 +35,9 @@ function isCypressCommandDeclaration(declarator) {
if (!declarator.init.callee) { return; }

let object = declarator.init.callee.object;

if (!object) { return; }

while (object.callee) {
object = object.callee.object;
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/rules/no-assigning-return-values.js
Expand Up @@ -13,6 +13,7 @@ ruleTester.run('no-assigning-return-values', rule, {
{ code: 'var foo = true;', parserOptions },
{ code: 'let foo = true;', parserOptions },
{ code: 'const foo = true;', parserOptions },
{ code: 'const foo = bar();', parserOptions },
{ code: 'cy.get("foo");', parserOptions },
{ code: 'cy.contains("foo").click();', parserOptions }
],
Expand Down

0 comments on commit 13ff374

Please sign in to comment.