non_error.js
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"use strict";
module.exports = {
reporter: function(results, data, opts) {
var len = results.length,
str = '',
file, error, globals, unuseds;
results.forEach(function(result) {
file = result.file;
error = result.error;
str += file + ': line ' + error.line + ', col ' +
error.character + ', ' + error.reason;
// Add the error code if the --verbose option is set
if (opts.verbose) {
str += ' (' + error.code + ')';
}
str += '\n';
});
str += len > 0 ? ("\n" + len + ' error' + ((len === 1) ? '' : 's')) : "";
data.forEach(function(data) {
file = data.file;
globals = data.implieds;
unuseds = data.unused;
if (globals || unuseds) {
str += '\n\n' + file + ' :\n';
}
if (globals) {
str += '\tImplied globals:\n';
globals.forEach(function(global) {
str += '\t\t' + global.name + ': ' + global.line + '\n';
});
}
if (unuseds) {
str += '\tUnused Variables:\n\t\t';
unuseds.forEach(function(unused) {
str += unused.name + '(' + unused.line + '), ';
});
}
});
if (str) {
console.log(str + "\n");
}
}
};