Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom formatters #308

Merged
merged 6 commits into from
Nov 13, 2020
Merged

Add support for custom formatters #308

merged 6 commits into from
Nov 13, 2020

Conversation

k-yle
Copy link
Contributor

@k-yle k-yle commented Nov 1, 2020

This PR adds support for custom formatters instead of vfile-reporter, like what eslint does.

Use case: you want machine-readable output to integrate with other CI tooling, such as the Gitlab CI .

@codecov-io

This comment has been minimized.

@wooorm
Copy link
Member

wooorm commented Nov 11, 2020

Hi there!

unified also allows custom formatters, and this is built into the code we’re using: see engine options the reporter and reporterOptions. I’m fine with adding this but don’t see why we shouldn’t use what’s build in already

@wooorm wooorm changed the title support custom formatters Add support for custom formatters Nov 11, 2020
@k-yle
Copy link
Contributor Author

k-yle commented Nov 12, 2020

Hi @wooorm, it makes a lot more sense doing it that way! I've changed it to use vfile reporters like unified does, which works and the CI passes (2nd to last commit).

However, when I tried to use reporter and reporterOptions, I get the following error from unified which I can't figure out (latest commit):

Error: Cannot `stringify` without `Compiler`
  at assertCompiler (./node_modules/unified/index.js:444:11)
  at Function.stringify (./node_modules/unified/index.js:347:5)
  at stringify (./node_modules/unified-engine/lib/file-pipeline/stringify.js:45:23)
  at wrapped (./node_modules/trough/wrap.js:25:19)
  at next (./node_modules/trough/index.js:57:24)
  at Object.run (./node_modules/trough/index.js:31:10)
  at run (./node_modules/unified-engine/lib/file-pipeline/index.js:29:10)
  at wrapped (./node_modules/trough/wrap.js:25:19)
  at next (./node_modules/trough/index.js:57:24)
  at done (./node_modules/trough/wrap.js:55:16)

this is from the latest commit in this branch. any advice would be appreciated

thanks!

Copy link
Member

@wooorm wooorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

The out removal is probably causing the error.

And some other tips inline!

cli.js Show resolved Hide resolved
cli.js Outdated Show resolved Hide resolved
cli.js Outdated Show resolved Hide resolved
cli.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@k-yle
Copy link
Contributor Author

k-yle commented Nov 12, 2020

thanks for the help @wooorm, I've made the changes you suggested, and all tests are passing again

test/cli.js Show resolved Hide resolved
@wooorm wooorm merged commit facc438 into get-alex:main Nov 13, 2020
@k-yle k-yle deleted the custom-formatter branch November 13, 2020 11:03
@wooorm
Copy link
Member

wooorm commented Nov 13, 2020

thanks @k-yle, released!

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

Successfully merging this pull request may close these issues.

3 participants