@adguard/aglint
Version:
Universal adblock filter list linter.
101 lines (100 loc) • 4.13 kB
TypeScript
/**
* Linter configuration
*/
import { type LinterConfig } from './common';
/**
* Superstruct schema for the linter rules config object
*/
export declare const linterRulesSchema: import("superstruct").Struct<Record<string, import("./severity").AnySeverity | import("./common").LinterRuleConfigArray> | undefined, null>;
/**
* Superstruct schema for the linter config object properties. It is necessary to
* separate this from the schema for the whole config object because we reuse it
* in the CLI config object.
*/
export declare const linterConfigPropsSchema: {
root: import("superstruct").Struct<boolean | undefined, null>;
extends: import("superstruct").Struct<string[] | undefined, import("superstruct").Struct<string, null>>;
allowInlineConfig: import("superstruct").Struct<boolean | undefined, null>;
syntax: import("superstruct").Struct<("Common" | "AdblockPlus" | "UblockOrigin" | "AdGuard")[] | undefined, import("superstruct").Struct<"Common" | "AdblockPlus" | "UblockOrigin" | "AdGuard", {
Common: "Common";
AdblockPlus: "AdblockPlus";
UblockOrigin: "UblockOrigin";
AdGuard: "AdGuard";
}>>;
rules: import("superstruct").Struct<Record<string, import("./severity").AnySeverity | import("./common").LinterRuleConfigArray> | undefined, null>;
};
/**
* Superstruct schema for the linter rule config (used for validation)
*/
export declare const linterConfigSchema: import("superstruct").Struct<{
root?: boolean | undefined;
extends?: string[] | undefined;
allowInlineConfig?: boolean | undefined;
syntax?: ("Common" | "AdblockPlus" | "UblockOrigin" | "AdGuard")[] | undefined;
rules?: Record<string, import("./severity").AnySeverity | import("./common").LinterRuleConfigArray> | undefined;
}, {
root: import("superstruct").Struct<boolean | undefined, null>;
extends: import("superstruct").Struct<string[] | undefined, import("superstruct").Struct<string, null>>;
allowInlineConfig: import("superstruct").Struct<boolean | undefined, null>;
syntax: import("superstruct").Struct<("Common" | "AdblockPlus" | "UblockOrigin" | "AdGuard")[] | undefined, import("superstruct").Struct<"Common" | "AdblockPlus" | "UblockOrigin" | "AdGuard", {
Common: "Common";
AdblockPlus: "AdblockPlus";
UblockOrigin: "UblockOrigin";
AdGuard: "AdGuard";
}>>;
rules: import("superstruct").Struct<Record<string, import("./severity").AnySeverity | import("./common").LinterRuleConfigArray> | undefined, null>;
}>;
/**
* Default linter configuration
*/
export declare const defaultLinterConfig: LinterConfig;
/**
* Merges two configuration objects using deepmerge. Practically, this means that
* the `extend` object will be merged into the `initial` object.
*
* @param initial The initial config object
* @param extend The config object to extend the initial config with
* @returns The merged config object
* @example
* If you have the following config (called `initial` parameter):
* ```json
* {
* "syntax": ["Common"],
* "rules": {
* "rule1": "error",
* "rule2": "warn"
* }
* }
* ```
* And you want to extend it with the following config (called `extend` parameter):
* ```json
* {
* "syntax": ["AdGuard"],
* "rules": {
* "rule2": "off",
* },
* }
* ```
* The result will be:
* ```json
* {
* "syntax": ["AdGuard"],
* "rules": {
* "rule1": "error",
* "rule2": "off"
* }
* }
* ```
*/
export declare function mergeConfigs(initial: LinterConfig, extend: Partial<LinterConfig>): LinterConfig;
/**
* Merges two configuration objects using deepmerge.merge().
* Practically, this means that the `extend` object will be merged into the `initial` object.
*
* It is very similar to {@link mergeConfigs|mergeConfigs()} function, but the order of parameters is reversed.
*
* @param extend The config object to extend the initial config with
* @param initial The initial config object
* @returns The merged config object
*/
export declare function mergeConfigsReverse(extend: Partial<LinterConfig>, initial: LinterConfig): LinterConfig;