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.

The rule reports property access on identifiers named e, error, c, cause or err, including bracket access. The rule checks names inside and outside catch blocks. It ignores other names, so passing does not prove safe error handling.

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 provides no automatic fix. Rewrite the code to preserve its intended behavior.

For a boundary exception, use oxlint-disable-next-line rules/no-error-property-access -- reason. Examples cover this rule only and may omit imports or declarations.

Source and tests

Enabled by the Effect preset.

no-error-property-access.ts · Tests