Skip to main content

Module markdown_linter_config

Module markdown_linter_config 

Source
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 rules and exclude, as JSONC text. Why: One block, the policy’s rules only, every other rule off by omission.
write_configuration
What: Write document to a new private temporary file in directory. 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.