Skip to content

Commit ff4c2c6

Browse files
committed
fix: ignore call chain in update collection method
1 parent 41fb151 commit ff4c2c6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/rules/no-sync-mongo-methods-on-server.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ module.exports = {
134134
return;
135135
}
136136
}
137-
if(node.object.type === 'MemberExpression'){
137+
// this means it's a call chain like crypto.createHmac().update()
138+
if(['MemberExpression', 'CallExpression'].includes(node.object.type) && node.type === 'MemberExpression'){
138139
// we can ignore longer than 1 call chain
139140
debug(
140141
`Skipping ${invalidFunction} to be considered error because it was used in a longer than 1 call chain`,

0 commit comments

Comments
 (0)