jsii
Version:
[](https://cdk.dev) [](https://github.com/aws/jsii
55 lines • 2.58 kB
TypeScript
import { TypeScriptConfig, TypeScriptConfigValidationRuleSet } from '.';
import { RuleDescription, RuleSet, Violation } from './validator';
export declare class TypeScriptConfigValidator {
ruleSet: TypeScriptConfigValidationRuleSet;
private readonly validator;
private readonly compilerOptions;
constructor(ruleSet: TypeScriptConfigValidationRuleSet);
/**
* Validated the provided config against the set of rules.
*
* @throws when the config is invalid
*
* @param tsconfig the tsconfig to be validated, this MUST be a tsconfig as a user would have written it in tsconfig.
*/
validate(tsconfig: TypeScriptConfig): void;
}
/**
* Returns the `compilerOptions` rule set that backs the given validation setting.
*
* These are the substantive, set-specific rules (the top-level rules such as
* `files`/`include`/`exclude` are identical across all sets). The `off` rule set
* is empty, as it disables validation.
*
* @param ruleSet the validation setting to look up
* @returns the `RuleSet` applied to `compilerOptions`
*/
export declare function getCompilerOptionsRuleSet(ruleSet: TypeScriptConfigValidationRuleSet): RuleSet;
/**
* Produces a human-readable description of every `compilerOptions` rule in a rule set.
*
* @param ruleSet the validation setting to describe
* @returns a description for every rule in the set
*/
export declare function describeRuleSet(ruleSet: TypeScriptConfigValidationRuleSet): RuleDescription[];
/**
* Reads and parses a `tsconfig.json` file from disk into the format expected by
* the validator. This resolves `extends` and normalizes the options the same way
* the compiler does, so validation behaves identically to a real compilation.
*
* @param configPath the path to the tsconfig file to read
* @throws {@link JsiiError} if the file cannot be read or parsed
* @returns the parsed TypeScript configuration
*/
export declare function readTypeScriptConfig(configPath: string): TypeScriptConfig;
/**
* Reads a `tsconfig.json` file from disk and validates its `compilerOptions`
* against the given rule set, without running a compilation.
*
* @param configPath the path to the tsconfig file to validate
* @param ruleSet the rule set to validate against
* @throws {@link JsiiError} if the file cannot be read or parsed
* @returns the list of rule violations (empty if the config is valid)
*/
export declare function validateTypeScriptConfigFile(configPath: string, ruleSet: TypeScriptConfigValidationRuleSet): Violation[];
//# sourceMappingURL=tsconfig-validator.d.ts.map