Add MD004 with tests, support disabling rules.

This commit is contained in:
David Anson 2015-03-01 22:56:52 -08:00
parent d2e38c1646
commit 2da9462e45
13 changed files with 201 additions and 7 deletions

View file

@ -24,12 +24,14 @@ function lintFile(file, config, callback) {
var result = {};
rules.forEach(function forRule(rule) {
var ruleConfig = config[rule.name];
params.options = (ruleConfig instanceof Object) ? ruleConfig : {};
var errors = [];
rule.func(params, errors);
if (errors.length) {
errors.sort(numberComparison);
result[rule.name] = errors.filter(uniqueFilterForSorted);
if ((ruleConfig === undefined) || ruleConfig) {
params.options = (ruleConfig instanceof Object) ? ruleConfig : {};
var errors = [];
rule.func(params, errors);
if (errors.length) {
errors.sort(numberComparison);
result[rule.name] = errors.filter(uniqueFilterForSorted);
}
}
});
callback(null, result);