gitea push

This commit is contained in:
2026-05-09 12:19:29 -06:00
parent 06113c95b8
commit 429461e985
1481 changed files with 74306 additions and 52475 deletions
+25
View File
@@ -160,6 +160,7 @@ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNam
private _operationsResolved;
private _renames;
private _renamesOptions;
private _defaultIgnores;
private _pluginsConflictsError;
constructor(...configs: ResolvableFlatConfig<T>[]);
/**
@@ -168,6 +169,30 @@ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNam
* This will runs after all config items are resolved. Applies to `plugins` and `rules`.
*/
renamePlugins(renames: Record<string, string>, options?: RenamePluginsInConfigsOptions): this;
/**
* Set default `ignores` globs for configs that have rules but no explicit
* scoping (`files` / `ignores` / `language`).
*
* The callback receives the composer's previously-accumulated globs and
* returns the new list, so calls compose:
*
* ```ts
* composer
* .setDefaultIgnores(() => ['**\/*.md'])
* .setDefaultIgnores(prev => [...prev, '**\/*.json'])
* ```
*
* Useful when mixing fundamentally different languages (e.g. JS + Markdown)
* and you want global rule configs to not "leak" into a foreign language
* whose `SourceCode` lacks JS-only methods.
*/
setDefaultIgnores(fn: (globs: string[]) => string[]): this;
/**
* Absorb another composer's accumulated state when it is appended/prepended/etc.
* into this one, so renames and default-ignores globs declared on the inner
* composer apply to the parent's other configs as well.
*/
private _absorbComposer;
/**
* Append configs to the end of the current configs array.
*/
+25
View File
@@ -160,6 +160,7 @@ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNam
private _operationsResolved;
private _renames;
private _renamesOptions;
private _defaultIgnores;
private _pluginsConflictsError;
constructor(...configs: ResolvableFlatConfig<T>[]);
/**
@@ -168,6 +169,30 @@ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNam
* This will runs after all config items are resolved. Applies to `plugins` and `rules`.
*/
renamePlugins(renames: Record<string, string>, options?: RenamePluginsInConfigsOptions): this;
/**
* Set default `ignores` globs for configs that have rules but no explicit
* scoping (`files` / `ignores` / `language`).
*
* The callback receives the composer's previously-accumulated globs and
* returns the new list, so calls compose:
*
* ```ts
* composer
* .setDefaultIgnores(() => ['**\/*.md'])
* .setDefaultIgnores(prev => [...prev, '**\/*.json'])
* ```
*
* Useful when mixing fundamentally different languages (e.g. JS + Markdown)
* and you want global rule configs to not "leak" into a foreign language
* whose `SourceCode` lacks JS-only methods.
*/
setDefaultIgnores(fn: (globs: string[]) => string[]): this;
/**
* Absorb another composer's accumulated state when it is appended/prepended/etc.
* into this one, so renames and default-ignores globs declared on the inner
* composer apply to the parent's other configs as well.
*/
private _absorbComposer;
/**
* Append configs to the end of the current configs array.
*/
+67
View File
@@ -186,6 +186,7 @@ class FlatConfigComposer extends Promise {
_operationsResolved = [];
_renames = {};
_renamesOptions;
_defaultIgnores = [];
_pluginsConflictsError = /* @__PURE__ */ new Map();
constructor(...configs) {
super(() => {
@@ -203,10 +204,46 @@ class FlatConfigComposer extends Promise {
this._renamesOptions = options;
return this;
}
/**
* Set default `ignores` globs for configs that have rules but no explicit
* scoping (`files` / `ignores` / `language`).
*
* The callback receives the composer's previously-accumulated globs and
* returns the new list, so calls compose:
*
* ```ts
* composer
* .setDefaultIgnores(() => ['**\/*.md'])
* .setDefaultIgnores(prev => [...prev, '**\/*.json'])
* ```
*
* Useful when mixing fundamentally different languages (e.g. JS + Markdown)
* and you want global rule configs to not "leak" into a foreign language
* whose `SourceCode` lacks JS-only methods.
*/
setDefaultIgnores(fn) {
this._defaultIgnores = fn(this._defaultIgnores);
return this;
}
/**
* Absorb another composer's accumulated state when it is appended/prepended/etc.
* into this one, so renames and default-ignores globs declared on the inner
* composer apply to the parent's other configs as well.
*/
_absorbComposer(other) {
this._renames = { ...other._renames, ...this._renames };
if (!this._renamesOptions && other._renamesOptions)
this._renamesOptions = other._renamesOptions;
this._defaultIgnores = [.../* @__PURE__ */ new Set([...this._defaultIgnores, ...other._defaultIgnores])];
}
/**
* Append configs to the end of the current configs array.
*/
append(...items) {
for (const item of items) {
if (item instanceof FlatConfigComposer)
this._absorbComposer(item);
}
const promise = Promise.all(items);
this._operations.push(async (configs) => {
const resolved = (await promise).flat().filter(Boolean);
@@ -218,6 +255,10 @@ class FlatConfigComposer extends Promise {
* Prepend configs to the beginning of the current configs array.
*/
prepend(...items) {
for (const item of items) {
if (item instanceof FlatConfigComposer)
this._absorbComposer(item);
}
const promise = Promise.all(items);
this._operations.push(async (configs) => {
const resolved = (await promise).flat().filter(Boolean);
@@ -229,6 +270,10 @@ class FlatConfigComposer extends Promise {
* Insert configs before a specific config.
*/
insertBefore(nameOrIndex, ...items) {
for (const item of items) {
if (item instanceof FlatConfigComposer)
this._absorbComposer(item);
}
const promise = Promise.all(items);
this._operations.push(async (configs) => {
const resolved = (await promise).flat().filter(Boolean);
@@ -242,6 +287,10 @@ class FlatConfigComposer extends Promise {
* Insert configs after a specific config.
*/
insertAfter(nameOrIndex, ...items) {
for (const item of items) {
if (item instanceof FlatConfigComposer)
this._absorbComposer(item);
}
const promise = Promise.all(items);
this._operations.push(async (configs) => {
const resolved = (await promise).flat().filter(Boolean);
@@ -410,6 +459,10 @@ class FlatConfigComposer extends Promise {
* The original config will be removed and replaced with the new one.
*/
replace(nameOrIndex, ...items) {
for (const item of items) {
if (item instanceof FlatConfigComposer)
this._absorbComposer(item);
}
const promise = Promise.all(items);
this._operations.push(async (configs) => {
const resolved = (await promise).flat().filter(Boolean);
@@ -523,6 +576,7 @@ ${errors.map((e, i) => ` ${i + 1}: ${e}`).join("\n")}`);
composer2._operationsResolved = this._operationsResolved.slice();
composer2._renames = { ...this._renames };
composer2._renamesOptions = this._renamesOptions;
composer2._defaultIgnores = this._defaultIgnores.slice();
composer2._pluginsConflictsError = new Map(this._pluginsConflictsError);
return composer2;
}
@@ -538,6 +592,19 @@ ${errors.map((e, i) => ` ${i + 1}: ${e}`).join("\n")}`);
for (const promise of this._operationsOverrides)
configs = await promise(configs);
configs = renamePluginsInConfigs(configs, this._renames, this._renamesOptions);
if (this._defaultIgnores.length) {
for (const config of configs) {
if (!config.rules || Object.keys(config.rules).length === 0)
continue;
if (config.files)
continue;
if (config.ignores)
continue;
if (config.language)
continue;
config.ignores = [...this._defaultIgnores];
}
}
for (const promise of this._operationsResolved)
configs = await promise(configs) || configs;
const resolved = defineConfig(configs);