Skip to content

Commit ba4946a

Browse files
committed
tools: prohibit Error.prepareStackTrace() usage
This eslint rule makes sure that `prepareStackTrace()` is not used in Node.js core. PR-URL: #29827 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
1 parent 60296a3 commit ba4946a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/.eslintrc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ rules:
3333
message: "Use an error exported by the internal/errors module."
3434
- selector: "CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace']"
3535
message: "Please use `require('internal/errors').hideStackFrames()` instead."
36+
- selector: "AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])"
37+
message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'."
3638
# Custom rules in tools/eslint-rules
3739
node-core/lowercase-name-for-primitive: error
3840
node-core/non-ascii-character: error

0 commit comments

Comments
 (0)