summaryrefslogtreecommitdiff
path: root/tools/eslint-rules
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-04-05 19:11:48 -0700
committerRich Trott <rtrott@gmail.com>2017-04-08 12:33:46 -0700
commit8191af5b292aa5d5f07492105781b6cf1d91c42f (patch)
tree86dcf9c5ce38cc237673b5cfb6ca4f8e0397b0d8 /tools/eslint-rules
parenta37273c1e4b93ed048e1d45818fe6c525480b121 (diff)
downloadandroid-node-v8-8191af5b292aa5d5f07492105781b6cf1d91c42f.tar.gz
android-node-v8-8191af5b292aa5d5f07492105781b6cf1d91c42f.tar.bz2
android-node-v8-8191af5b292aa5d5f07492105781b6cf1d91c42f.zip
tools: replace custom new-with-error rule
Use no-restricted-syntax to implement the requirement that `Error` objects must be thrown with the `new` keyword. PR-URL: https://github.com/nodejs/node/pull/12249 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'tools/eslint-rules')
-rw-r--r--tools/eslint-rules/new-with-error.js31
1 files changed, 0 insertions, 31 deletions
diff --git a/tools/eslint-rules/new-with-error.js b/tools/eslint-rules/new-with-error.js
deleted file mode 100644
index 655f34bf08..0000000000
--- a/tools/eslint-rules/new-with-error.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * @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
-};