Skip to content

eslint-factory: prefer-core-logging rewrites console.error/console.warn (stderr) to core.error/core.warning (stdout), corrupting [Content truncated due to length] #46541

Description

@github-actions

Summary

prefer-core-logging suggests replacing every console.* call with a core.* method. But the two families write to different streams: console.error / console.warn go to the process stderr, while @actions/core logging methods (core.info / core.error / core.warning / core.debug) emit GitHub Actions workflow commands to stdout. For processes that own stdout as a data/protocol channel — the stdio MCP servers and transports in actions/setup/js — moving diagnostics onto stdout corrupts the JSON-RPC stream. The stream change (stderr -> stdout) is not behavior-preserving.

Grounded evidence (all linted; config ignores only *.test.cjs)

  • safe_outputs_mcp_server.cjs:101console.error(...) in the stdio server startup catch path (the server writes JSON-RPC to stdout).
  • mcp_scripts_mcp_server.cjs:87 and :105console.error(...) usage/startup errors.
  • mcp_http_transport.cjs:295console.error("MCP HTTP Transport error:", error).
  • safe_outputs_mcp_server_http.cjs, mcp_scripts_mcp_server_http.cjs — same pattern.

These files deliberately log to stderr precisely to keep stdout clean for the protocol. Rewriting to core.error would write ::error::... to stdout and break framing.

Acceptance criteria

  • Do not offer a core.* rewrite for console.error / console.warn (stderr -> stdout is a semantic change), or exclude MCP server/transport entrypoints from the rule (config ignores glob, or a documented filename/heuristic guard).
  • At minimum, downgrade console.error / console.warn to report-only (no autofix) so the harmful transform is never auto-applied.
  • Add tests: console.error / console.warn produce no autofix (or no report) in the excluded contexts; console.log / console.info -> core.info still behaves as today.
  • Document the stream-semantics rationale in the rule's README section so future readers understand why stderr logging is intentionally exempt.

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

  • expires on Jul 25, 2026, 10:22 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

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