Commit 493e5a69 authored by Dan Abramov's avatar Dan Abramov Committed by GitHub
Browse files

Tweak lint rules (#2186)

parent e280254d
3 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file
Showing with 16 additions and 1 deletion
+16 -1
...@@ -235,6 +235,8 @@ module.exports = { ...@@ -235,6 +235,8 @@ module.exports = {
], ],
// https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules // https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
'import/first': 'error',
'import/no-amd': 'error',
'import/no-webpack-loader-syntax': 'error', 'import/no-webpack-loader-syntax': 'error',
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
......
...@@ -12,6 +12,7 @@ function isError(message) { ...@@ -12,6 +12,7 @@ function isError(message) {
function formatter(results) { function formatter(results) {
let output = '\n'; let output = '\n';
let hasErrors = false;
results.forEach(result => { results.forEach(result => {
let messages = result.messages; let messages = result.messages;
...@@ -19,7 +20,6 @@ function formatter(results) { ...@@ -19,7 +20,6 @@ function formatter(results) {
return; return;
} }
let hasErrors = false;
messages = messages.map(message => { messages = messages.map(message => {
let messageType; let messageType;
if (isError(message)) { if (isError(message)) {
...@@ -61,6 +61,19 @@ function formatter(results) { ...@@ -61,6 +61,19 @@ function formatter(results) {
output += `${outputTable}\n\n`; 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; return output;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment