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 reporter option #55

Merged
merged 8 commits into from
Feb 13, 2019
Merged

Add reporter option #55

merged 8 commits into from
Feb 13, 2019

Conversation

damccorm
Copy link
Contributor

@damccorm damccorm commented Jan 18, 2019

I currently am trying to add CI to sindresorhus/awesome using Azure Pipelines, and I would like to use a custom reporter so that I can display test results in the Pipelines test UI. This PR enables that by adding support for custom reporters.

PR here: sindresorhus/awesome#1505

@damccorm
Copy link
Contributor Author

@sindresorhus @transitive-bullshit could you take a look at this?

index.js Outdated
@@ -69,7 +73,11 @@ lint.report = async options => {
process.exitCode = 1;

file.path = path.basename(file.path);
console.log(vfileReporterPretty([file]));
if (options.customReporter) {
Copy link
Owner

Choose a reason for hiding this comment

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

The option name can simply be named reporter.

index.js Outdated
console.log(options.customReporter([file]));
} else {
console.log(vfileReporterPretty([file]));
}
Copy link
Owner

Choose a reason for hiding this comment

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

Can be simplified to:

const reporter = options.reporter || vfileReporterPretty;
console.log(reporter([file]));

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "awesome-lint",
"version": "0.8.0",
"version": "0.9.0",
Copy link
Owner

Choose a reason for hiding this comment

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

Don't bump version in a pull request. It's up to the maintainers when, how, and what version to bump :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, my apologies, that makes sense.

@sindresorhus
Copy link
Owner

Yeah, makes sense to have this. The option must be documented in the readme and needs a test in https://github.com/sindresorhus/awesome-lint/blob/master/test/cli.js

@sindresorhus sindresorhus changed the title Allow user to pass in custom reporter Add reporter option Feb 11, 2019
@sindresorhus
Copy link
Owner

It should be exposed as a CLI flag too.

@damccorm
Copy link
Contributor Author

@sindresorhus I went ahead and responded to all feedback, let me know if you think there's any additional work to do before merging.

@sindresorhus
Copy link
Owner

Looks good :)

@sindresorhus sindresorhus merged commit 9d12b8f into sindresorhus:master Feb 13, 2019
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.

2 participants