From 5229ada847c8ddef8ca8adcd62f8e2ef75b0c7f4 Mon Sep 17 00:00:00 2001 From: ssube Date: Sat, 2 Nov 2019 09:44:12 -0500 Subject: [PATCH] feat(rules): load JSON rule files when using --rule-path --- src/rule/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rule/index.ts b/src/rule/index.ts index ffc4292..1c9dbee 100644 --- a/src/rule/index.ts +++ b/src/rule/index.ts @@ -108,8 +108,8 @@ export async function loadRulePaths(paths: Array, 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, } else { ctx.logger.info({ rule: rule.name }, 'rule passed'); } - } + } } return ctx;