Skip to content

v1.0.12

Choose a tag to compare

@cldmv-bot cldmv-bot released this 28 Sep 04:40
· 3 commits to master since this release
v1.0.12
2686e4f

release: v1.0.12 - build a real ESLint AST from the jsonv parser

@cldmv/eslint-plugin-jsonv v1.0.12 Changelog

Release Date: September 2026
Release Type: Patch
Branch: release/1.0.12


Overview

Version 1.0.12 makes the jsonv/jsonv language a real ESLint language. Until now parse() ran the jsonv parser but handed ESLint a hard-coded empty Program, so the plugin could only say whether a file parsed: rules had no nodes to visit, a report on a node landed at 1:0, and inline eslint-disable comments were ignored. The language now builds a positioned AST from @cldmv/jsonv's parseToAst(), exposes comments and tokens, and supports ESLint's inline configuration comments.

Parse-error reporting is unchanged, except that unresolved and circular references now report at the reference itself instead of 1:1. The release raises the @cldmv/jsonv peer range to ^1.1.0 (the first version with parseToAst()) and adds @eslint/plugin-kit as a runtime dependency — see the upgrade notes.


🐛 Bug Fixes

The language returns a real AST (#26, fixes #19)

languages.jsonv.parse() now returns an ESTree-style AST whose Program.body is the document's root value, built from @cldmv/jsonv's parseToAst(). Node types: Program, ObjectExpression, Property, ArrayExpression, Literal, Identifier, MemberExpression, TemplateLiteral and TemplateElement. Every node carries a loc with 1-based lines and columns (matching the language's declared columnStart: 1) and a range, Program carries the document's Line/Block comments and its tokens, and the language declares visitorKeys so selectors such as "Property > Literal.value" work.

createSourceCode() returns a JsonvSourceCode built on TextSourceCodeBase from @eslint/plugin-kit, the same foundation @eslint/json uses. It provides traversal, getParent() / getAncestors(), and inline configuration: // eslint-disable, /* eslint-disable <rule> */, /* eslint-enable */, // eslint-disable-line, // eslint-disable-next-line and /* eslint <rule>: "off" */ now work inside .jsonv files, and malformed directives are reported. Line handling matches jsonv's own (CRLF, CR, LF, U+2028, U+2029), so range and loc agree on every line-break style.

Parse errors are still produced by parseWithOptions() at their real position. Unresolved and circular references, which @cldmv/jsonv 1.1.0 now throws as a positioned JsonvReferenceError, report at the reference: { a: missing } reports at 1:6 rather than 1:1.

The README gains Inline Configuration and Writing Rules sections with the node-type table and a selector example. Test coverage went from 114 to 167 tests, with index.mjs at 100% statements, branches, functions and lines.

🔧 Dependencies

  • @cldmv/jsonv ^1.0.10 → ^1.1.0, as both the peer dependency and the dev dependency; 1.1.0 is the first release with parseToAst() (#26).
  • NEW runtime dependency: @eslint/plugin-kit ^0.7.3, which provides TextSourceCodeBase and the inline-config directive types (#26).
  • typescript 5.9.3 → 7.0.2 (dev only; builds the published type declarations, which are unchanged apart from keeping the file's header doc comment) (#25).

📚 Documentation


Upgrade notes

  • Upgrade @cldmv/jsonv to 1.1.0 or later alongside this release. The peer range is now ^1.1.0; with @cldmv/jsonv 1.0.x installed, npm reports a peer-dependency conflict.
  • Rules that report on nodes now land on the node's real position instead of 1:0, and inline eslint-disable comments now take effect — findings that were previously suppressed by nothing, or mis-positioned, will move or disappear accordingly.
  • JsonvSourceCode#getLoc() / getRange() now throw for an object with no position rather than returning a 1:0 fallback. This only affects custom code that passes hand-built objects to those methods.
  • No configuration changes are required: the jsonv/jsonv language id, the language options and configs.recommended are unchanged.

coverage

Metric Coverage
Statements 100.0%
Branches 100.0%
Functions 100.0%
Lines 100.0%

Avg: 100.0% · a85c2f5 · Node lts/*

👥 Contributors