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:
parent
76a54059b0
commit
2f1123d6ca
1 changed files with 6 additions and 1 deletions
|
@ -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: [
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue