Skip to content

Commit 7af6b74

Browse files
committed
fix: check if callee exists
1 parent e164acd commit 7af6b74

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/rules/no-debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323
const renderVariableDeclarators = [];
2424
return {
2525
VariableDeclarator(node) {
26-
if (node.init.callee.name === 'render') {
26+
if (node.init.callee && node.init.callee.name === 'render') {
2727
if (
2828
node.id.type === 'ObjectPattern' &&
2929
node.id.properties.some(property => property.key.name === 'debug')

tests/lib/rules/no-debug.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ ruleTester.run('no-debug', rule, {
2626
},
2727
{
2828
code: `() => {
29+
const somethingElse = {}
2930
const { debug } = foo()
3031
debug()
3132
}`,

0 commit comments

Comments
 (0)