Rules

no-error-property-access

Pass raw error values through without inspecting their properties.

Purpose and behavior

Pass raw error values through without inspecting their properties.

Reports member access on identifiers named e, error, c, cause or err, including bracket access. It is name-based and is not restricted to catch blocks. Other receiver names are not checked, so do not treat passing this rule as proof of error safety.

Options

No configurable options. Enable with "rules/no-error-property-access": "error".

Invalid example

const message = error.message

Valid example

new ConfigFileError({ error })

Fixes and exceptions

This rule reports diagnostics without an automatic fix. Rewrite the code deliberately rather than guessing its intended semantics.

For a genuine boundary exception, use an oxlint-disable-next-line rules/no-error-property-access -- reason comment. Examples illustrate this rule alone and may omit imports and declarations.

Source and tests

Enabled by the Effect preset.

no-error-property-access.ts · Tests