refactor: move gram-tokens to @gram-lang/modules/lint and ingredient resolution to the analyzer #280
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!280
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/move-lint-primitives"
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 5a of the DX plan: moves only, no new feature, no visible behavior change (hence no changeset; the unknown-ingredient verdict was already aligned by #278).
Analyzer owns the unknown-ingredient verdict and its spelling suggestion:
isKnownIngredient(name, db)=getIngredientData(...) !== null, on the cached index.findClosestIngredients(name, db, maxDistance = 2): string[]: every entry name at the minimal distance, in database order (the LSP takes[0], same result as before; 5b will setisPreferredonly when there is a single suggestion).ingredient-loader.tsis down toloadIngredientDBandallIngredientCompletionLabels.Modules gets the
@gram-lang/modules/lintsubpath (@experimental), not re-exported from the main entry, so the playground bundles nothing more:packages/cli/src/core/gram-tokens.tsmoves topackages/modules/src/lint/gram-tokens.ts.WrittenIngredientgainsstart/end(UTF-16 offsets, from the@to the quantity's}or the end of a bare name), for thelocofLOST_INGREDIENTin 5b.lostFrom(compiled: Pick<CompilationResult, "registry">, written): WrittenIngredient[]is now pure; the importer keeps!ok → []and the"name (line N)"format, sogram importoutput is unchanged.exportsmap (.and./lint) and a second tsup entry; resolves frompackages/cliunder node 22 and bun.packages/modules/tests/lint/gram-tokens.test.ts; the importer's stay in the CLI.Checks: 4183 pass / 1 skip / 0 fail (+15 new tests, all 38 moved test names present), typecheck, biome, conformance 148/148 and 24/24 with no golden change,
deprecations:check, audit 127, playground chunk 1060.6 KB (forced build, unchanged), fuzz 50k ×2 (one pre-existing parser violation, also onmain, handled separately).