Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions packages/eslint-config-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ module.exports = {
],

// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
'import/first': 'error',
'import/no-amd': 'error',
'import/no-webpack-loader-syntax': 'error',

// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
Expand Down
15 changes: 14 additions & 1 deletion packages/react-dev-utils/eslintFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ function isError(message) {

function formatter(results) {
let output = '\n';
let hasErrors = false;

results.forEach(result => {
let messages = result.messages;
if (messages.length === 0) {
return;
}

let hasErrors = false;
messages = messages.map(message => {
let messageType;
if (isError(message)) {
Expand Down Expand Up @@ -61,6 +61,19 @@ function formatter(results) {
output += `${outputTable}\n\n`;
});

if (hasErrors) {
// Unlike with warnings, we have to do it here.
// We have similar code in react-scripts for warnings,
// but warnings can appear in multiple files so we only
// print it once at the end. For errors, however, we print
// it here because we always show at most one error, and
// we can only be sure it's an ESLint error before exiting
// this function.
output += 'Search for the ' +
chalk.underline(chalk.red('rule keywords')) +
' to learn more about each error.';
}

return output;
}

Expand Down