Skip to content
2 min read · 425 words

batteries/media/lint

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,
  },
];

Interfaces

InterfaceDescription
EngineSummaryA statically-derived capability summary for one engines-array element.

Type Aliases

Type AliasDescription
PeerResolverThe 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.

Variables

VariableDescription
BUNDLED_SUMMARIESKnown 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.
configsNamed 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.
defaultDefault export bundles the plugin and its config presets, mirroring the shape ESLint flat configs expect from a plugin module.
ENGINE_PEERSThe 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.
pluginThe media battery's ESLint plugin object. Register under the adk-media namespace: plugins: { 'adk-media': plugin }.
rulesMap 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}.

Functions

FunctionDescription
setPeerResolverForTestingOverride the peer resolver (spec-only seam). Pass nothing to restore the Node default.