diff options
author | Rich Trott <rtrott@gmail.com> | 2017-04-06 05:11:48 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-04-08 22:33:46 +0300 |
commit | 8191af5b292aa5d5f07492105781b6cf1d91c42f (patch) | |
tree | 86dcf9c5ce38cc237673b5cfb6ca4f8e0397b0d8 /.eslintrc.yaml | |
parent | a37273c1e4b93ed048e1d45818fe6c525480b121 (diff) |
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 '.eslintrc.yaml')
-rw-r--r-- | .eslintrc.yaml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/.eslintrc.yaml b/.eslintrc.yaml index f4809c0fc91..07ef483c3f3 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -106,8 +106,11 @@ rules: message: "setTimeout() must be invoked with at least two arguments." }, { selector: "CallExpression[callee.name='setInterval'][arguments.length<2]", - message: "setInterval() must be invoked with at least 2 arguments" - }] + message: "setInterval() must be invoked with at least 2 arguments." + }, { + selector: "ThrowStatement > CallExpression[callee.name=/Error$/]", + message: "Use new keyword when throwing an Error." + }] no-tabs: 2 no-trailing-spaces: 2 one-var-declaration-per-line: 2 @@ -141,7 +144,6 @@ rules: align-multiline-assignment: 2 assert-fail-single-argument: 2 assert-throws-arguments: [2, { requireTwo: false }] - new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError] no-unescaped-regexp-dot: 2 # Global scoped method and vars |