From a52951002bb8590c5efe009c4bb6237cf3cc1d36 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Sun, 5 Jan 2025 17:31:58 +0800 Subject: [PATCH] fix(core): should not match config if include is an empty array --- packages/core/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/index.ts b/packages/core/index.ts index 9c198e2..20112de 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -59,8 +59,8 @@ export function createLinter( >(); const configs = (Array.isArray(config) ? config : [config]) .map(config => ({ - include: config.include ?? [], - exclude: config.exclude ?? [], + include: config.include, + exclude: config.exclude, rules: config.rules ?? {}, formatting: config.formatting, plugins: (config.plugins ?? []).map(plugin => plugin(ctx)), @@ -470,10 +470,10 @@ export function createLinter( let result = fileConfigs.get(fileName); if (!result) { result = configs.filter(({ include, exclude }) => { - if (exclude.some(_minimatch)) { + if (exclude?.some(_minimatch)) { return false; } - if (include.length && !include.some(_minimatch)) { + if (include && !include.some(_minimatch)) { return false; } return true;