Skip to content

Commit

Permalink
Update eslintFormatter for eslint-webpack-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb committed Oct 15, 2020
1 parent 9e01d43 commit e02427f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/react-dev-utils/eslintFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,24 @@

'use strict';

const path = require('path');
const chalk = require('chalk');
const stripAnsi = require('strip-ansi');
const table = require('text-table');

const cwd = process.cwd();

function isError(message) {
if (message.fatal || message.severity === 2) {
return true;
}
return false;
}

function getRelativePath(filePath) {
return path.relative(cwd, filePath);
}

function formatter(results) {
let output = '\n';
let hasErrors = false;
Expand Down Expand Up @@ -73,6 +80,10 @@ function formatter(results) {
},
});

// print the filename and relative path
output += `${getRelativePath(result.filePath)}\n`;

// print the errors
output += `${outputTable}\n\n`;
});

Expand Down

0 comments on commit e02427f

Please sign in to comment.