mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 07:04:53 +09:00
Replace ESLint, typescript-eslint, eslint-plugin-node and the flat config helpers with vite-plus, which runs Oxlint for vp lint. The rules are carried over from eslint.config.mjs by @oxlint/migrate into the lint section of the root vite.config.ts. The formatting rules ESLint deprecated run as @stylistic rules through Oxlint's JS plugin support, and disable comments naming them are updated to the @stylistic names. @stylistic understands TypeScript syntax that the core rules skipped, so the autofix adds missing semicolons and spaces in type literals and aliases. Leading | and & in multiline types stay where they were. Oxlint's node/no-sync also reports identifiers ending in Sync that are not calls. The test helper techSync is renamed and the two other names are ignored. Refs #1127 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
130 lines
3.9 KiB
TypeScript
130 lines
3.9 KiB
TypeScript
import { FactorioColor } from "./lua_tools.js";
|
|
|
|
/**
|
|
* A localised string.
|
|
* @see [LocalisedString](https://lua-api.factorio.com/stable/types/LocalisedString.html)
|
|
*/
|
|
export type FactorioLocalisedString = string | [string, ...FactorioLocalisedString[]];
|
|
|
|
/**
|
|
* Shared properties of all prototypes.
|
|
* @see [PrototypeBase](https://lua-api.factorio.com/stable/types/PrototypeBase.html)
|
|
*/
|
|
export interface FactorioPrototypeBase {
|
|
[index: string]: unknown,
|
|
type: string,
|
|
name: string,
|
|
order?: string,
|
|
localised_name?: FactorioLocalisedString,
|
|
localised_description?: FactorioLocalisedString,
|
|
factoriopedia_description?: FactorioLocalisedString,
|
|
subgroup?: string,
|
|
hidden?: boolean,
|
|
hidden_in_factoriopedia?: boolean,
|
|
parameter?: boolean,
|
|
factoriopedia_simulation?: unknown,
|
|
}
|
|
|
|
/**
|
|
* Stage the mod setting is part of.
|
|
* @see [settings_type property](https://wiki.factorio.com/Tutorial:Mod_settings#The_setting_type_property)
|
|
*/
|
|
export type FactorioModSettingType = "startup" | "runtime-global" | "runtime-per-user";
|
|
|
|
/**
|
|
* Boolean mod setting prototype.
|
|
* @see [bool-setting](https://wiki.factorio.com/Tutorial:Mod_settings#bool-setting)
|
|
*/
|
|
export interface FactorioBoolSettingPrototype extends FactorioPrototypeBase {
|
|
type: "bool-setting",
|
|
setting_type?: FactorioModSettingType,
|
|
default_value: boolean,
|
|
forced_value?: boolean,
|
|
}
|
|
|
|
/**
|
|
* Integer mod setting prototype.
|
|
* @see [int-setting](https://wiki.factorio.com/Tutorial:Mod_settings#int-setting)
|
|
*/
|
|
export interface FactorioIntSettingPrototype extends FactorioPrototypeBase {
|
|
type: "int-setting",
|
|
setting_type?: FactorioModSettingType,
|
|
default_value: number,
|
|
minimum_value?: number,
|
|
maximum_value?: number,
|
|
allowed_values?: number[],
|
|
}
|
|
|
|
/**
|
|
* Real number mod setting prototype.
|
|
* @see [double-setting](https://wiki.factorio.com/Tutorial:Mod_settings#double-setting)
|
|
*/
|
|
export interface FactorioDoubleSettingPrototype extends FactorioPrototypeBase {
|
|
type: "double-setting",
|
|
setting_type?: FactorioModSettingType,
|
|
default_value: number,
|
|
minimum_value?: number,
|
|
maximum_value?: number,
|
|
allowed_values?: number[],
|
|
}
|
|
|
|
/**
|
|
* String mod setting prototype.
|
|
* @see [string-setting](https://wiki.factorio.com/Tutorial:Mod_settings#string-setting)
|
|
*/
|
|
export interface FactorioStringSettingPrototype extends FactorioPrototypeBase {
|
|
type: "string-setting",
|
|
setting_type?: FactorioModSettingType,
|
|
default_value: string,
|
|
allow_black?: boolean,
|
|
auto_trim?: string,
|
|
allowed_values?: string[],
|
|
}
|
|
|
|
/**
|
|
* Color mod setting prototype.
|
|
* @see [color-setting](https://wiki.factorio.com/Tutorial:Mod_settings#color-setting)
|
|
*/
|
|
export interface FactorioColorSettingPrototype extends FactorioPrototypeBase {
|
|
type: "color-setting",
|
|
setting_type?: FactorioModSettingType,
|
|
default_value: FactorioColor,
|
|
forced_value?: boolean,
|
|
}
|
|
|
|
export type FactorioModSettingPrototype =
|
|
| FactorioBoolSettingPrototype
|
|
| FactorioIntSettingPrototype
|
|
| FactorioDoubleSettingPrototype
|
|
| FactorioStringSettingPrototype
|
|
| FactorioColorSettingPrototype
|
|
;
|
|
|
|
/**
|
|
* A list of prototypes as it appears in Factorio's Lua API.
|
|
* @see [Data.raw](https://lua-api.factorio.com/stable/types/Data.html#raw)
|
|
*/
|
|
export type FactorioPrototypes<Prototype = FactorioPrototypeBase> = Record<string, Record<string, Prototype>>;
|
|
export type FactorioDefinesValue = number | string | { [index: string]: FactorioDefinesValue };
|
|
export type FactorioDefines = {
|
|
[index: string]: FactorioDefinesValue,
|
|
prototypes: Record<string, Record<string, number>>,
|
|
};
|
|
|
|
export type ExportSettings = FactorioPrototypes<FactorioModSettingPrototype>;
|
|
export type ExportPrototypes = FactorioPrototypes;
|
|
export type ExportLocale = [string, string][];
|
|
export interface ExportMetadataEntry {
|
|
name: string,
|
|
type: string,
|
|
localised_name?: FactorioLocalisedString,
|
|
icon?: {
|
|
x: number,
|
|
y: number,
|
|
size: number,
|
|
path?: string,
|
|
},
|
|
}
|
|
export type ExportMetadata = Record<string, ExportMetadataEntry[]>;
|
|
export type ExportDefines = FactorioDefines;
|