Skip to content

Commit

Permalink
tools: prohibit Error.prepareStackTrace() usage
Browse files Browse the repository at this point in the history
This eslint rule makes sure that `prepareStackTrace()` is not used in
Node.js core.

PR-URL: #29827
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
  • Loading branch information
BridgeAR committed Oct 9, 2019
1 parent 60296a3 commit ba4946a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba4946a

Please sign in to comment.