feat(modules): add the experimental lint layer and read the editor's diagnostics from it #295
No reviewers
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram!295
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/modules-lint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR 5b-1 of
.notes/backlog/plan-dx-et-aides-ecriture.md: the experimental@gram-lang/modules/lintlayer, which the language server now reads its diagnostics and Quick Fixes from.gram checkwill consume the same list in PR 6.What changes
@gram-lang/modules/lint(@experimental):lintDocument(input)returns every diagnostic of a document: its parse error, or else its compile error, the compiler's warnings and the lint layer's rules. Each one comes with its severity,docUrl,deprecatedflag,relatedpositions andLintFix[](FileEditpatches, UTF-16 offsets).allDiagnosticInfo()is the single registry: compiler codes plusPARSE_ERROR,COMPILE_ERROR,MISSING_TITLE,UNUSED_INTERMEDIATEandUNKNOWN_INGREDIENT.docUrlOf(code)gives each code's anchor on the warnings page.parseLintConfig(raw)readslint.rules(off|hint|info|warning);// gram-ignore CODEsilences a code for the next step, or for a section heading's line. Errors are never silenced or lowered.scanFrontmattermove here from the language server (first commit, no change of behavior).warningToDiagnostic: an import's warning is anchored on its@useline, withrelated.LintFix, and the regexes ondiag.messageare gone.MODULE_EXPORT_NOT_FOUNDfinds its binding by its rank among the missing bindings of the@useline (one warning per missing binding, in the order written). If the counts disagree, no fix is offered.datais added toWarning, so the compiled JSON and the conformance goldens are unchanged.diagnostics.tsandcode-actions.tsonly translate the lint output, andcodeDescription.hrefis set on every diagnostic.lint:is read from.gram/config.yaml.PARSE_ERROR. The spelling fix of an unknown ingredient is preferred only when a single name is the closest.lint-contractinvariant (no throw, only registered codes, loc inside the source). Lint time is added to the time budget.warnings.mdx: the table is generated fromallDiagnosticInfo(), with each code linked to its anchor. 24 missing sections are added (module codes,DEPRECATED_FRONTMATTER_KEY, lint codes), plus "Configure the lint".Lintsection on themodules.mdxAPI page, and the language server page and README.Checks
bun test: 4261 pass / 1 skip / 0 fail (4215 before); no test lost or renamed (junit comparison).bun run fuzz --iterations 50000(seed 461066333): 0 signatures.typecheck, biome (error level),deprecations:check: OK.Next
5b-2:
LOST_INGREDIENT,MERGED_STEP_LINE,SUSPECT_INGREDIENT_NAME,UNREAD_FRONTMATTERand theADD_TO_INGREDIENTS_DBQuick Fix.