Skip to content

unsafe_type_assertion column/line uses type-node position instead of expression-start #25

Description

@CodeDeficient

Summary

unsafe_type_assertion reports line and column from node.type.getStart(sourceFile) (the any keyword position), while all other AST assertion types (unsafe_double_type_assertion, unsafe_object_assertion, unsafe_array_assertion) use node.getStart() (the start of the entire AsExpression).

Impact

  • For single-line value as any, the difference is minor (column points to any instead of value)
  • For multiline value as\n any, the line differs — unsafe_type_assertion reports line 2, other assertion types would report line 1
  • If consumers use column for editor annotations or sorting, values won't be directly comparable across assertion types
  • Suppression behavior is unaffected (uses expression-start line for all branches)

Location

ai-slop-detector.ts:244-259

Resolution

Align unsafe_type_assertion to use node.getStart() like the other assertion types, or document the intentional difference if multiline accuracy is preferred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions