Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
Trott committed Apr 6, 2017
commit 7ccb1c1a12233f3e1d633da8a9ac1679885694bc
8 changes: 5 additions & 3 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
31 changes: 0 additions & 31 deletions tools/eslint-rules/new-with-error.js

This file was deleted.