1
0
Fork 0

feat(rules): load JSON rule files when using --rule-path

This commit is contained in:
ssube 2019-11-02 09:44:12 -05:00 committed by Sean Sube
parent c9a42f3863
commit 5229ada847
1 changed files with 3 additions and 3 deletions

View File

@ -108,8 +108,8 @@ export async function loadRulePaths(paths: Array<string>, ctx: VisitorContext):
for (const path of paths) {
const allFiles = await readDir(path);
const files = allFiles.filter((name) => {
// skip files that start with `.`, limit to yml
return name.match(/^[^\.].*\.ya?ml/);
// skip files that start with `.`, limit to json and yaml/yml
return name.toLowerCase().match(/^[^\.].*\.(json|ya?ml)/);
}).map((name) => join(path, name));
const pathRules = await loadRuleFiles(files, ctx);
@ -209,7 +209,7 @@ export async function visitRules(ctx: VisitorContext, rules: Array<SchemaRule>,
} else {
ctx.logger.info({ rule: rule.name }, 'rule passed');
}
}
}
}
return ctx;