Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
f87e6133
Commit
f87e6133
authored
7 years ago
by
Dan Abramov
Committed by
GitHub
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Make error/warning output more useful (#2161)
parent
9e733b57
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/react-dev-utils/eslintFormatter.js
+4
-3
packages/react-dev-utils/eslintFormatter.js
packages/react-dev-utils/formatWebpackMessages.js
+1
-11
packages/react-dev-utils/formatWebpackMessages.js
packages/react-scripts/scripts/utils/createWebpackCompiler.js
+6
-10
...ages/react-scripts/scripts/utils/createWebpackCompiler.js
with
11 additions
and
24 deletions
+11
-24
packages/react-dev-utils/eslintFormatter.js
+
4
-
3
View file @
f87e6133
...
@@ -30,13 +30,13 @@ function formatter(results) {
...
@@ -30,13 +30,13 @@ function formatter(results) {
}
}
let
line
=
message
.
line
||
0
;
let
line
=
message
.
line
||
0
;
let
position
=
chalk
.
dim
(
`Line
${
line
}
:`
);
let
position
=
chalk
.
bold
(
'
Line
'
+
line
+
'
:
'
);
return
[
return
[
''
,
''
,
position
,
position
,
messageType
,
messageType
,
message
.
message
.
replace
(
/
\.
$/
,
''
),
message
.
message
.
replace
(
/
\.
$/
,
''
),
chalk
.
cyan
(
message
.
ruleId
||
''
),
chalk
.
underline
(
message
.
ruleId
||
''
),
];
];
});
});
...
@@ -47,7 +47,8 @@ function formatter(results) {
...
@@ -47,7 +47,8 @@ function formatter(results) {
// add color to messageTypes
// add color to messageTypes
messages
.
forEach
(
m
=>
{
messages
.
forEach
(
m
=>
{
m
[
2
]
=
m
[
2
]
===
'
error
'
?
chalk
.
red
(
m
[
2
])
:
chalk
.
yellow
(
m
[
2
]);
m
[
3
]
=
m
[
2
]
===
'
error
'
?
chalk
.
red
(
m
[
3
])
:
chalk
.
yellow
(
m
[
3
]);
m
.
splice
(
2
,
1
);
});
});
let
outputTable
=
table
(
messages
,
{
let
outputTable
=
table
(
messages
,
{
...
...
This diff is collapsed.
Click to expand it.
packages/react-dev-utils/formatWebpackMessages.js
+
1
-
11
View file @
f87e6133
...
@@ -86,17 +86,7 @@ function formatMessage(message, isError) {
...
@@ -86,17 +86,7 @@ function formatMessage(message, isError) {
);
);
}
}
// Make filename nicer.
lines
[
0
]
=
chalk
.
inverse
(
lines
[
0
]);
var
slashIndex
=
Math
.
max
(
lines
[
0
].
lastIndexOf
(
'
/
'
),
lines
[
0
].
lastIndexOf
(
'
\\
'
)
);
var
fileName
=
lines
[
0
].
substring
(
slashIndex
+
1
);
var
path
=
lines
[
0
].
substring
(
0
,
slashIndex
+
1
);
lines
[
0
]
=
chalk
.
dim
(
isError
?
'
Found errors in
'
:
'
Found warnings in
'
)
+
path
+
(
isError
?
chalk
.
red
:
chalk
.
yellow
)(
fileName
)
+
chalk
.
dim
(
'
:
'
);
// Reassemble the message.
// Reassemble the message.
message
=
lines
.
join
(
'
\n
'
);
message
=
lines
.
join
(
'
\n
'
);
...
...
This diff is collapsed.
Click to expand it.
packages/react-scripts/scripts/utils/createWebpackCompiler.js
+
6
-
10
View file @
f87e6133
...
@@ -103,18 +103,14 @@ module.exports = function createWebpackCompiler(config, onReadyCallback) {
...
@@ -103,18 +103,14 @@ module.exports = function createWebpackCompiler(config, onReadyCallback) {
// Teach some ESLint tricks.
// Teach some ESLint tricks.
console
.
log
(
console
.
log
(
chalk
.
dim
(
'
Search for the
'
+
'
Search for the
'
+
chalk
.
underline
(
'
rule keywords
'
)
+
chalk
.
cyan
(
'
rule keywords
'
)
+
'
to learn more about each warning.
'
'
to learn more about each warning.
'
)
);
);
console
.
log
(
console
.
log
(
chalk
.
dim
(
'
To ignore, add
'
+
'
To ignore, add
'
+
chalk
.
yellow
(
'
// eslint-disable-next-line
'
)
+
chalk
.
yellow
(
'
// eslint-disable-next-line
'
)
+
'
to the previous line.
'
'
to the previous line.
'
)
);
);
console
.
log
();
console
.
log
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets