-
Notifications
You must be signed in to change notification settings - Fork 8
/
yui-lint.js
39 lines (33 loc) · 1.04 KB
/
yui-lint.js
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
var fs = require('fs');
var path = require('path');
var preferred = JSON.parse(fs.readFileSync(path.join(__dirname, 'jshint.json'), 'utf8'));
/*
Potenials: (Ones we may use after investigation)
"regexdash": true, //suppresses warnings about unescaped - in the end of regular expressions.
*/
/*
The filter method will filter the JSHint messages that we do not agree with.
These are usually things that our build system stamps but JSHint still
reports an error on
*/
var filter = function (messages) {
'use strict';
messages = messages || [];
return messages.filter(function (item) {
if (!item) {
return false;
}
if (/is defined but never used/.test(item.reason)) {
if (/YUI\.add/.test(item.evidence) || /'Y' is defined/.test(item.evidence)) {
return false;
}
}
return true;
});
};
exports.preferred = preferred;
exports.optional = preferred;
exports.defaults = preferred;
exports.special = preferred;
exports.strict = preferred;
exports.filter = filter;