Skip to content

Commit c27fb1e

Browse files
gaearonromaindso
authored andcommitted
Tweak lint rules (facebook#2186)
1 parent 3e0bdba commit c27fb1e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/eslint-config-react-app/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ module.exports = {
235235
],
236236

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

240242
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules

packages/react-dev-utils/eslintFormatter.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ function isError(message) {
1212

1313
function formatter(results) {
1414
let output = '\n';
15+
let hasErrors = false;
1516

1617
results.forEach(result => {
1718
let messages = result.messages;
1819
if (messages.length === 0) {
1920
return;
2021
}
2122

22-
let hasErrors = false;
2323
messages = messages.map(message => {
2424
let messageType;
2525
if (isError(message)) {
@@ -61,6 +61,19 @@ function formatter(results) {
6161
output += `${outputTable}\n\n`;
6262
});
6363

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

0 commit comments

Comments
 (0)