Add MD001 with test, refactor to remove common code.

This commit is contained in:
David Anson 2015-02-25 18:19:36 -08:00
parent 82caaa9407
commit 75b63a43ab
3 changed files with 43 additions and 19 deletions

View file

@ -21,7 +21,8 @@ function lintFile(file, options, callback) {
var lines = contents.split(/\r\n|\r|\n/g);
var result = {};
rules.forEach(function forRule(rule) {
var errors = rule.func(tokens, lines);
var errors = [];
rule.func(errors, tokens, lines);
if (errors.length) {
errors.sort(numberComparison);
result[rule.name] = errors.filter(uniqueFilterForSorted);