Skip to content

Commit

Permalink
fix(core): should not match config if include is an empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 5, 2025
1 parent 563035c commit a529510
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a529510

Please sign in to comment.