Description
The prefer-core-logging ESLint rule rewrites console.error/console.warn (which write to stderr) to core.error/core.warning (which write ::error:: commands to stdout). In stdio MCP servers and transports that use stdout for JSON-RPC, this rewrite corrupts the protocol channel.
Additionally, the autofix joins multi-argument console.error(msg, err) calls into a single string, silently dropping trailing arguments.
Suggested Changes
- Add a file-pattern exclusion (or AST heuristic) to skip rewrites in stdio MCP server and transport files
- Fix multi-argument autofix to properly interpolate arguments rather than silently drop them
- Update tests to cover the lossy multi-arg case (currently test at line 180 canonizes the loss)
Files Affected
actions/setup/js/eslint-factory/rules/prefer-core-logging.ts (rule + autofix)
actions/setup/js/eslint-factory/rules/prefer-core-logging.test.ts (line 180 — lossy test)
- Affected production sites:
safe_outputs_mcp_server.cjs:101, mcp_scripts_mcp_server.cjs:87,105, mcp_http_transport.cjs:295
Success Criteria
- MCP stdio servers are excluded from the rewrite (stdout integrity preserved)
- Multi-argument calls produce non-lossy output after autofix
- Tests cover both cases
Source
Extracted from ESLint Refiner Report #46543
Priority
High — Current rule corrupts MCP stdio channel and silently drops error context
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 40.8 AIC · ⌖ 6.1 AIC · ⊞ 7K · ◷
Description
The
prefer-core-loggingESLint rule rewritesconsole.error/console.warn(which write to stderr) tocore.error/core.warning(which write::error::commands to stdout). In stdio MCP servers and transports that use stdout for JSON-RPC, this rewrite corrupts the protocol channel.Additionally, the autofix joins multi-argument
console.error(msg, err)calls into a single string, silently dropping trailing arguments.Suggested Changes
Files Affected
actions/setup/js/eslint-factory/rules/prefer-core-logging.ts(rule + autofix)actions/setup/js/eslint-factory/rules/prefer-core-logging.test.ts(line 180 — lossy test)safe_outputs_mcp_server.cjs:101,mcp_scripts_mcp_server.cjs:87,105,mcp_http_transport.cjs:295Success Criteria
Source
Extracted from ESLint Refiner Report #46543
Priority
High — Current rule corrupts MCP stdio channel and silently drops error context