UNPKG

bc-minecraft-project

Version:
160 lines 6.52 kB
/** Severity level for a lint rule */ export type MCLintSeverity = 'off' | 'warn' | 'error' | 0 | 1 | 2; /** A rule value is either a severity or an array of [severity, ...options] */ export type MCLintRuleValue = MCLintSeverity | [MCLintSeverity, ...unknown[]]; /** Rule definitions supported by MCLint */ export interface MCLintRules { /** * Validate that identity strings follow the `namespace:name` format. * When enabled, identifiers that do not contain a colon separator are flagged. */ 'identity.format'?: MCLintRuleValue; /** * Allow only listed namespaces. * Options: `[severity, [allowedNamespace1, allowedNamespace2, ...]]` */ 'namespace.allow'?: MCLintRuleValue; /** * Deny listed namespaces. * Options: `[severity, [deniedNamespace1, deniedNamespace2, ...]]` */ 'namespace.deny'?: MCLintRuleValue; /** * Require that identifiers for items, entities, blocks, and similar types always include a namespace. * When enabled, identifiers that do not contain a colon separator (e.g. `zombie` instead of `minecraft:zombie`) * are flagged. */ 'namespace.required'?: MCLintRuleValue; /** * Validate animation IDs against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'animation.naming'?: MCLintRuleValue; /** * Validate animation controller IDs against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'animation-controller.naming'?: MCLintRuleValue; /** * Validate animation controller state IDs against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'animation-state.naming'?: MCLintRuleValue; /** * Validate biome identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'biome.naming'?: MCLintRuleValue; /** * Validate block identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'block.naming'?: MCLintRuleValue; /** * Validate bone names against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'bone.naming'?: MCLintRuleValue; /** * Validate entity identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'entity.naming'?: MCLintRuleValue; /** * Validate feature identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'feature.naming'?: MCLintRuleValue; /** * Validate feature rule identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'feature-rule.naming'?: MCLintRuleValue; /** * Validate fog setting identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'fog.naming'?: MCLintRuleValue; /** * Validate item identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'item.naming'?: MCLintRuleValue; /** * Validate model/geometry identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'model.naming'?: MCLintRuleValue; /** * Validate molang variable names against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'molang.variable.naming'?: MCLintRuleValue; /** * Validate particle identifiers against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'particle.naming'?: MCLintRuleValue; /** * Validate render controller IDs against a regular expression pattern. * Options: `[severity, "regexPattern"]` */ 'render-controller.naming'?: MCLintRuleValue; /** * Validate that sound file paths use only allowed file extensions. * When a sound path in `sound_definitions.json` explicitly specifies an extension, * it must be one of the allowed extensions. * Options: `[severity, [".ogg", ".wav"]]` — defaults to `[".ogg", ".wav"]` when omitted. */ 'sound.extensions'?: MCLintRuleValue; /** * Validate mcfunction file names (function IDs) against a regular expression pattern. * The function ID is the path relative to the `functions/` directory, without the `.mcfunction` extension. * Options: `[severity, "regexPattern"]` */ 'mcfunction.naming'?: MCLintRuleValue; /** * Validate fake player names against a regular expression pattern. * Fake players are non-selector target values used in commands such as `scoreboard`. * Options: `[severity, "regexPattern"]` */ 'fake-player.naming'?: MCLintRuleValue; /** Additional user-defined rules */ [key: string]: MCLintRuleValue | undefined; } /** The MCLint configuration object, parsed from a `.mclint` file */ export interface MCLint { /** The lint rules configuration */ rules: MCLintRules; } /** Namespace providing utilities for working with MCLint configuration */ export declare namespace MCLint { /** The default filename for MCLint configuration */ const filename = ".mclint"; /** Creates an empty MCLint configuration */ function createEmpty(): MCLint; /** Checks whether the given value implements the MCLint interface */ function is(value: unknown): value is MCLint; /** * Parses a JSON string as MCLint configuration. * Returns an empty configuration if the input is invalid. */ function parse(content: string): MCLint; /** Loads the MCLint configuration from a file synchronously */ function loadSync(filepath: string): MCLint; /** Loads the MCLint configuration from a file asynchronously */ function load(filepath: string): Promise<MCLint>; /** * Resolves the effective severity string of a rule. * Returns `'off'` when the rule is undefined or explicitly disabled. */ function getSeverity(rule: MCLintRuleValue | undefined): 'off' | 'warn' | 'error'; /** * Gets the options array for a rule (all elements after the severity). * Returns an empty array when the rule has no options or is a plain severity value. */ function getOptions(rule: MCLintRuleValue | undefined): unknown[]; /** Returns `true` when the rule is enabled (not `'off'`) */ function isEnabled(rule: MCLintRuleValue | undefined): boolean; } //# sourceMappingURL=mclint.d.ts.map