Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9e01d43 commit e02427fCopy full SHA for e02427f
packages/react-dev-utils/eslintFormatter.js
@@ -7,17 +7,24 @@
7
8
'use strict';
9
10
+const path = require('path');
11
const chalk = require('chalk');
12
const stripAnsi = require('strip-ansi');
13
const table = require('text-table');
14
15
+const cwd = process.cwd();
16
+
17
function isError(message) {
18
if (message.fatal || message.severity === 2) {
19
return true;
20
}
21
return false;
22
23
24
+function getRelativePath(filePath) {
25
+ return path.relative(cwd, filePath);
26
+}
27
28
function formatter(results) {
29
let output = '\n';
30
let hasErrors = false;
@@ -73,6 +80,10 @@ function formatter(results) {
73
80
},
74
81
});
75
82
83
+ // print the filename and relative path
84
+ output += `${getRelativePath(result.filePath)}\n`;
85
86
+ // print the errors
76
87
output += `${outputTable}\n\n`;
77
88
78
89
0 commit comments