Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update eslintFormatter for eslint-webpack-plugin
  • Loading branch information
mrmckeb committed Oct 18, 2020
commit 9ae90f5d414dccbc3214677bde8dbc4808d89ca6
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