You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
852 B

/**
* @fileoverview Prohibit use of assert.deepEqual()
* @author Rich Trott
*
* This rule is imperfect, but will find the most common forms of
* assert.deepEqual() usage.
*/
'use strict';
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
const msg = 'assert.deepEqual() disallowed. Use assert.deepStrictEqual()';
function isAssert(node) {
return node.callee.object && node.callee.object.name === 'assert';
}
function isDeepEqual(node) {
return node.callee.property && node.callee.property.name === 'deepEqual';
}
module.exports = function(context) {
return {
'CallExpression': function(node) {
if (isAssert(node) && isDeepEqual(node)) {
context.report(node, msg);
}
}
};
};