import { isNonEmptyArray } from '@sindresorhus/is'; import type { ValidationMessage } from '../types.ts'; import { type CheckBaseBranchesArgs, ConfigValidationTopic } from './types.ts'; /** * Only if type condition or context condition violated then errors array will be mutated to store metadata */ export function check({ resolvedRule, currentPath, baseBranchPatterns, }: CheckBaseBranchesArgs): ValidationMessage[] { const warnings: ValidationMessage[] = []; if ( Array.isArray(resolvedRule.matchBaseBranches) && !isNonEmptyArray(baseBranchPatterns) ) { warnings.push({ topic: ConfigValidationTopic.Error, message: `${currentPath}: You must configure baseBranchPatterns in order to use them inside matchBaseBranches.`, }); } return warnings; }