mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
3ff2e0e6fa
The generated config reference only described the JSON schema's `string[]` form. Clarify that `oxlint.config.ts` accepts imported `OxlintConfig[]`, add an example and public JSDoc, and regenerate the derived artifacts. Closes #20238. Validated with the website generator suite, targeted TypeScript checks, and the relevant Oxlint tests. The full `just ready` run reached an unrelated parallel suppression-fixture cleanup race; the failing test passes in isolation. AI-assisted.
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
/*
|
|
* `defineConfig` helper and config types.
|
|
*
|
|
* Types are generated from npm/oxlint/configuration_schema.json.
|
|
*/
|
|
|
|
import type {
|
|
AllowWarnDeny,
|
|
DummyRule,
|
|
DummyRuleMap,
|
|
ExternalPluginEntry,
|
|
Oxlintrc as FullOxlintrc,
|
|
OxlintEnv,
|
|
OxlintGlobals,
|
|
OxlintOverride,
|
|
RuleCategories,
|
|
} from "./config.generated.ts";
|
|
|
|
type Oxlintrc = Omit<FullOxlintrc, "$schema" | "extends">;
|
|
|
|
export type {
|
|
AllowWarnDeny,
|
|
DummyRule,
|
|
DummyRuleMap,
|
|
RuleCategories,
|
|
OxlintGlobals,
|
|
OxlintEnv,
|
|
ExternalPluginEntry,
|
|
};
|
|
|
|
export type ExternalPluginsConfig = Exclude<Oxlintrc["jsPlugins"], undefined | null>;
|
|
|
|
export interface OxlintConfig extends Oxlintrc {
|
|
/**
|
|
* Configuration objects to extend.
|
|
*
|
|
* Import configurations and pass them directly instead of using file paths.
|
|
*/
|
|
extends?: OxlintConfig[];
|
|
}
|
|
|
|
export type { OxlintOverride };
|
|
|
|
/**
|
|
* Define an Oxlint configuration with type inference.
|
|
*
|
|
* @param config - Oxlint configuration
|
|
* @returns Config unchanged
|
|
*/
|
|
export function defineConfig<T extends OxlintConfig>(config: T & OxlintConfig): T {
|
|
return config;
|
|
}
|