Skip to content

eslint-plugin: drizzleHelperKind option for model-style custom drizzle helpers #123

@sdougbrown

Description

@sdougbrown

Context

Custom helpers added to drizzleHelpers always use table-style checking (options at arg[1] with an exclude array). This was fixed in #117 — before the fix, custom helpers with an ObjectExpression first arg were misrouted to model-style checking, producing false positives on every config property.

Table-style is the correct safe default. But it means a model-style wrapper like hydrateDrizzleModel cannot get model-style exclude checking without explicit config.

Proposed API

A drizzleHelperKind map that pins a custom helper to 'table' or 'model' style:

'@umpire/no-write-owned-fields': ['warn', {
  drizzleHelpers: ['hydrateDrizzleModel'],
  drizzleHelperKind: { hydrateDrizzleModel: 'model' },
}]

With 'model', the rule checks each entry value for { table, exclude } shape. Without it, the safe default (table-style) applies.

When to do this

When a real custom model-style helper use case emerges. The current table-style fallback produces no false positives and the limitation is documented.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions