tools: prohibit Error.prepareStackTrace() usage
This eslint rule makes sure that `prepareStackTrace()` is not used in Node.js core. PR-URL: https://github.com/nodejs/node/pull/29827 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
This commit is contained in:
parent
870eea303a
commit
0521a98fd6
@ -33,6 +33,8 @@ rules:
|
||||
message: "Use an error exported by the internal/errors module."
|
||||
- selector: "CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace']"
|
||||
message: "Please use `require('internal/errors').hideStackFrames()` instead."
|
||||
- selector: "AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])"
|
||||
message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'."
|
||||
# Custom rules in tools/eslint-rules
|
||||
node-core/lowercase-name-for-primitive: error
|
||||
node-core/non-ascii-character: error
|
||||
|
Loading…
x
Reference in New Issue
Block a user