/** * @module @nhtio/adk/batteries/media/lint * * ESLint rules for consumers of the media pipeline battery: machine-checkable enforcement of * the engine-composition contracts implementors are most likely to get wrong. * * @remarks * Battery-scoped rules ship with the battery, not with the core `@nhtio/adk/eslint` plugin — * they only matter to deployments that compose this battery, and they version with the * battery's own API. The rules are report-only (no autofix); carve out a deliberate exception * with an inline `// eslint-disable-next-line adk-media/{rule} -- {reason}` comment. * * `@typescript-eslint/utils` and `eslint` are OPTIONAL peer dependencies of `@nhtio/adk` — * installed only by consumers who lint with this plugin. The battery never imports this * module at runtime. * * @example Flat config * ```ts * import adkMedia from '@nhtio/adk/batteries/media/lint' * * export default [ * { plugins: { 'adk-media': adkMedia.plugin }, rules: adkMedia.configs.recommended.rules }, * ] * ``` */ import { ESLintUtils } from '@typescript-eslint/utils'; import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint'; /** A statically-derived capability summary for one engines-array element. */ export interface EngineSummary { /** Display label for the diagnostic. */ label: string; /** Mutate groups: input patterns, ops, encodes. */ mutates: Array<{ over: string[]; ops: string[]; encodes: string[]; }>; /** Convert groups: input patterns, target tokens. */ converts: Array<{ from: string[]; to: string[]; }>; /** Edit groups: input patterns, ops. */ edits: Array<{ over: string[]; ops: string[]; }>; } /** * Known declarations of the bundled engine factories, for shadow analysis. An ESLint rule * cannot execute the factories it lints, so this table mirrors their declarations by hand — * and is pinned against the live factories by a drift test (`lint_drift.node.spec.ts`). * Exported for that test only. */ export declare const BUNDLED_SUMMARIES: Record; /** * The optional peer dependencies each bundled engine subpath lazily imports at runtime. * Keyed by the engine's subpath suffix (after `engines/`). An engine with no external peer * (soffice, fs_workspace) is absent — there's nothing to install. Kept in lockstep with the * engines' actual `import(...)` calls by `engine_peers_drift.node.spec.ts`. */ export declare const ENGINE_PEERS: Record; /** * Flags an import of a bundled engine subpath whose optional peer dependency cannot be * resolved from the linting file — the "I composed `sheetjsEngine()` but never installed * `xlsx`, and now my pipeline throws `E_INVALID_MEDIA_PIPELINE_CONFIG` at the first sheet * op" footgun, caught at lint time instead of runtime. Resolution uses Node's resolver from * the file's own directory, so it honors the consumer's real `node_modules` layout. * * Reports once per missing peer per engine import (whether the import is a static value * import or a dynamic-import resolver — both reference the engine and both need the peer). */ /** * The peer-resolution probe: returns `true` when `peer` resolves from `fromFile`. Defaults to * Node's resolver anchored at the linted file (so it sees the consumer's `node_modules`). * Exposed as a settable seam so the rule's spec can simulate installed/missing peers without * depending on the test runner's own `node_modules` layout — production never sets it. */ export type PeerResolver = (peer: string, fromFile: string) => boolean; /** Override the peer resolver (spec-only seam). Pass nothing to restore the Node default. */ export declare const setPeerResolverForTesting: (resolver?: PeerResolver) => void; /** * Map of rule id (without the `adk-media/` plugin prefix) to its rule object. Registered on * the plugin as `rules`, so configs reference them as `adk-media/{id}`. */ export declare const rules: { 'prefer-engine-resolver': ESLintUtils.RuleModule<"preferResolver", [ ], unknown, ESLintUtils.RuleListener> & { name: string; }; 'no-shadowed-engine': ESLintUtils.RuleModule<"shadowed", [ ], unknown, ESLintUtils.RuleListener> & { name: string; }; 'augment-contracts-module': ESLintUtils.RuleModule<"wrongModule", [ ], unknown, ESLintUtils.RuleListener> & { name: string; }; 'require-engine-peers': ESLintUtils.RuleModule<"missingPeer", [ { ignore?: readonly string[]; } ], unknown, ESLintUtils.RuleListener> & { name: string; }; }; /** * The media battery's ESLint plugin object. Register under the `adk-media` namespace: * `plugins: { 'adk-media': plugin }`. */ export declare const plugin: FlatConfig.Plugin; /** * Named config presets. `recommended` enables every rule at `error` and registers the plugin * under the `adk-media` namespace — spread it into a flat config to adopt the full set. */ export declare const configs: { recommended: { name: string; plugins: { 'adk-media': FlatConfig.Plugin; }; rules: Partial>; }; }; /** * Default export bundles the plugin and its config presets, mirroring the shape ESLint flat * configs expect from a plugin module. */ declare const _default: { plugin: FlatConfig.Plugin; rules: { 'prefer-engine-resolver': ESLintUtils.RuleModule<"preferResolver", [ ], unknown, ESLintUtils.RuleListener> & { name: string; }; 'no-shadowed-engine': ESLintUtils.RuleModule<"shadowed", [ ], unknown, ESLintUtils.RuleListener> & { name: string; }; 'augment-contracts-module': ESLintUtils.RuleModule<"wrongModule", [ ], unknown, ESLintUtils.RuleListener> & { name: string; }; 'require-engine-peers': ESLintUtils.RuleModule<"missingPeer", [ { ignore?: readonly string[]; } ], unknown, ESLintUtils.RuleListener> & { name: string; }; }; configs: { recommended: { name: string; plugins: { 'adk-media': FlatConfig.Plugin; }; rules: Partial>; }; }; }; export default _default;