feat(rules): load JSON rule files when using --rule-path
This commit is contained in:
parent
c9a42f3863
commit
5229ada847
|
@ -108,8 +108,8 @@ export async function loadRulePaths(paths: Array<string>, ctx: VisitorContext):
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
const allFiles = await readDir(path);
|
const allFiles = await readDir(path);
|
||||||
const files = allFiles.filter((name) => {
|
const files = allFiles.filter((name) => {
|
||||||
// skip files that start with `.`, limit to yml
|
// skip files that start with `.`, limit to json and yaml/yml
|
||||||
return name.match(/^[^\.].*\.ya?ml/);
|
return name.toLowerCase().match(/^[^\.].*\.(json|ya?ml)/);
|
||||||
}).map((name) => join(path, name));
|
}).map((name) => join(path, name));
|
||||||
|
|
||||||
const pathRules = await loadRuleFiles(files, ctx);
|
const pathRules = await loadRuleFiles(files, ctx);
|
||||||
|
|
Loading…
Reference in New Issue