UNPKG

@code-pushup/models

Version:

Model definitions and validators for the Code PushUp CLI

52 lines (51 loc) 1.74 kB
import type { CategoryConfig } from '../category-config.js'; import type { PluginConfig } from '../plugin-config.js'; import type { PluginReport } from '../report.js'; /** * Regular expression to validate a slug for categories, plugins and audits. * - audit (e.g. 'max-lines') * - category (e.g. 'performance') * Also validates ``and ` ` */ export declare const slugRegex: RegExp; /** * Regular expression to validate a filename. */ export declare const filenameRegex: RegExp; /** * helper function to validate string arrays * * @param strings */ export declare function hasDuplicateStrings(strings: string[]): string[] | false; /** * helper function to validate string arrays * * @param toCheck * @param existing */ export declare function hasMissingStrings(toCheck: string[], existing: string[]): string[] | false; export declare function formatSlugsList(slugs: string[]): string; /** * helper for error items */ export declare function errorItems(items: string[], transform?: (itemArr: string[]) => string): string; export declare function exists<T>(value: T): value is NonNullable<T>; /** * Get category references that do not point to any audit or group * @param categories * @param plugins * @returns Array of missing references. */ export declare function getMissingRefsForCategories(categories: CategoryConfig[] | undefined, plugins: PluginConfig[] | PluginReport[]): false | string[]; export declare function findMissingSlugsInCategoryRefs({ categories, plugins, }: { categories?: CategoryConfig[]; plugins: PluginConfig[] | PluginReport[]; }): false | { message: string; }; export declare function formatRef(ref: { type: 'audit' | 'group'; plugin: string; slug: string; }): string;