@accordproject/concerto-linter
Version:
Concerto Linter using Spectral rulesets
33 lines (32 loc) • 1.63 kB
TypeScript
interface options {
/** Path to a custom Spectral ruleset or 'default' to use the built-in ruleset */
ruleset?: string;
/** One or more namespaces to exclude from linting results */
excludeNamespaces?: string | string[];
}
interface lintResult {
/** Unique rule identifier (e.g. 'no-reserved-keywords') */
code: string;
/** Human-readable description of the violation */
message: string;
/** Severity level ('error' | 'warning' | 'info' | 'hint') */
severity: string;
/**
* JSONPath-style pointer as an array of keys/indices
* (e.g. ['declarations', 3])
*/
path: Array<string | number>;
/** Namespace where the violation occurred */
namespace: string;
}
/**
* Lints Concerto models using Spectral and Concerto rules.
* @param {string | object} model - The Concerto model to lint, either as a CTO string or a parsed AST object. Note: No external dependency resolution is performed.
* @param {options} [config] - Configuration options for customizing the linting process.
* @param {string} [config.ruleset] - Path to a custom Spectral ruleset file or 'default' to use the built-in ruleset.
* @param {string | string[]} [config.excludeNamespaces] - One or more namespaces to exclude from linting results (defaults to 'concerto.*' and 'org.accord.*').
* @returns {Promise<lintResult[]>} Promise resolving to an array of formatted linting results as a JSON object.
* @throws {Error} Throws an error if linting or model conversion fails.
*/
export declare function lintModel(model: string | object, config?: options): Promise<lintResult[]>;
export {};