import { ConfigEnv, UserConfig as UserConfig$1, ViteUserConfigFn } from "vite-plus"; import "get-oxlint-rules"; import { DummyRuleMap, ExternalPluginEntry, OxlintConfig, OxlintEnv, OxlintGlobals, RuleCategories } from "vite-plus/lint"; //#region src/core/types.d.ts /** * One ESLint-style flat config object. * * Ignores-only objects become global ignore patterns. Other objects become overrides, * with root-only fields merged into the root config when no scope is set. */ type FlatConfigItem = ConfigFields & ScopeConstraint; type ScopeConstraint = Forbidden<'files' | 'basePath' | 'ignores'> | Forbidden<'settings' | 'options'>; /** Applies to every file and accepts Oxlint's root-only fields. */ type GlobalConfigItem = ConfigFields & Forbidden<'files' | 'basePath' | 'ignores'>; /** Requires files or a base directory; without files, matches every file inside basePath. */ type ScopedConfigItem = ConfigFields & Forbidden<'settings' | 'options'> & (Required> | Required>); /** Only ignore patterns and their metadata; adding rules makes an ordinary config instead. */ type GlobalIgnoresItem = Pick & Required> & Forbidden>; type ConfigInput = FlatConfigItem | ConfigInput[] | false | null | undefined; /** One entry of extends. Nested arrays let users pass a whole preset array as a single entry. */ type ExtendsInput = ExtendsItem | ExtendsInput[]; type ExtendsItem = Omit & ScopeConstraint & Forbidden<'extends' | 'basePath'>; type Forbidden = Partial>; /** Config fields before validating scope or expanding extends. */ interface ConfigFields { /** A label for this config object, used in error messages and config inspection. */ name?: string; /** Glob patterns this config applies to. */ files?: (string | string[])[]; /** Glob patterns excluded from this config, or ignored globally in an ignores-only item. */ ignores?: string[]; /** The directory files and ignores are relative to, resolved from the config file's directory. */ basePath?: string; /** Configs placed before this one, inheriting its file patterns, ignores and base directory. */ extends?: ExtendsInput[]; settings?: OxlintConfig['settings']; options?: OxlintConfig['options']; /** ESLint-compatible JS plugins. */ jsPlugins?: ExternalPluginEntry[]; rules?: DummyRuleMap; env?: OxlintEnv; globals?: OxlintGlobals; } //#endregion //#region src/core/build.d.ts type Plugins = NonNullable; //#endregion //#region src/category.d.ts interface CategorySelection extends RuleCategories { /** Only rules from these plugins are included. */ plugins: Plugins; } interface CategoryOptions { /** The name to give the output config object. */ name?: string; } interface ScopedCategoryOptions extends CategoryOptions { files: NonNullable; ignores?: string[]; } //#endregion //#region src/global-ignores.d.ts export declare function globalIgnores(ignorePatterns: string[], name?: string): Omit; //#endregion //#region src/ignore-file.d.ts export interface IncludeIgnoreFileOptions { /** The name to give the output config object(s). */ name?: string; } /** * Reads a gitignore-style file (e.g. `.gitignore`) and converts its patterns into a flat config object with `ignores`. * * For Oxlint, it automatically excludes files listed in `.gitignore` by default, so there is usually no need to specify them again. */ export declare function includeIgnoreFile(ignoreFilePath: string, options?: IncludeIgnoreFileOptions | string): Omit; export declare function includeIgnoreFile(ignoreFilePaths: string[], options?: IncludeIgnoreFileOptions | string): Omit[]; //#endregion //#region src/vite-plus.d.ts /** A Vite+ config whose `lint` block is written as flat config. */ export interface UserConfig extends Omit { lint?: ConfigInput; } export type UserConfigFn = (env: ConfigEnv) => UserConfig | Promise; export type UserConfigExport = UserConfig | Promise | UserConfigFn; type DefinedConfig = T extends UserConfigFn ? ViteUserConfigFn : T extends Promise ? Promise : UserConfig$1; /** * Vite+'s `defineConfig`, with the `lint` block written as flat config. * * Accepts the same object, promise and function forms as Vite+. */ export declare function defineConfig(config: T): DefinedConfig; /** * Turns Oxlint categories into a flat config object with an explicit rule for every rule in them. * * Unlike oxlint's `categories` field, the result follows flat config order: later config objects override it, and it overrides earlier ones. */ export declare const category: { (selection: CategorySelection, options: ScopedCategoryOptions): { name?: string; rules?: import("oxlint").DummyRuleMap; } & ScopedCategoryOptions; (selection: CategorySelection, options?: CategoryOptions): { name?: string; rules?: import("oxlint").DummyRuleMap; }; }; /** Correctness rules from Oxlint's default plugins, reported as errors. */ export declare const recommended: { name?: string; rules?: import("oxlint").DummyRuleMap; }; /** All built-in rules except nursery rules, matching Oxlint's `all` category. */ export declare const all: { name?: string; rules?: import("oxlint").DummyRuleMap; }; //#endregion export type { CategoryOptions, CategorySelection, ConfigInput, ExtendsInput, ExtendsItem, FlatConfigItem, GlobalConfigItem, GlobalIgnoresItem, ScopedCategoryOptions, ScopedConfigItem };