Skip to content
GitLab
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
21349c54
Commit
21349c54
authored
7 years ago
by
Dan Abramov
Committed by
GitHub
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Tweak error and warning output (#2152)
* Tweak error and warning output * Add a colon
parent
77087da3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/react-dev-utils/eslintFormatter.js
+1
-1
packages/react-dev-utils/eslintFormatter.js
packages/react-dev-utils/formatWebpackMessages.js
+11
-3
packages/react-dev-utils/formatWebpackMessages.js
packages/react-scripts/scripts/utils/createWebpackCompiler.js
+11
-6
...ages/react-scripts/scripts/utils/createWebpackCompiler.js
with
23 additions
and
10 deletions
+23
-10
packages/react-dev-utils/eslintFormatter.js
+
1
-
1
View file @
21349c54
...
@@ -37,7 +37,7 @@ function formatter(results) {
...
@@ -37,7 +37,7 @@ function formatter(results) {
position
,
position
,
messageType
,
messageType
,
message
.
message
.
replace
(
/
\.
$/
,
''
),
message
.
message
.
replace
(
/
\.
$/
,
''
),
chalk
.
dim
(
message
.
ruleId
||
''
),
chalk
.
cyan
(
message
.
ruleId
||
''
),
];
];
});
});
...
...
This diff is collapsed.
Click to expand it.
packages/react-dev-utils/formatWebpackMessages.js
+
11
-
3
View file @
21349c54
...
@@ -86,9 +86,17 @@ function formatMessage(message, isError) {
...
@@ -86,9 +86,17 @@ function formatMessage(message, isError) {
);
);
}
}
// Prepend filename with an explanation.
// Make filename nicer.
lines
[
0
]
=
chalk
.
underline
(
lines
[
0
])
+
var
slashIndex
=
Math
.
max
(
(
isError
?
'
contains errors.
'
:
'
contains warnings.
'
);
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
+
11
-
6
View file @
21349c54
...
@@ -103,15 +103,20 @@ module.exports = function createWebpackCompiler(config, onReadyCallback) {
...
@@ -103,15 +103,20 @@ module.exports = function createWebpackCompiler(config, onReadyCallback) {
// Teach some ESLint tricks.
// Teach some ESLint tricks.
console
.
log
(
console
.
log
(
'
Search the
'
+
chalk
.
dim
(
chalk
.
dim
(
'
keywords
'
)
+
'
Search for the
'
+
'
from the right column to learn more.
'
chalk
.
cyan
(
'
rule keywords
'
)
+
'
to learn more about each warning.
'
)
);
);
console
.
log
(
console
.
log
(
'
To ignore, add
'
+
chalk
.
dim
(
chalk
.
yellow
(
'
// eslint-disable-next-line
'
)
+
'
To ignore, add
'
+
'
to the line before.
'
chalk
.
yellow
(
'
// eslint-disable-next-line
'
)
+
'
to the previous line.
'
)
);
);
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