eslint-rule-benchmark
Version:
Benchmark ESLint rules with detailed performance metrics for CI and plugin development
29 lines (28 loc) • 1.25 kB
TypeScript
import { UserBenchmarkConfig } from '../../types/user-benchmark-config'
/**
* Validates the user benchmark configuration according to the new structure,
* including global settings, individual test specifications (`testSpec`), and
* their nested test cases (`caseItem`).
*
* Checks for:
*
* - Presence of the `tests` array.
* - Validity of global and per-test `BaseBenchmarkSettings` (iterations, timeout,
* warmup).
* - Required properties for each `testSpec` (`name`, `ruleId`, `rulePath`,
* `cases` array).
* - Existence of `rulePath` file.
* - Required properties for each `caseItem` within `testSpec.cases` (`testPath`).
* - Existence of `testPath` files/directories.
* - Correct types and values for `severity` and `options` within `caseItem`.
*
* @param config - The user benchmark configuration object to validate.
* @param configDirectory - The absolute path to the directory containing the
* configuration file. Used for resolving relative paths.
* @returns A promise that resolves to an array of validation error messages. An
* empty array indicates a valid configuration.
*/
export declare function validateConfig(
config: Partial<UserBenchmarkConfig>,
configDirectory: string,
): Promise<string[]>