Skip to content

Commit e02427f

Browse files
committed
Update eslintFormatter for eslint-webpack-plugin
1 parent 9e01d43 commit e02427f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/react-dev-utils/eslintFormatter.js

+11
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,24 @@
77

88
'use strict';
99

10+
const path = require('path');
1011
const chalk = require('chalk');
1112
const stripAnsi = require('strip-ansi');
1213
const table = require('text-table');
1314

15+
const cwd = process.cwd();
16+
1417
function isError(message) {
1518
if (message.fatal || message.severity === 2) {
1619
return true;
1720
}
1821
return false;
1922
}
2023

24+
function getRelativePath(filePath) {
25+
return path.relative(cwd, filePath);
26+
}
27+
2128
function formatter(results) {
2229
let output = '\n';
2330
let hasErrors = false;
@@ -73,6 +80,10 @@ function formatter(results) {
7380
},
7481
});
7582

83+
// print the filename and relative path
84+
output += `${getRelativePath(result.filePath)}\n`;
85+
86+
// print the errors
7687
output += `${outputTable}\n\n`;
7788
});
7889

0 commit comments

Comments
 (0)