Skip to content

Commit bdb5210

Browse files
authored
Fix 44 again (#54)
* fix: keep reporting other file messages even if the current file is message free * fix: update test * fix: update test - don't look for filename
1 parent 4b8d4de commit bdb5210

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/linter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ export default function linter(options, compilation) {
7676

7777
await cleanup();
7878

79-
// do not analyze if there are no results or eslint config
80-
if (!results || results.length < 1) {
81-
return {};
82-
}
83-
8479
for (const result of results) {
8580
crossRunResultStorage[result.filePath] = result;
8681
}
8782

8883
results = Object.values(crossRunResultStorage);
8984

85+
// do not analyze if there are no results or eslint config
86+
if (!results || results.length < 1) {
87+
return {};
88+
}
89+
9090
const formatter = await loadFormatter(eslint, options.formatter);
9191
const { errors, warnings } = formatResults(
9292
formatter,

test/watch.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ describe('watch', () => {
103103
function finish(err, stats) {
104104
expect(err).toBeNull();
105105
expect(stats.hasWarnings()).toBe(false);
106-
expect(stats.hasErrors()).toBe(false);
106+
const { errors } = stats.compilation;
107+
const [{ message }] = errors;
108+
expect(stats.hasErrors()).toBe(true);
109+
expect(message).toEqual(expect.stringMatching('prefer-const'));
110+
expect(message).toEqual(expect.stringMatching('\\(2 errors,'));
107111
done();
108112
}
109113
});

0 commit comments

Comments
 (0)