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

Report to file. #58

Open
flaviojs opened this issue Feb 17, 2018 · 2 comments
Open

Report to file. #58

flaviojs opened this issue Feb 17, 2018 · 2 comments

Comments

@flaviojs
Copy link

flaviojs commented Feb 17, 2018

I'd like to have an option to write the eslint report to file in the format specified by formatter.

I want to have Jenkins pick it up and process it (in checkstyle format).
For console output the amount of warnings and errors is enough for me (not an issue, I'm not picky about this).

@IanVS
Copy link
Contributor

IanVS commented Feb 19, 2018

That seems like a reasonable request. Would you like to try implementing it and submitting a PR?

@flaviojs
Copy link
Author

flaviojs commented Feb 24, 2018

There are so many ways this could be implemented that I'm unsure of what to do in a PR...

A lazy way to implement this would be to allow overriding the whole reporting logic:

var options = {
  // Replaces reporting logic.
  reporter: function (p, opts, report) {
    // Only contextName, timeout, and slow are used before this function is called.
    // hmm, maybe fallback to the original reporter if a specific value is returned?
  }
}

Another way would be to allow multiple formatters and introduce formatter options:

var options = {
  formatter: [
    // Default report to console.
    'stylish',
    // Always output to file.
    { formatter: 'checkstyle', file: 'lint-report.xml', always: true }
  ]
}

And many other alternatives... I don't know what kind of style you're aiming for so no idea what would be appropriate.

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

No branches or pull requests

2 participants