0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Added eslint rule to prevent usage of new Error()

- we have our own error library that should always be used to wrap errors in useful info
- therefore instead of new Error() we should always be using errors.SomeError from @tryghost/error
This commit is contained in:
Hannah Wolfe 2021-06-08 11:36:37 +01:00
parent 76a54059b0
commit 2f1123d6ca
No known key found for this signature in database
GPG key ID: 9F8C7532D0A6BA55

View file

@ -13,7 +13,12 @@ module.exports = {
// @TODO: remove this rule once it's turned into "error" in the base plugin
'no-shadow': 'error',
'no-var': 'error',
'one-var': [2, 'never']
'one-var': [2, 'never'],
'no-restricted-syntax': ['warn',
{
selector: 'NewExpression[callee.name=\'Error\']',
message: 'Direct calls to new Error() are not allowed. Please use @tryghost/errors.'
}]
},
overrides: [
{