Skip to content

fix(cli): support dashed formats in --output.<format>#2968

Open
slegarraga wants to merge 1 commit into
stoplightio:developfrom
slegarraga:fix/output-dashed-formats
Open

fix(cli): support dashed formats in --output.<format>#2968
slegarraga wants to merge 1 commit into
stoplightio:developfrom
slegarraga:fix/output-dashed-formats

Conversation

@slegarraga

Copy link
Copy Markdown
Contributor

Summary

--output.github-actions / --output.code-climate did not work, even though the docs show --output.<format>. Fixes #2926.

Root cause

yargs camel-cases dotted keys, so --output.github-actions <file> is parsed as output.githubActions (and may keep the original github-actions key too). The validation then compares the output keys against the --format values, which use the dashed names, producing either:

  • The number of outputs must match the number of formats (duplicate key), or
  • Missing outputs for the following formats: github-actions, code-climate (camel-cased key).

Fix

Add a coerce to the output option that re-keys the object by the canonical format names, taking the value from either the dashed or the camel-cased key. Dashed formats now line up with --format.

Test

Added a test in lint.test.ts:

lint --format github-actions --format code-climate \
     --output.github-actions ga.txt --output.code-climate cc.json <doc>

asserts writeOutput is called with ga.txt and cc.json. Full suite: 21 passed.

yargs camel-cases dotted keys, so `--output.github-actions` became
`githubActions` (and could duplicate the original key), no longer matching
the dashed `--format` name. A coerce on `output` re-keys the object by the
canonical format names so dashed formats line up with `--format`.

Closes stoplightio#2926
@slegarraga slegarraga requested a review from a team as a code owner June 3, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output file for github-actions and code-climate formatters cannot be specified

1 participant