import { FlatGitignoreOptions } from "eslint-config-flat-gitignore"; import { EslintRules, FlatESLintConfigItem, ImportRules, MergeIntersection, NRules, ReactHooksRules, ReactRules, RuleConfig, TypeScriptRules, UnicornRules, VueRules } from "@antfu/eslint-define-config"; import { BuiltInParserName, LiteralUnion, RequiredOptions } from "prettier"; //#region src/types/rule.d.ts type PrettierCustomParser = 'astro' | 'svelte' | 'jsdoc-parser' | 'toml'; type PrettierParser = BuiltInParserName | PrettierCustomParser; interface PrettierOptions extends RequiredOptions { parser: LiteralUnion; } type PartialPrettierExtendedOptions = Partial; type WrapRuleConfig = { [K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig }; type EslintFlatRules = WrapRuleConfig>; type FlatConfigItem = Omit, 'plugins'> & { plugins?: Record; }; type RuleBaseOptions> = T & { /** The glob patterns to lint */ files?: string[]; }; type RequiredRuleBaseOptions = Required; type OnDemandRuleKey = 'vue' | 'react' | 'react-native' | 'solid' | 'svelte' | 'astro'; type VueOptions = RuleBaseOptions<{ /** * The vue version * * @default 3 */ version?: 2 | 3; }>; type RequiredVueOptions = Required; type OnDemandRuleOptions = Partial, RuleBaseOptions | boolean>>; type RequiredOnDemandRuleOptions = Record, RequiredRuleBaseOptions>; //#endregion //#region src/types/index.d.ts type Awaitable = T | Promise; interface BaseOptions { /** * The current working directory * * @default process.cwd() */ cwd: string; /** The globs to ignore lint */ ignores: string[]; /** * Enable gitignore support. * * Passing an object to configure the options. * * @default true * @see https://github.com/antfu/eslint-config-flat-gitignore */ gitignore?: boolean | FlatGitignoreOptions; /** The override rules */ overrides: Record; /** * Default prettier rules * * @default * ```json * { * "printWidth": 120, * "singleQuote": true, * "trailingComma": "none", * "arrowParens": "avoid", * "htmlWhitespaceSensitivity": "ignore" * } * ``` */ prettierRules: PartialPrettierExtendedOptions; /** * Whether to use prettierrc * * If true, the rules in prettierrc will override the default rules * * @default true */ usePrettierrc: boolean; /** * @default * { * "html": true, * "css": true, * "json": true, * } */ formatter: { html?: boolean; css?: boolean; json?: boolean; markdown?: boolean; yaml?: boolean; toml?: boolean; }; } type Options = Partial & { vue?: VueOptions | boolean; } & OnDemandRuleOptions & { unocss?: boolean; }; type ParsedOptions = BaseOptions & { vue?: RequiredVueOptions; } & Partial & { unocss?: boolean; }; //#endregion //#region src/index.d.ts declare function defineConfig(options?: Partial, ...userConfigs: Awaitable[]): Promise; //#endregion export { Awaitable, BaseOptions, type FlatConfigItem, type OnDemandRuleKey, Options, ParsedOptions, type PartialPrettierExtendedOptions, type PrettierParser, type RequiredOnDemandRuleOptions, type RequiredRuleBaseOptions, type RequiredVueOptions, defineConfig };