nodejs/deps/node-inspect/tools/eslint-rules/assert-fail-single-argument.js
Jan Krems 8c9762e150
deps: add node-inspect 1.10.2
Squashed from:

- deps: Add node-inspect 1.10.1

This adds a reimplementation of the old CLI debugger (`node debug`)
against the new debugger protocol (`node --inspect`). This is necessary
because the old protocol won't be supported in future versions of V8.

- deps: Update node-inspect to 1.10.2

Starting with 1.10.2 the test suite should pass consistently on
windows.

- deps: Update to node-inspect 1.10.4

PR-URL: https://github.com/nodejs/node/pull/10187
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-13 14:46:12 +01:00

31 lines
814 B
JavaScript

/**
* @fileoverview Prohibit use of a single argument only in `assert.fail()`. It
* is almost always an error.
* @author Rich Trott
*/
'use strict';
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
const msg = 'assert.fail() message should be third argument';
function isAssert(node) {
return node.callee.object && node.callee.object.name === 'assert';
}
function isFail(node) {
return node.callee.property && node.callee.property.name === 'fail';
}
module.exports = function(context) {
return {
'CallExpression': function(node) {
if (isAssert(node) && isFail(node) && node.arguments.length === 1) {
context.report(node, msg);
}
}
};
};