diff --git a/tools/eslint-rules/prefer-proto.js b/tools/eslint-rules/prefer-proto.js index b950321e7c3433..9f8f4f7988b6fa 100644 --- a/tools/eslint-rules/prefer-proto.js +++ b/tools/eslint-rules/prefer-proto.js @@ -27,10 +27,10 @@ module.exports = { }, create(context) { return { - /* eslint max-len: 0 */ - 'CallExpression[callee.type="Identifier"][callee.name="ObjectCreate"][arguments.0.type="Literal"][arguments.0.value=null][arguments.length=1],\ - CallExpression[callee.type="MemberExpression"][callee.object.name="Object"][callee.property.name="create"][arguments.0.type="Literal"][arguments.0.value=null][arguments.length=1]\ - '(node) { + 'CallExpression[arguments.length=1][arguments.0.type="Literal"][arguments.0.value=null]:matches(\ + [callee.type="Identifier"][callee.name="ObjectCreate"],\ + [callee.type="MemberExpression"][callee.object.name="Object"][callee.property.name="create"]\ + )'(node) { if (node.callee.type === 'MemberExpression') { const scope = declaredScope(context, node.callee.object); if (scope !== 'module' && scope !== 'global') {