Rules
no-error-cause-option
Preserve raw errors using an explicit error field.
Purpose and behavior
Preserve raw errors using an explicit error field.
The rule reports new Error calls with cause in any object argument. The rule ignores other constructors, including TypeError. Use an application error type that stores the original error without rebuilding its message.
Options
No configurable options. Enable with "rules/no-error-cause-option": "error".
Invalid example
new Error('boom', { cause: error })Valid example
new ConfigFileError({ error })Fixes and exceptions
This rule provides no automatic fix. Rewrite the code to preserve its intended behavior.
For a boundary exception, use oxlint-disable-next-line rules/no-error-cause-option -- reason. Examples cover this rule only and may omit imports or declarations.
Source and tests
Enabled by the Effect preset.