mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 15:30:56 +01:00
8c9762e150
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>
32 lines
791 B
JavaScript
32 lines
791 B
JavaScript
/**
|
|
* @fileoverview Require `throw new Error()` rather than `throw Error()`
|
|
* @author Rich Trott
|
|
*/
|
|
'use strict';
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Rule Definition
|
|
//------------------------------------------------------------------------------
|
|
|
|
module.exports = function(context) {
|
|
|
|
var errorList = context.options.length !== 0 ? context.options : ['Error'];
|
|
|
|
return {
|
|
'ThrowStatement': function(node) {
|
|
if (node.argument.type === 'CallExpression' &&
|
|
errorList.indexOf(node.argument.callee.name) !== -1) {
|
|
context.report(node, 'Use new keyword when throwing.');
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
module.exports.schema = {
|
|
'type': 'array',
|
|
'additionalItems': {
|
|
'type': 'string'
|
|
},
|
|
'uniqueItems': true
|
|
};
|