Expand description
The one-rule linter configuration and the private temporary file it is written to.
What:
The linter configuration the markdown/autofix policy hands monochromatic-lint:
one block that selects the policy’s rules for Markdown and MDX files,
written once
per invocation to a private temporary file outside the repository.
Why:
The plan’s contract (doc/planning/unified-linter.md,
section “Distribution and
consumers”) is a one-rule configuration in a temporary file created with a proper
temporary-file call,
passed with --config,
so a configuration the repository
keeps for its own linting never changes what the commit-time policy does.
Each
rule runs at warn,
so a finding the fixes leave is a record on standard error
and exit status 0,
and only a run that could not finish exits non-zero.
The
document is built as a value and printed by the JSONC emitter,
so no pattern text
can break out of its string.
In TS you’d write (pseudocode):
// const file = await writeOneRuleConfiguration({ rules, exclude }); // '/tmp/cli-git-markdown-Ab12Cd.jsonc'Constants§
- MARKDOWN_
FILE_ PATTERNS - The files the block selects, relative to the linter’s working directory, the top level.
Functions§
- one_
rule_ configuration - What:
The configuration document for
rulesandexclude, as JSONC text. Why: One block, the policy’s rules only, every other rule off by omission. - write_
configuration - What:
Write
documentto a new private temporary file indirectory.Result<NamedTempFile, String>is the open file, removed when dropped, or the reason. Why: The file is made with an exclusive, owner-only temporary-file call, so no other user can read or replace it between writing and the linter reading it.