@kcws/lintstaged-config
Version:
kamontat's lintstaged config
141 lines • 3.67 kB
TypeScript
import type { ConfigCondition, IConfigValue, IConfigBuilder, IConfig } from "./IConfig";
import { type DefaultKey, type CustomDefaultConfig } from "../constants/default";
/**
* Config builder. This class should not be created manually.
* Use {@link Config.builder} or {@link Config.default} instead.
*
* @public
*/
declare class Builder<K extends string> implements IConfigBuilder {
private _result;
private _settings;
/**
* Do not use this constructor directly.
* Use {@link Config.builder} or {@link Config.default} instead.
*/
constructor();
/**
* enable debug mode when loading configuration
*
* @returns this object
*
* @public
*/
debugMode(): this;
/**
* append default actions to current builder
*
* @returns this object
*
* @public
*/
default(custom?: CustomDefaultConfig): Builder<K | DefaultKey>;
/**
* append value to list of regex or actions if needed.
* If input key never created yet,
* it will create with input value
*
* @param key - group key
* @param value - config value associate with input key
* @returns this object
*
* @public
*/
append<EK extends string>(key: EK, value: Partial<Exclude<IConfigValue, "actionFn">>): Builder<K | EK>;
/**
* add new config group to current configuration
*
* @param key - group key
* @param value - config value associate with input key
* @returns this object
*
* @public
*/
set<EK extends string>(key: EK, value: Partial<IConfigValue>): Builder<K | EK>;
/**
* build Config with current builder
*
* @returns this object
*
* @public
*/
build(): Config<K>;
/**
* delete group by key
*
* @param key - group key
* @returns this object
*
* @public
*/
delete<EK extends K>(key: EK): Builder<Exclude<K, EK>>;
private _fillValue;
private _mergeValue;
}
/**
* Configuration object to generate list of command
* needed for specify values on {@link ConfigCondition}
*
* @public
*/
export declare class Config<K extends string> implements IConfigBuilder, IConfig {
/**
* create config builder with empty value.
*
* @returns config builder
*
* @public
*/
static builder<K extends string = "">(): Builder<K>;
/**
* create config builder with default group predefined.
*
* @returns config builder
*/
static default(): Builder<DefaultKey>;
private _config;
private _settings;
constructor(config: Map<K, IConfigValue>, settings: Map<string, string>);
/**
* length of configuration.
*
* @remarks
* This can be check to ensure
* we setting config object correctly
*
* @public
*/
get length(): number;
/**
* is debug mode enabled?
*/
private get _isDebug();
/**
* {@inheritDoc IConfig.getCommands}
* @override
*/
getCommands(condition: ConfigCondition): Promise<Array<string>>;
/**
* Empty implementation as Config already IConfig,
* so we can just return itself.
*
* @returns this object
* @override
*
* @public
*/
build(): this;
/**
* Compare current config with another config.
* This function WILL ignore all function from comparison
*
* @param c - another config
* @returns true if this config is equal to other config
*
* @beta
*/
compare(c: Config<string>): boolean;
private _resolveAction;
}
export type { Builder };
//# sourceMappingURL=Config.d.ts.map