UNPKG

@slippy-lint/slippy

Version:

A simple but powerful linter for Solidity

42 lines (41 loc) 1.87 kB
import { z } from "zod"; import { Severity } from "./rules/types.js"; export type EffectiveConfig = Pick<ResolvedConfigObject, "rules">; export interface ConfigLoader { loadConfig(filePath: string): EffectiveConfig; } export type ResolvedRuleConfig = [Severity, ...any[]]; declare const UserConfigSchema: z.ZodType<{ rules?: Record<string, "error" | "warn" | "off" | ["error" | "warn" | "off", any?]> | undefined; files?: string[] | undefined; ignores?: string[] | undefined; } | { rules?: Record<string, "error" | "warn" | "off" | ["error" | "warn" | "off", any?]> | undefined; files?: string[] | undefined; ignores?: string[] | undefined; }[], unknown, z.core.$ZodTypeInternals<{ rules?: Record<string, "error" | "warn" | "off" | ["error" | "warn" | "off", any?]> | undefined; files?: string[] | undefined; ignores?: string[] | undefined; } | { rules?: Record<string, "error" | "warn" | "off" | ["error" | "warn" | "off", any?]> | undefined; files?: string[] | undefined; ignores?: string[] | undefined; }[], unknown>>; export type UserConfig = z.infer<typeof UserConfigSchema>; type ResolvedConfigObject = { rules: Record<string, ResolvedRuleConfig>; files: string[]; ignores: string[]; }; export declare function createConfigLoader(configPath: string): Promise<ConfigLoader>; export declare class BasicConfigLoader implements ConfigLoader { private config; private constructor(); static create(userConfig: UserConfig): BasicConfigLoader; loadConfig(filePath: string): EffectiveConfig; } export declare function validateUserConfig(userConfig: unknown, slippyConfigPath: string): asserts userConfig is UserConfig; export declare function tryFindSlippyConfigPath(cwd: string): Promise<string | undefined>; export declare function findSlippyConfigPath(cwd: string): Promise<string>; export {};