Update Bot

This commit is contained in:
2026-03-15 11:58:43 +01:00
parent b67c111ffc
commit cd99275933
560 changed files with 23173 additions and 55113 deletions

View File

@@ -9,17 +9,15 @@
// Type Definitions
//-----------------------------------------------------------------------------
/** @import * as $eslintcore from "@eslint/core"; */
/** @typedef {$eslintcore.ConfigObject} Config */
/** @typedef {$eslintcore.LegacyConfigObject} LegacyConfig */
/** @typedef {$eslintcore.Plugin} Plugin */
/** @typedef {$eslintcore.RuleConfig} RuleConfig */
/** @import * as $typests from "./types.ts"; */
/** @typedef {$typests.ExtendsElement} ExtendsElement */
/** @typedef {$typests.SimpleExtendsElement} SimpleExtendsElement */
/** @typedef {$typests.ConfigWithExtends} ConfigWithExtends */
/** @typedef {$typests.InfiniteArray<Config>} InfiniteConfigArray */
/** @typedef {$typests.ConfigWithExtendsArray} ConfigWithExtendsArray */
/** @typedef {import("eslint").Linter.Config} Config */
/** @typedef {import("eslint").Linter.LegacyConfig} LegacyConfig */
/** @typedef {import("eslint").ESLint.Plugin} Plugin */
/** @typedef {import("eslint").Linter.RuleEntry} RuleEntry */
/** @typedef {import("./types.ts").ExtendsElement} ExtendsElement */
/** @typedef {import("./types.ts").SimpleExtendsElement} SimpleExtendsElement */
/** @typedef {import("./types.ts").ConfigWithExtends} ConfigWithExtends */
/** @typedef {import("./types.ts").InfiniteArray<Config>} InfiniteConfigArray */
/** @typedef {import("./types.ts").ConfigWithExtendsArray} ConfigWithExtendsArray */
//-----------------------------------------------------------------------------
// Helpers
@@ -78,11 +76,6 @@ function getExtensionName(extension, indexPath) {
* @return {config is LegacyConfig} `true` if the config object is a legacy config.
*/
function isLegacyConfig(config) {
// eslintrc's plugins must be an array; while flat config's must be an object.
if (Array.isArray(config.plugins)) {
return true;
}
for (const key of eslintrcKeys) {
if (key in config) {
return true;
@@ -162,7 +155,7 @@ function normalizePluginConfig(userNamespace, plugin, config) {
if (result.rules) {
const ruleIds = Object.keys(result.rules);
/** @type {Record<string,RuleConfig|undefined>} */
/** @type {Record<string,RuleEntry|undefined>} */
const newRules = {};
for (let i = 0; i < ruleIds.length; i++) {
@@ -260,8 +253,6 @@ function findPluginConfig(config, pluginConfigName) {
}
const directConfig = plugin.configs?.[configName];
// Prefer direct config, but fall back to flat config if available
if (directConfig) {
// Arrays are always flat configs, and non-legacy configs can be used directly
if (Array.isArray(directConfig) || !isLegacyConfig(directConfig)) {
@@ -272,28 +263,30 @@ function findPluginConfig(config, pluginConfigName) {
pluginConfigName,
);
}
}
// If it's a legacy config, or the config does not exist => look for the flat version
const flatConfig = plugin.configs?.[`flat/${configName}`];
if (
flatConfig &&
(Array.isArray(flatConfig) || !isLegacyConfig(flatConfig))
) {
return deepNormalizePluginConfig(
userPluginNamespace,
plugin,
flatConfig,
pluginConfigName,
// If it's a legacy config, look for the flat version
const flatConfig = plugin.configs?.[`flat/${configName}`];
if (
flatConfig &&
(Array.isArray(flatConfig) || !isLegacyConfig(flatConfig))
) {
return deepNormalizePluginConfig(
userPluginNamespace,
plugin,
flatConfig,
pluginConfigName,
);
}
throw new TypeError(
`Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`,
);
}
// If we get here, then the config was either not found or is a legacy config
const message =
directConfig || flatConfig
? `Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`
: `Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`;
throw new TypeError(message);
throw new TypeError(
`Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`,
);
}
/**

View File

@@ -1,12 +1,12 @@
export type Config = $eslintcore.ConfigObject;
export type LegacyConfig = $eslintcore.LegacyConfigObject;
export type Plugin = $eslintcore.Plugin;
export type RuleConfig = $eslintcore.RuleConfig;
export type ExtendsElement = $typests.ExtendsElement;
export type SimpleExtendsElement = $typests.SimpleExtendsElement;
export type ConfigWithExtends = $typests.ConfigWithExtends;
export type InfiniteConfigArray = $typests.InfiniteArray<Config>;
export type ConfigWithExtendsArray = $typests.ConfigWithExtendsArray;
export type Config = import("eslint").Linter.Config;
export type LegacyConfig = import("eslint").Linter.LegacyConfig;
export type Plugin = import("eslint").ESLint.Plugin;
export type RuleEntry = import("eslint").Linter.RuleEntry;
export type ExtendsElement = import("./types.cts").ExtendsElement;
export type SimpleExtendsElement = import("./types.cts").SimpleExtendsElement;
export type ConfigWithExtends = import("./types.cts").ConfigWithExtends;
export type InfiniteConfigArray = import("./types.cts").InfiniteArray<Config>;
export type ConfigWithExtendsArray = import("./types.cts").ConfigWithExtendsArray;
/**
* Helper function to define a config array.
* @param {ConfigWithExtendsArray} args The arguments to the function.
@@ -22,5 +22,3 @@ export function defineConfig(...args: ConfigWithExtendsArray): Config[];
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
*/
export function globalIgnores(ignorePatterns: string[], name?: string): Config;
import type * as $eslintcore from "@eslint/core";
import type * as $typests from "./types.cts";

View File

@@ -2,7 +2,7 @@
* @fileoverview Types for this package.
*/
import type { ConfigObject } from "@eslint/core";
import type { Linter } from "eslint";
/**
* Infinite array type.
@@ -12,17 +12,19 @@ export type InfiniteArray<T> = T | InfiniteArray<T>[];
/**
* The type of array element in the `extends` property after flattening.
*/
export type SimpleExtendsElement = string | ConfigObject;
export type SimpleExtendsElement = string | Linter.Config;
/**
* The type of array element in the `extends` property before flattening.
*/
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<ConfigObject>;
export type ExtendsElement =
| SimpleExtendsElement
| InfiniteArray<Linter.Config>;
/**
* Config with extends. Valid only inside of `defineConfig()`.
*/
export interface ConfigWithExtends extends ConfigObject {
export interface ConfigWithExtends extends Linter.Config {
extends?: ExtendsElement[];
}

View File

@@ -1,12 +1,12 @@
export type Config = $eslintcore.ConfigObject;
export type LegacyConfig = $eslintcore.LegacyConfigObject;
export type Plugin = $eslintcore.Plugin;
export type RuleConfig = $eslintcore.RuleConfig;
export type ExtendsElement = $typests.ExtendsElement;
export type SimpleExtendsElement = $typests.SimpleExtendsElement;
export type ConfigWithExtends = $typests.ConfigWithExtends;
export type InfiniteConfigArray = $typests.InfiniteArray<Config>;
export type ConfigWithExtendsArray = $typests.ConfigWithExtendsArray;
export type Config = import("eslint").Linter.Config;
export type LegacyConfig = import("eslint").Linter.LegacyConfig;
export type Plugin = import("eslint").ESLint.Plugin;
export type RuleEntry = import("eslint").Linter.RuleEntry;
export type ExtendsElement = import("./types.ts").ExtendsElement;
export type SimpleExtendsElement = import("./types.ts").SimpleExtendsElement;
export type ConfigWithExtends = import("./types.ts").ConfigWithExtends;
export type InfiniteConfigArray = import("./types.ts").InfiniteArray<Config>;
export type ConfigWithExtendsArray = import("./types.ts").ConfigWithExtendsArray;
/**
* Helper function to define a config array.
* @param {ConfigWithExtendsArray} args The arguments to the function.
@@ -22,5 +22,3 @@ export function defineConfig(...args: ConfigWithExtendsArray): Config[];
* @throws {TypeError} If ignorePatterns is not an array or if it is empty.
*/
export function globalIgnores(ignorePatterns: string[], name?: string): Config;
import type * as $eslintcore from "@eslint/core";
import type * as $typests from "./types.ts";

View File

@@ -8,17 +8,15 @@
// Type Definitions
//-----------------------------------------------------------------------------
/** @import * as $eslintcore from "@eslint/core"; */
/** @typedef {$eslintcore.ConfigObject} Config */
/** @typedef {$eslintcore.LegacyConfigObject} LegacyConfig */
/** @typedef {$eslintcore.Plugin} Plugin */
/** @typedef {$eslintcore.RuleConfig} RuleConfig */
/** @import * as $typests from "./types.ts"; */
/** @typedef {$typests.ExtendsElement} ExtendsElement */
/** @typedef {$typests.SimpleExtendsElement} SimpleExtendsElement */
/** @typedef {$typests.ConfigWithExtends} ConfigWithExtends */
/** @typedef {$typests.InfiniteArray<Config>} InfiniteConfigArray */
/** @typedef {$typests.ConfigWithExtendsArray} ConfigWithExtendsArray */
/** @typedef {import("eslint").Linter.Config} Config */
/** @typedef {import("eslint").Linter.LegacyConfig} LegacyConfig */
/** @typedef {import("eslint").ESLint.Plugin} Plugin */
/** @typedef {import("eslint").Linter.RuleEntry} RuleEntry */
/** @typedef {import("./types.ts").ExtendsElement} ExtendsElement */
/** @typedef {import("./types.ts").SimpleExtendsElement} SimpleExtendsElement */
/** @typedef {import("./types.ts").ConfigWithExtends} ConfigWithExtends */
/** @typedef {import("./types.ts").InfiniteArray<Config>} InfiniteConfigArray */
/** @typedef {import("./types.ts").ConfigWithExtendsArray} ConfigWithExtendsArray */
//-----------------------------------------------------------------------------
// Helpers
@@ -77,11 +75,6 @@ function getExtensionName(extension, indexPath) {
* @return {config is LegacyConfig} `true` if the config object is a legacy config.
*/
function isLegacyConfig(config) {
// eslintrc's plugins must be an array; while flat config's must be an object.
if (Array.isArray(config.plugins)) {
return true;
}
for (const key of eslintrcKeys) {
if (key in config) {
return true;
@@ -161,7 +154,7 @@ function normalizePluginConfig(userNamespace, plugin, config) {
if (result.rules) {
const ruleIds = Object.keys(result.rules);
/** @type {Record<string,RuleConfig|undefined>} */
/** @type {Record<string,RuleEntry|undefined>} */
const newRules = {};
for (let i = 0; i < ruleIds.length; i++) {
@@ -259,8 +252,6 @@ function findPluginConfig(config, pluginConfigName) {
}
const directConfig = plugin.configs?.[configName];
// Prefer direct config, but fall back to flat config if available
if (directConfig) {
// Arrays are always flat configs, and non-legacy configs can be used directly
if (Array.isArray(directConfig) || !isLegacyConfig(directConfig)) {
@@ -271,28 +262,30 @@ function findPluginConfig(config, pluginConfigName) {
pluginConfigName,
);
}
}
// If it's a legacy config, or the config does not exist => look for the flat version
const flatConfig = plugin.configs?.[`flat/${configName}`];
if (
flatConfig &&
(Array.isArray(flatConfig) || !isLegacyConfig(flatConfig))
) {
return deepNormalizePluginConfig(
userPluginNamespace,
plugin,
flatConfig,
pluginConfigName,
// If it's a legacy config, look for the flat version
const flatConfig = plugin.configs?.[`flat/${configName}`];
if (
flatConfig &&
(Array.isArray(flatConfig) || !isLegacyConfig(flatConfig))
) {
return deepNormalizePluginConfig(
userPluginNamespace,
plugin,
flatConfig,
pluginConfigName,
);
}
throw new TypeError(
`Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`,
);
}
// If we get here, then the config was either not found or is a legacy config
const message =
directConfig || flatConfig
? `Plugin config "${configName}" in plugin "${userPluginNamespace}" is an eslintrc config and cannot be used in this context.`
: `Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`;
throw new TypeError(message);
throw new TypeError(
`Plugin config "${configName}" not found in plugin "${userPluginNamespace}".`,
);
}
/**

View File

@@ -1,7 +1,7 @@
/**
* @fileoverview Types for this package.
*/
import type { ConfigObject } from "@eslint/core";
import type { Linter } from "eslint";
/**
* Infinite array type.
*/
@@ -9,15 +9,15 @@ export type InfiniteArray<T> = T | InfiniteArray<T>[];
/**
* The type of array element in the `extends` property after flattening.
*/
export type SimpleExtendsElement = string | ConfigObject;
export type SimpleExtendsElement = string | Linter.Config;
/**
* The type of array element in the `extends` property before flattening.
*/
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<ConfigObject>;
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<Linter.Config>;
/**
* Config with extends. Valid only inside of `defineConfig()`.
*/
export interface ConfigWithExtends extends ConfigObject {
export interface ConfigWithExtends extends Linter.Config {
extends?: ExtendsElement[];
}
export type ConfigWithExtendsArray = InfiniteArray<ConfigWithExtends>[];

View File

@@ -2,7 +2,7 @@
* @fileoverview Types for this package.
*/
import type { ConfigObject } from "@eslint/core";
import type { Linter } from "eslint";
/**
* Infinite array type.
@@ -12,17 +12,19 @@ export type InfiniteArray<T> = T | InfiniteArray<T>[];
/**
* The type of array element in the `extends` property after flattening.
*/
export type SimpleExtendsElement = string | ConfigObject;
export type SimpleExtendsElement = string | Linter.Config;
/**
* The type of array element in the `extends` property before flattening.
*/
export type ExtendsElement = SimpleExtendsElement | InfiniteArray<ConfigObject>;
export type ExtendsElement =
| SimpleExtendsElement
| InfiniteArray<Linter.Config>;
/**
* Config with extends. Valid only inside of `defineConfig()`.
*/
export interface ConfigWithExtends extends ConfigObject {
export interface ConfigWithExtends extends Linter.Config {
extends?: ExtendsElement[];
}