lib/fix
lib/fix.js
Functions(9)
Signature
todoParamDescription(name: any): any
Signature
ensureSentence(text: any): any
Exact indentation string of the line `pos` sits on — reused for every continuation line.
| Parameter | Type | Optional | Description |
|---|---|---|---|
sourceText | any | ||
pos | any |
Returns:
any Signature
indentOf(sourceText: any, pos: any): any
Every `@tag` line that isn't one of the seven concepts rebuilt structurally
above — kept verbatim (not reformatted), so a full rebuild never silently
drops real content it doesn't have a structured slot for (e.g. `@readonly`,
`@static`, `@abstract`), and never renames a tag it can't safely interpret
(e.g. an unknown/typo'd tag — check-tag-names' territory, left for a human).
A tag known to carry no description (NO_DESC_TAGS) still gets its trailing
text stripped here — same transform empty-tags asks for, just applied
inline since these lines bypass the rest of the rebuild.
| Parameter | Type | Optional | Description |
|---|---|---|---|
rawComment | any |
Returns:
any Signature
scanOtherTagLines(rawComment: any): any
Signature
rebuildFunctionBlock(sym: any, indent: any): any
Signature
lightFixGenericBlock(sym: any, rules: any): any
Fix every symbol in `filePath` that lintModule() flagged, where a safe or
placeholder-based fix exists. Writes the file in place (same "no dry-run"
contract `--fix` follows everywhere else it's implemented) if — and only
if — at least one edit applies; a file with zero fixable issues is never
touched, byte-identical before and after.
| Parameter | Type | Optional | Description |
|---|---|---|---|
filePath | string |
Returns:
{ fixedCount: number, totalBefore: number, remainingIssues: Array } Signature
fixModule(filePath: any): any
Signature
tryFunctionLike(sym: any, symbolKey: any)
Variables & Constants(46)
const fs: any
constlib/fix.js
----------------------------------------
`gen-comments --lint --fix`'s engine. Rewrites EXISTING, malformed JSDoc
blocks to resolve lintModule()'s findings — it does not add JSDoc to
undocumented symbols (that's `--write`'s job; a require-jsdoc finding with
no existing block at all is left alone here).
Two fix strategies, matched to two kinds of symbol (see
docs/backlog/adr-013-lint-autofix.md for the full reasoning):
1. Function-like symbols (functions, methods, constructors) — the whole
block is REBUILT from real AST truth (actual param names/order/types,
actual return type) merged with whatever valid prose already existed.
This one rebuild naturally fixes require-param, require-param-description,
check-param-names (ordering), require-returns, require-returns-description,
require-returns-check, require-description, empty-tags, and
no-multi-asterisks/no-blank-block-descriptions in a single pass — a
symbol with zero lint issues is left completely untouched (byte-identical).
2. Generic symbols (classes, interfaces, typeAliases, enums, variables,
getters, setters, properties) — a lighter, line-level fix: strip
trailing text after a no-description tag, collapse stray asterisks,
insert one placeholder description line if the block is blank or has
none. No attempt to rebuild @property/@enum-style tag lists — those
aren't lint-checked today and rebuilding them risks losing real content.
One deliberate carve-out, in both strategies: `check-tag-names` (an unknown
/ typo'd tag) is NEVER auto-fixed. Every other fix here either applies a
fixed, deterministic placeholder template (never invented prose) or performs
a lossless mechanical transform (reorder, strip, collapse). Renaming a
typo'd tag would mean guessing what the author meant to type — there is no
safe default for that, so `check-tag-names` findings always survive a
`--fix` run and are reported as such.
Signature
const fs: any
const { lintModule, KNOWN_TAGS, NO_DESC_TAGS }: any
constSignature
const { lintModule, KNOWN_TAGS, NO_DESC_TAGS }: anySignature
const TODO_RETURNS_DESCRIPTION: string
Signature
const reallyReturnsAValue: any