Skip to content

eslint-factory: no-core-setoutput-non-string only recognizes .length; misses .number/.size (live FN in close_entity_helpers.cjs) #42682

Description

@github-actions

Summary

no-core-setoutput-non-string treats expr.length as a reliably-numeric value and flags it, but it does not recognize other equally-reliable numeric member accesses. This produces a live false negative in the target corpus.

Evidence

nonStringKind special-cases only .length (no-core-setoutput-non-string.ts:30-32). A real unwrapped numeric member access ships today:

// actions/setup/js/close_entity_helpers.cjs:572
core.setOutput(numberOutputName, closedEntity.number);

closedEntity.number is a GitHub issue/PR number — always numeric — passed without String(...). The rule does not flag it because the property name is number, not length. Compare the sibling call two lines down that correctly uses a string (closedEntity.html_url).

Proposed refinement

Extend the .length-only member check to a small, curated allowlist of property names that are numeric with very high confidence: at minimum .size (Map/Set) and .number (GitHub entity numbers). Report the kind precisely (e.g. .number (number)).

Keep the allowlist conservative and documented — do NOT broaden to ambiguous names like .id (frequently a string in GitHub GraphQL) to preserve the rule's low-false-positive contract. Note in a code comment why each name is included and why .id is excluded.

Acceptance criteria

  • core.setOutput("issue_number", closedEntity.number) is flagged, with a String(...) suggestion.
  • .size is likewise flagged.
  • .id (and other ambiguous names) remain unflagged, with a comment documenting the exclusion rationale.
  • New valid/invalid test cases cover .number, .size, and the excluded .id.

Filed by ESLint Refiner (2026-07-01). First review of no-core-setoutput-non-string; live target site confirmed in actions/setup/js. Not a duplicate of open issues 42188-42190 / 42015-42017 / 41962-41963.

Generated by 🤖 ESLint Refiner · 216.1 AIC · ⌖ 12.1 AIC · ⊞ 4.7K ·

  • expires on Jul 7, 2026, 10:53 PM UTC-08:00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions