Skip to content

eslint-factory: prefer-core-logging autofix drops trailing arguments (core.* take a single message) — data loss on multi-arg/for [Content truncated due to length] #46542

Description

@github-actions

Summary

The prefer-core-logging suggestion fix rebuilds the call as core.method(<all original args joined by ", ">). But @actions/core logging methods take a single message: string argument — trailing arguments are silently ignored at runtime, and printf-style format specifiers (%s, %d, %o) that console.* interpolates are not interpolated by core.*. The autofix therefore drops data.

Grounded evidence

  • mcp_http_transport.cjs:295: console.error("MCP HTTP Transport error:", error) -> autofix core.error("MCP HTTP Transport error:", error). error is passed as a second argument to core.error(message) and is dropped — the actual error object is lost from the log.
  • The rule's own test canonizes the lossy behavior: src/rules/prefer-core-logging.test.ts:180 expects console.log("value:", someVar) -> core.info("value:", someVar), where someVar no longer reaches the output.

Acceptance criteria

  • Withhold the suggestion (report-only / no fix) when node.arguments.length !== 1, since a mechanical single-message rewrite cannot preserve multi-argument semantics.
  • Also withhold (or specially handle) when the sole/first string argument contains a %-format specifier.
  • If a fix is still desired for the multi-arg case, join arguments into a single interpolated string (e.g. a template literal) rather than passing them positionally; the safe default is report-only.
  • Update prefer-core-logging.test.ts:175-191 to assert no autofix (or a correctly-joined single-arg fix) for the multi-arg case.
  • Re-verify mcp_http_transport.cjs:295 no longer receives a data-dropping autofix.

Generated by 🤖 ESLint Refiner · 312.3 AIC · ⌖ 12.9 AIC · ⊞ 4.6K ·

  • expires on Jul 25, 2026, 10:22 PM UTC-08:00

Metadata

Metadata

Labels

cookieIssue Monster Loves Cookies!eslint

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions