Skip to content

Commit

Permalink
lint: add rule to disallow new Error throwing
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Feb 24, 2025
1 parent 1e97567 commit 85aa5fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/eslint.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ module.exports = {
'simple-import-sort/exports': 'error',
'sort-imports': ['error', { ignoreDeclarationSort: true }],
'ethereumjs/noBuffer': 'error',
'no-restricted-syntax': 'off',
'no-restricted-syntax': [
'error',
{
selector: "ThrowStatement > NewExpression[callee.name='Error']",
message: "Throwing default JS Errors is not allowed. It is only possible to throw `EthereumJSError` (see the util package)",
}
]
},
parserOptions: {
extraFileExtensions: ['.json'],
Expand Down

0 comments on commit 85aa5fa

Please sign in to comment.