eslint-travis-wrapper 925 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env node
  2. /* eslint no-console:0 import/no-nodejs-modules:0 */
  3. /* global process */
  4. const fs = require('fs');
  5. const CLIEngine = require('eslint').CLIEngine;
  6. const argv = process.argv.slice(2);
  7. const cli = new CLIEngine({
  8. fix: false,
  9. extensions: argv[1].split(','),
  10. configFile: '.eslintrc.relax.js',
  11. });
  12. // Lint all files
  13. const report = cli.executeOnFiles(argv.slice(3));
  14. // get the default formatter
  15. const consoleFormatter = cli.getFormatter();
  16. const otherFormatterType = argv.indexOf('--format=checkstyle') > -1 ? 'checkstyle' : null;
  17. // output to console
  18. console.log(consoleFormatter(report.results));
  19. // Output to checkstyle format for zeus
  20. if (otherFormatterType) {
  21. const otherFormatter = cli.getFormatter(otherFormatterType);
  22. fs.writeFile(
  23. '.artifacts/eslint.checkstyle.xml',
  24. otherFormatter(report.results),
  25. 'utf8',
  26. () => {
  27. process.exit(report.errorCount);
  28. }
  29. );
  30. }