UNPKG

@adguard/aglint

Version:

Universal adblock filter list linter.

70 lines (69 loc) 1.97 kB
import { type Struct } from 'superstruct'; /** * Represents the possible severities of a linter rule */ export declare const SEVERITY: Readonly<{ /** * Rule is disabled, nothing happens */ off: 0; /** * Rule is enabled, and throws a warning when violated. * * @example Bad practices, deprecated syntax, formatting issues, redundant rules, etc. */ warn: 1; /** * Rule is enabled, and throws an error when violated. * * @example Unknown scriptlets, unknown modifiers, etc. */ error: 2; /** * Rule is enabled, and throws a fatal error when violated. * * @example Syntax error (parsing error) */ fatal: 3; }>; /** * Names of the possible severities */ export declare const SEVERITY_NAMES: readonly string[]; /** * Values of the possible severities */ export declare const SEVERITY_VALUES: readonly (0 | 1 | 2 | 3)[]; /** * Type for the possible severity names */ export type SeverityName = keyof typeof SEVERITY; /** * Type for the possible severity values */ export type SeverityValue = typeof SEVERITY[SeverityName]; /** * Type for the possible severities */ export type AnySeverity = SeverityName | SeverityValue; /** * Always returns the severity value. Typically used to get the severity value from a string. * * @param value The value to get the severity value from * @returns The severity value */ export declare function getSeverity(value: AnySeverity): SeverityValue; /** * Checks whether the given value is a valid severity * * @param value The value to check * @returns Whether the value is a valid severity */ export declare function isSeverity(value: unknown): value is AnySeverity; /** * Superstruct type definition for the linter rule severity * * @returns Defined struct * @see {@link https://github.com/ianstormtaylor/superstruct/blob/main/src/structs/types.ts} */ export declare function severity(): Struct<AnySeverity, null>;