1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/usr/bin/env node
- const fs = require('fs');
- const CLIEngine = require('eslint').CLIEngine;
- const argv = process.argv.slice(2);
- const cli = new CLIEngine({
- fix: false,
- extensions: argv[1].split(','),
- configFile: '.eslintrc.relax.js',
- });
- const report = cli.executeOnFiles(argv.slice(3));
- const consoleFormatter = cli.getFormatter();
- const otherFormatterType = argv.indexOf('--format=checkstyle') > -1 ? 'checkstyle' : null;
- console.log(consoleFormatter(report.results));
- if (otherFormatterType) {
- const otherFormatter = cli.getFormatter(otherFormatterType);
- fs.writeFile(
- '.artifacts/eslint.checkstyle.xml',
- otherFormatter(report.results),
- 'utf8',
- () => {
- process.exit(report.errorCount);
- }
- );
- }
|