mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 23:33:12 +09:00
Lint with Oxlint through Vite+ instead of ESLint
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>
This commit is contained in:
1 parent
3227179613
commit
e94abe51c9
35 files changed
+445
-578
No files matched your search
@@ -264,7 +264,9 @@ export class LockFile {
|
||||
// Event handler for synchronous process exit, readLock can't be used as it is async
|
||||
private handleExitSync = (): void => {
|
||||
try {
|
||||
// eslint-disable-next-line node/no-sync
|
||||
if (readFileSync(this.filePath, "utf8") === LockFile.content) {
|
||||
// eslint-disable-next-line node/no-sync
|
||||
unlinkSync(this.filePath);
|
||||
}
|
||||
} catch (err) {
|
||||
|
||||
@@ -14,4 +14,4 @@ export type PluginWebApi = {
|
||||
* package.
|
||||
*/
|
||||
npmPackage?: string;
|
||||
}
|
||||
};
|
||||
@@ -24,7 +24,7 @@ type OldConfigGroupSchema = Static<typeof OldConfigGroupSchema>;
|
||||
const OldConfigSchema = Type.Object({
|
||||
"groups": Type.Array(OldConfigGroupSchema),
|
||||
});
|
||||
export type OldConfigSchema = Static<typeof OldConfigSchema>
|
||||
export type OldConfigSchema = Static<typeof OldConfigSchema>;
|
||||
|
||||
export const ConfigSchema = Type.Record(Type.String(), Type.Union([
|
||||
Type.Null(),
|
||||
@@ -38,11 +38,11 @@ export type ConfigSchema = Static<typeof ConfigSchema>;
|
||||
type FieldValue = null | boolean | string | number | object;
|
||||
|
||||
type FieldType<T extends FieldValue> =
|
||||
T extends boolean ? "boolean" :
|
||||
T extends string ? "string" :
|
||||
T extends number ? "number" :
|
||||
T extends object ? "object" :
|
||||
never;
|
||||
T extends boolean ? "boolean"
|
||||
: T extends string ? "string"
|
||||
: T extends number ? "number"
|
||||
: T extends object ? "object"
|
||||
: never;
|
||||
|
||||
export interface FieldDefinition<
|
||||
Type extends FieldValue = any,
|
||||
@@ -134,7 +134,7 @@ export type ConfigDefs<
|
||||
Fields extends Record<keyof Fields, FieldValue>
|
||||
> = {
|
||||
[Prop in keyof Fields]: FieldDefinition<Fields[Prop], Fields>;
|
||||
}
|
||||
};
|
||||
|
||||
function defaultValue(def: FieldDefinition) {
|
||||
if (def.initialValue === undefined) {
|
||||
@@ -148,7 +148,7 @@ function defaultValue(def: FieldDefinition) {
|
||||
|
||||
export type ConfigEvents = {
|
||||
fieldChanged: [ name: string, curr: FieldValue, prev: FieldValue ],
|
||||
}
|
||||
};
|
||||
|
||||
export enum ConfigAccess {
|
||||
read = 0x1,
|
||||
|
||||
@@ -15,8 +15,8 @@ export abstract class DatastoreProvider<
|
||||
K extends DatastoreKey,
|
||||
V extends DatastoreValue,
|
||||
> {
|
||||
abstract save(data: Map<K, V>): Promise<void>
|
||||
abstract load(): Promise<Map<K, V>>
|
||||
abstract save(data: Map<K, V>): Promise<void>;
|
||||
abstract load(): Promise<Map<K, V>>;
|
||||
}
|
||||
|
||||
// Store all data in memory, used as a default and should be avoided
|
||||
|
||||
@@ -35,7 +35,7 @@ export type FactorioModSettingType = "startup" | "runtime-global" | "runtime-per
|
||||
* Boolean mod setting prototype.
|
||||
* @see [bool-setting](https://wiki.factorio.com/Tutorial:Mod_settings#bool-setting)
|
||||
*/
|
||||
export interface FactorioBoolSettingPrototype extends FactorioPrototypeBase{
|
||||
export interface FactorioBoolSettingPrototype extends FactorioPrototypeBase {
|
||||
type: "bool-setting",
|
||||
setting_type?: FactorioModSettingType,
|
||||
default_value: boolean,
|
||||
@@ -46,7 +46,7 @@ export interface FactorioBoolSettingPrototype extends FactorioPrototypeBase{
|
||||
* Integer mod setting prototype.
|
||||
* @see [int-setting](https://wiki.factorio.com/Tutorial:Mod_settings#int-setting)
|
||||
*/
|
||||
export interface FactorioIntSettingPrototype extends FactorioPrototypeBase{
|
||||
export interface FactorioIntSettingPrototype extends FactorioPrototypeBase {
|
||||
type: "int-setting",
|
||||
setting_type?: FactorioModSettingType,
|
||||
default_value: number,
|
||||
@@ -59,7 +59,7 @@ export interface FactorioIntSettingPrototype extends FactorioPrototypeBase{
|
||||
* Real number mod setting prototype.
|
||||
* @see [double-setting](https://wiki.factorio.com/Tutorial:Mod_settings#double-setting)
|
||||
*/
|
||||
export interface FactorioDoubleSettingPrototype extends FactorioPrototypeBase{
|
||||
export interface FactorioDoubleSettingPrototype extends FactorioPrototypeBase {
|
||||
type: "double-setting",
|
||||
setting_type?: FactorioModSettingType,
|
||||
default_value: number,
|
||||
@@ -72,7 +72,7 @@ export interface FactorioDoubleSettingPrototype extends FactorioPrototypeBase{
|
||||
* String mod setting prototype.
|
||||
* @see [string-setting](https://wiki.factorio.com/Tutorial:Mod_settings#string-setting)
|
||||
*/
|
||||
export interface FactorioStringSettingPrototype extends FactorioPrototypeBase{
|
||||
export interface FactorioStringSettingPrototype extends FactorioPrototypeBase {
|
||||
type: "string-setting",
|
||||
setting_type?: FactorioModSettingType,
|
||||
default_value: string,
|
||||
@@ -85,7 +85,7 @@ export interface FactorioStringSettingPrototype extends FactorioPrototypeBase{
|
||||
* Color mod setting prototype.
|
||||
* @see [color-setting](https://wiki.factorio.com/Tutorial:Mod_settings#color-setting)
|
||||
*/
|
||||
export interface FactorioColorSettingPrototype extends FactorioPrototypeBase{
|
||||
export interface FactorioColorSettingPrototype extends FactorioPrototypeBase {
|
||||
type: "color-setting",
|
||||
setting_type?: FactorioModSettingType,
|
||||
default_value: FactorioColor,
|
||||
@@ -104,7 +104,7 @@ export type FactorioModSettingPrototype =
|
||||
* 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 FactorioPrototypes<Prototype = FactorioPrototypeBase> = Record<string, Record<string, Prototype>>;
|
||||
export type FactorioDefinesValue = number | string | { [index: string]: FactorioDefinesValue };
|
||||
export type FactorioDefines = {
|
||||
[index: string]: FactorioDefinesValue,
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ export const ExternalFactorioVersionSchema = Type.Object({
|
||||
headlessUrl: Type.String(),
|
||||
});
|
||||
|
||||
export type ExternalFactorioVersion = Static<typeof ExternalFactorioVersionSchema>
|
||||
export type ExternalFactorioVersion = Static<typeof ExternalFactorioVersionSchema>;
|
||||
|
||||
/**
|
||||
* Fetch all factorio versions that support headless
|
||||
@@ -47,7 +47,7 @@ function parseFactorioVersions(html: string): ExternalFactorioVersion[] {
|
||||
const versions = new Map<string, ExternalFactorioVersion>();
|
||||
|
||||
// Match <a class=" slot-button-inline version-button-stable " href="/download/archive/2.0.72">2.0.72</a>
|
||||
// eslint-disable-next-line max-len
|
||||
// eslint-disable-next-line @stylistic/max-len
|
||||
const anchorRegex = /<a[^>]*class="[^"]*version-button-(?<kind>stable|experimental)[^"]*"[^>]*href="[^"]*\/download\/archive\/(?<version>\d+\.\d+.\d+)"[^>]*>/g;
|
||||
|
||||
let match: RegExpExecArray | null;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ export const LatestReleaseBuildsSchema = Type.Record(Type.String(), FullVersionS
|
||||
*/
|
||||
export const LatestReleasesSchema = Type.Record(Type.String(), LatestReleaseBuildsSchema);
|
||||
|
||||
export type LatestReleases = Static<typeof LatestReleasesSchema>
|
||||
export type LatestReleases = Static<typeof LatestReleasesSchema>;
|
||||
|
||||
/**
|
||||
* Fetch the latest stable and experimental factorio releases
|
||||
|
||||
@@ -177,9 +177,9 @@ export const logger = winston.createLogger({
|
||||
// Who in their right mind thought that log levels should be hard coded
|
||||
// into the type when you can define custom levels you want to support?
|
||||
export type Logger = Omit<winston.Logger,
|
||||
"error" | "warn" | "help" | "data" | "info" | "debug" | "prompt" | "verbose" | "input" | "silly" |
|
||||
"emerg" | "alert" | "crit" | "warning" | "notice" |
|
||||
"child"
|
||||
"error" | "warn" | "help" | "data" | "info" | "debug" | "prompt" | "verbose" | "input" | "silly"
|
||||
| "emerg" | "alert" | "crit" | "warning" | "notice"
|
||||
| "child"
|
||||
> & {
|
||||
fatal: winston.LeveledLogMethod,
|
||||
error: winston.LeveledLogMethod,
|
||||
|
||||
@@ -46,7 +46,7 @@ export type PluginDeclaration = {
|
||||
errors?: ErrorClass[];
|
||||
permissions?: PermissionDefinition[];
|
||||
routes?: string[];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if a plugin is expected to ship a web build.
|
||||
|
||||
@@ -175,7 +175,7 @@ export async function handlePluginCommand(
|
||||
try {
|
||||
const pluginPackage = (await import(
|
||||
pathToFileURL(path.posix.join(pluginPath, "package.json")).href,
|
||||
{ with: { type: "json" }},
|
||||
{ with: { type: "json" }}
|
||||
)).default;
|
||||
pluginInfo = (await import(
|
||||
pathToFileURL(path.posix.join(pluginPath, pluginPackage.main ?? "index.js")).href
|
||||
|
||||
@@ -7,7 +7,7 @@ import { SessionLost, ValidationError } from "./errors.js";
|
||||
import { logger } from "./logging.js";
|
||||
|
||||
export type SubscriptionRequestHandler<T> = RequestHandler<SubscriptionRequest, Event<T> | null>;
|
||||
export type EventSubscriberCallback<T> = (event: T | null, synced: boolean) => void
|
||||
export type EventSubscriberCallback<T> = (event: T | null, synced: boolean) => void;
|
||||
|
||||
/**
|
||||
* Represents a set of string subscription filters.
|
||||
@@ -241,7 +241,7 @@ type Subscriber = {
|
||||
link: Link,
|
||||
address: Address,
|
||||
filters: SubscriptionFilters,
|
||||
}
|
||||
};
|
||||
|
||||
type EventData = {
|
||||
subscriptionUpdate?: SubscriptionRequestHandler<unknown>,
|
||||
|
||||
Reference in new issue
Block a user