@cldmv/eslint-plugin-jsonv 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,24 @@
6
6
 
7
7
  ESLint plugin for validating `.jsonv` files using the [@cldmv/jsonv](https://github.com/CLDMV/jsonv) parser.
8
8
 
9
+ ## ✨ What's New
10
+
11
+ ### Latest: v1.0.13 (September 2026)
12
+
13
+ - **Published types describe a real ESLint plugin** — `dist/index.d.mts` typed the default export as a bare `Object`; it now types the plugin, the `jsonv/jsonv` language, `JsonvSourceCode` and every AST node against `@eslint/core`'s generics, checked in CI by a new `test:types` script, alongside a declared `engines.node` and `eslint` peer range that finally match what the runtime dependencies require (#30, #37, fixes #28, #32).
14
+ - **Three more language options** — `mode` (`"jsonv"`, `"json5"` or `"json"`), `strictOctal` and `allowInternalReferences` are now accepted, validated and forwarded to `@cldmv/jsonv`, matching what the README already documented (#39, fixes #34).
15
+ - **CLDMV lint/format tooling** — `lint`, `lint:fix`, `format` and `format:check` scripts, a pre-commit hook and the org's shared ESLint/Prettier config land, and the repository is reformatted repo-wide (#38, fixes #33).
16
+ - [View full v1.0.13 Changelog](https://github.com/CLDMV/jsonv-eslint-plugin-jsonv/blob/master/docs/changelog/v1/v1.0.13.md)
17
+
18
+ ### Recent Releases
19
+
20
+ - **v1.0.12** (September 2026) — the `jsonv/jsonv` language builds a real ESLint AST from `@cldmv/jsonv`'s `parseToAst()`, so rules can select nodes and inline `eslint-disable` comments work (#26) ([Changelog](https://github.com/CLDMV/jsonv-eslint-plugin-jsonv/blob/master/docs/changelog/v1/v1.0.12.md))
21
+ - **v1.0.11** (September 2026) — language options are validated, parse errors report at their real position, and the plugin gained a vitest suite with a CI coverage badge (#16, #17, #18, #23, #24) ([Changelog](https://github.com/CLDMV/jsonv-eslint-plugin-jsonv/blob/master/docs/changelog/v1/v1.0.11.md))
22
+ - **v1.0.10** (September 2026) — the README links back to the jsonv repo (#15) ([Changelog](https://github.com/CLDMV/jsonv-eslint-plugin-jsonv/blob/master/docs/changelog/v1/v1.0.10.md))
23
+ - **v1.0.9** (September 2026) — corrected package name, badge row and license badges (#12) ([Changelog](https://github.com/CLDMV/jsonv-eslint-plugin-jsonv/blob/master/docs/changelog/v1/v1.0.9.md))
24
+
25
+ 📚 **For complete version history, see [docs/changelog/](https://github.com/CLDMV/jsonv-eslint-plugin-jsonv/tree/master/docs/changelog/) and the [GitHub Releases](https://github.com/CLDMV/jsonv-eslint-plugin-jsonv/releases).**
26
+
9
27
  ## Features
10
28
 
11
29
  - **Syntax Validation**: Validates jsonv syntax using the actual jsonv parser
@@ -13,7 +31,7 @@ ESLint plugin for validating `.jsonv` files using the [@cldmv/jsonv](https://git
13
31
  - **Internal References**: Validates bare identifiers, template interpolation, nested property access
14
32
  - **BigInt Support**: Validates BigInt literals and numeric separators
15
33
  - **Accurate Error Reporting**: Parse errors include line/column information
16
- - **Year-Based Features**: Configurable target ES year for feature detection
34
+ - **Configurable Parsing**: Target ES year, parse mode, strict BigInt and octal checks, and internal reference resolution
17
35
 
18
36
  ## Installation
19
37
 
@@ -21,6 +39,8 @@ ESLint plugin for validating `.jsonv` files using the [@cldmv/jsonv](https://git
21
39
  npm install --save-dev @cldmv/eslint-plugin-jsonv
22
40
  ```
23
41
 
42
+ **Requirements:** Node `^20.19.0 || ^22.13.0 || >=24` and ESLint `^9.13.0 || ^10.0.0` (the first ESLint release with `defaultLanguageOptions` support for plugin `languages`; the plugin's `@eslint/plugin-kit` and `@eslint/core` dependencies also need that Node floor).
43
+
24
44
  **Note:** This plugin requires `@cldmv/jsonv` as a peer dependency.
25
45
 
26
46
  ```bash
@@ -37,6 +57,7 @@ npm run build
37
57
  ```
38
58
 
39
59
  This will:
60
+
40
61
  1. Copy `index.mjs` into `dist/index.mjs`
41
62
  2. Generate type definitions into `dist/index.d.mts`
42
63
  3. Prepare the plugin for use
@@ -46,21 +67,21 @@ This will:
46
67
  ### ESLint Flat Config (eslint.config.mjs)
47
68
 
48
69
  ```javascript
49
- import jsonv from '@cldmv/eslint-plugin-jsonv';
70
+ import jsonv from "@cldmv/eslint-plugin-jsonv";
50
71
 
51
72
  export default [
52
- {
53
- files: ["**/*.jsonv"],
54
- plugins: { jsonv },
55
- language: "jsonv/jsonv",
56
- extends: ["jsonv/recommended"]
57
- }
73
+ {
74
+ files: ["**/*.jsonv"],
75
+ plugins: { jsonv },
76
+ language: "jsonv/jsonv",
77
+ extends: ["jsonv/recommended"]
78
+ }
58
79
  ];
59
80
  ```
60
81
 
61
82
  ### Configuration Options
62
83
 
63
- The parser supports the following options:
84
+ `languageOptions` are passed to the `@cldmv/jsonv` parser (both `parseWithOptions()`, which reports errors, and `parseToAst()`, which builds the AST rules see). Every option is optional; the values below are the defaults:
64
85
 
65
86
  ```javascript
66
87
  {
@@ -68,16 +89,68 @@ The parser supports the following options:
68
89
  plugins: { jsonv },
69
90
  language: "jsonv/jsonv",
70
91
  languageOptions: {
71
- year: 2025, // Target ES year (2011, 2015, 2020, 2021, 2022-2025)
72
- strictBigInt: false, // Require 'n' suffix for large integers
73
- mode: "jsonv" // Parse mode: "jsonv", "json5", "json"
92
+ year: 2025, // Target ES year: which jsonv features are allowed
93
+ mode: "jsonv", // Parse mode: "jsonv", "json5" or "json"
94
+ strictBigInt: false, // true: an unsafe integer needs the `n` suffix
95
+ strictOctal: false, // true: legacy `0755` octals are errors (use `0o755`)
96
+ allowInternalReferences: true // false: references are not resolved or checked
74
97
  }
75
98
  }
76
99
  ```
77
100
 
101
+ | Option | Type | Allowed values | Default | Meaning |
102
+ | ------------------------- | ------- | ---------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
+ | `year` | number | `2011`, `2015`, `2016`, `2017`, `2018`, `2019`, `2020`, `2021`, `2022`, `2023`, `2024`, `2025` | `2025` | The target ES year. A feature introduced after it is an error: binary/octal literals and template literals need 2015, BigInt needs 2020, numeric separators need 2021. |
104
+ | `mode` | string | `"jsonv"`, `"json5"`, `"json"` | `"jsonv"` | The parse mode. `"jsonv"` allows every jsonv feature of the selected year, `"json5"` is meant for JSON5 only and `"json"` for strict JSON. The plugin passes the mode through unchanged, so it enforces exactly what `@cldmv/jsonv` enforces: in `@cldmv/jsonv` 1.1.0, `"json"` rejects comments, and the other JSON and JSON5 restrictions are not enforced yet. |
105
+ | `strictBigInt` | boolean | `true`, `false` | `false` | When `true`, an integer outside the safe range (±9007199254740991) without an `n` suffix is an error. When `false`, it is read as a BigInt. |
106
+ | `strictOctal` | boolean | `true`, `false` | `false` | When `true`, a legacy octal literal such as `0755` is an error; `0o755` is still allowed. |
107
+ | `allowInternalReferences` | boolean | `true`, `false` | `true` | When `true`, internal references (`backup: port`, `server.port`, `` `${host}` ``) are resolved, and an undefined or circular reference is an error. When `false`, they are left unresolved and are not reported. |
108
+
109
+ Any other key, or a value outside the allowed ones, is a configuration error (a `TypeError` naming the option).
110
+
111
+ Three `@cldmv/jsonv` parse options are deliberately not accepted:
112
+
113
+ - `reviver`: a reviver only transforms the evaluated value, and linting does not use that value.
114
+ - `preserveComments`: the AST always carries the comments, so inline `eslint-disable` comments and rules can see them.
115
+ - `tolerant`: the plugin controls how parse errors are collected.
116
+
117
+ ### Inline Configuration
118
+
119
+ The usual ESLint comments work inside `.jsonv` files: `// eslint-disable`, `/* eslint-disable <rule> */`, `/* eslint-enable */`, `// eslint-disable-line`, `// eslint-disable-next-line`, and `/* eslint <rule>: "off" */` rule configuration.
120
+
121
+ ### Writing Rules
122
+
123
+ The `jsonv/jsonv` language exposes the document as an AST built from `@cldmv/jsonv`'s `parseToAst()`. Every node has a `loc` (1-based lines and columns) and a `range`, so reports on a node land on that node, and rules can use node types and selectors:
124
+
125
+ | Node type | Children | Notes |
126
+ | ------------------ | ----------------------- | -------------------------------------------------------------------------------------------------------------------- |
127
+ | `Program` | `body` | The document; `body` is the root value. `comments` and `tokens` hang off it. |
128
+ | `ObjectExpression` | `properties` | `{ ... }` |
129
+ | `Property` | `key`, `value` | `key` is a `Literal` (quoted or numeric key) or an `Identifier` (unquoted key). |
130
+ | `ArrayExpression` | `elements` | `[ ... ]` |
131
+ | `Literal` | — | Strings, numbers, BigInt (`bigint` holds the digits), booleans, `null`, `Infinity`, `NaN`; `raw` is the source text. |
132
+ | `Identifier` | — | An unquoted key, or an internal reference such as `backup: port`. |
133
+ | `MemberExpression` | `object`, `property` | A dotted internal reference such as `server.port`. |
134
+ | `TemplateLiteral` | `quasis`, `expressions` | A backtick string with `${...}` interpolation (a plain backtick string is a `Literal`). |
135
+ | `TemplateElement` | — | A literal segment of a template. |
136
+
137
+ ```javascript
138
+ // Report every string value containing "TODO", on the string itself
139
+ create(context) {
140
+ return {
141
+ "Property > Literal.value"(node) {
142
+ if (typeof node.value === "string" && node.value.includes("TODO")) {
143
+ context.report({ node, message: "Unexpected TODO." });
144
+ }
145
+ }
146
+ };
147
+ }
148
+ ```
149
+
78
150
  ## Supported Features
79
151
 
80
152
  ### ES2011 (JSON5 Base)
153
+
81
154
  - Single-line (`//`) and multi-line (`/* */`) comments
82
155
  - Trailing commas in objects and arrays
83
156
  - Unquoted object keys
@@ -90,21 +163,27 @@ The parser supports the following options:
90
163
  - **Internal references via bare identifiers**: `{ port: 8080, backup: port }`
91
164
 
92
165
  ### ES2015 (ES6)
166
+
93
167
  - Binary literals (`0b1010`)
94
168
  - Octal literals (`0o755`, also legacy `0755`)
95
169
  - Template literals (backtick strings)
96
170
  - **Template interpolation for internal refs**: `` url: `http://${host}:${port}` ``
97
171
 
98
172
  ### ES2020
173
+
99
174
  - BigInt literals (`9007199254740992n`)
100
175
  - BigInt in hex/binary/octal formats
101
176
 
102
177
  ### ES2021
178
+
103
179
  - Numeric separators (`1_000_000`, `0xFF_AA`, `0b1111_0000`)
104
180
 
105
181
  ## Example
106
182
 
107
183
  **config.jsonv:**
184
+
185
+ <!-- @cldmv/prettier-plugin-jsonv 1.0.6 rewrites this block destructively (keys become "[object Object]", comments and numeric formats are lost), so prettier leaves it verbatim. -->
186
+ <!-- prettier-ignore -->
108
187
  ```jsonv
109
188
  {
110
189
  // Server configuration with internal references
package/dist/index.d.mts CHANGED
@@ -1,9 +1,445 @@
1
- export default plugin;
2
1
  /**
3
- * ESLint plugin export
2
+ * @fileoverview ESLint plugin for @cldmv/jsonv files
3
+ * @module eslint-plugin-jsonv
4
+ * @public
5
+ *
6
+ * @description
7
+ * Custom ESLint plugin for validating .jsonv files using the @cldmv/jsonv parser.
8
+ * Provides language definition, parser, and recommended rules for jsonv files.
9
+ *
10
+ * Features:
11
+ * - Validates jsonv syntax using the actual jsonv parser
12
+ * - Reports parse errors with accurate source locations
13
+ * - Supports all ES2011-2025 features (JSON5, binary/octal literals, BigInt, numeric separators, etc.)
14
+ * - Detects internal reference errors (circular refs, undefined refs)
15
+ * - Configurable language options: target ES year, parse mode, strict BigInt and octal checks,
16
+ * and internal reference resolution
17
+ * - Exposes a positioned AST (objects, arrays, properties, literals, references, templates),
18
+ * comments and tokens, so rules can select nodes and inline `eslint-disable` comments work
19
+ *
20
+ * @example
21
+ * // In eslint.config.mjs
22
+ * import jsonv from 'eslint-plugin-jsonv';
23
+ *
24
+ * export default [
25
+ * {
26
+ * files: ["**\/*.jsonv"],
27
+ * plugins: { jsonv },
28
+ * language: "jsonv/jsonv",
29
+ * extends: ["jsonv/recommended"]
30
+ * }
31
+ * ];
32
+ */
33
+ import { Directive, TextSourceCodeBase, VisitNodeStep } from "@eslint/plugin-kit";
34
+ import type { FileProblem, Language, OkParseResult, ParseResult, RulesConfig, RuleVisitor, SourceLocation, SourceRange } from "@eslint/core";
35
+ import type { CustomRuleDefinitionType, CustomRuleTypeDefinitions, CustomRuleVisitorWithExit } from "@eslint/plugin-kit";
36
+ import type { TokenType } from "@cldmv/jsonv/parser";
37
+ export type JsonvYear = 2011 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025;
38
+ export type JsonvMode = "jsonv" | "json5" | "json";
39
+ export type JsonvLanguageOptions = {
40
+ /**
41
+ * The ES year whose jsonv features are allowed. Defaults to `2025`.
42
+ */
43
+ year?: JsonvYear;
44
+ /**
45
+ * The parse mode. Defaults to `"jsonv"`.
46
+ */
47
+ mode?: JsonvMode;
48
+ /**
49
+ * When `true`, an integer outside the safe range without an `n` suffix is an error instead of
50
+ * being converted to a BigInt. Defaults to `false`.
51
+ */
52
+ strictBigInt?: boolean;
53
+ /**
54
+ * When `true`, a legacy octal literal such as `0755` is an error (`0o755` is still allowed).
55
+ * Defaults to `false`.
56
+ */
57
+ strictOctal?: boolean;
58
+ /**
59
+ * When `false`, internal references are left unresolved, so an undefined or
60
+ * circular reference is no longer reported. Defaults to `true`.
61
+ */
62
+ allowInternalReferences?: boolean;
63
+ };
64
+ export type JsonvLiteral = {
65
+ /**
66
+ * The node type.
67
+ */
68
+ type: "Literal";
69
+ /**
70
+ * The evaluated value.
71
+ */
72
+ value: string | number | bigint | boolean | null;
73
+ /**
74
+ * The source text.
75
+ */
76
+ raw: string;
77
+ /**
78
+ * The BigInt digits, for a BigInt literal.
79
+ */
80
+ bigint?: string;
81
+ /**
82
+ * The location (1-based lines and columns).
83
+ */
84
+ loc: SourceLocation;
85
+ /**
86
+ * The `[start, end)` source offsets.
87
+ */
88
+ range: SourceRange;
89
+ };
90
+ export type JsonvIdentifier = {
91
+ /**
92
+ * The node type.
93
+ */
94
+ type: "Identifier";
95
+ /**
96
+ * The identifier text.
97
+ */
98
+ name: string;
99
+ /**
100
+ * The location (1-based lines and columns).
101
+ */
102
+ loc: SourceLocation;
103
+ /**
104
+ * The `[start, end)` source offsets.
105
+ */
106
+ range: SourceRange;
107
+ };
108
+ export type JsonvObjectExpression = {
109
+ /**
110
+ * The node type.
111
+ */
112
+ type: "ObjectExpression";
113
+ /**
114
+ * The properties, in source order.
115
+ */
116
+ properties: JsonvProperty[];
117
+ /**
118
+ * The location (1-based lines and columns).
119
+ */
120
+ loc: SourceLocation;
121
+ /**
122
+ * The `[start, end)` source offsets.
123
+ */
124
+ range: SourceRange;
125
+ };
126
+ export type JsonvProperty = {
127
+ /**
128
+ * The node type.
129
+ */
130
+ type: "Property";
131
+ /**
132
+ * The key.
133
+ */
134
+ key: JsonvLiteral | JsonvIdentifier;
135
+ /**
136
+ * The value.
137
+ */
138
+ value: JsonvExpression;
139
+ /**
140
+ * Always `false` in jsonv.
141
+ */
142
+ computed: boolean;
143
+ /**
144
+ * The location (1-based lines and columns).
145
+ */
146
+ loc: SourceLocation;
147
+ /**
148
+ * The `[start, end)` source offsets.
149
+ */
150
+ range: SourceRange;
151
+ };
152
+ export type JsonvArrayExpression = {
153
+ /**
154
+ * The node type.
155
+ */
156
+ type: "ArrayExpression";
157
+ /**
158
+ * The elements, in source order.
159
+ */
160
+ elements: JsonvExpression[];
161
+ /**
162
+ * The location (1-based lines and columns).
163
+ */
164
+ loc: SourceLocation;
165
+ /**
166
+ * The `[start, end)` source offsets.
167
+ */
168
+ range: SourceRange;
169
+ };
170
+ export type JsonvMemberExpression = {
171
+ /**
172
+ * The node type.
173
+ */
174
+ type: "MemberExpression";
175
+ /**
176
+ * The object being accessed.
177
+ */
178
+ object: JsonvExpression;
179
+ /**
180
+ * The accessed property.
181
+ */
182
+ property: JsonvIdentifier;
183
+ /**
184
+ * Always `false`.
185
+ */
186
+ computed: false;
187
+ /**
188
+ * The location (1-based lines and columns).
189
+ */
190
+ loc: SourceLocation;
191
+ /**
192
+ * The `[start, end)` source offsets.
193
+ */
194
+ range: SourceRange;
195
+ };
196
+ export type JsonvTemplateElement = {
197
+ /**
198
+ * The node type.
199
+ */
200
+ type: "TemplateElement";
201
+ /**
202
+ * The raw and cooked segment text.
203
+ */
204
+ value: {
205
+ raw: string;
206
+ cooked: string;
207
+ };
208
+ /**
209
+ * Whether this is the last segment.
210
+ */
211
+ tail: boolean;
212
+ /**
213
+ * The location (1-based lines and columns).
214
+ */
215
+ loc: SourceLocation;
216
+ /**
217
+ * The `[start, end)` source offsets.
218
+ */
219
+ range: SourceRange;
220
+ };
221
+ export type JsonvTemplateLiteral = {
222
+ /**
223
+ * The node type.
224
+ */
225
+ type: "TemplateLiteral";
226
+ /**
227
+ * The string segments.
228
+ */
229
+ quasis: JsonvTemplateElement[];
230
+ /**
231
+ * The interpolated expressions.
232
+ */
233
+ expressions: JsonvExpression[];
234
+ /**
235
+ * The location (1-based lines and columns).
236
+ */
237
+ loc: SourceLocation;
238
+ /**
239
+ * The `[start, end)` source offsets.
240
+ */
241
+ range: SourceRange;
242
+ };
243
+ export type JsonvExpression = JsonvLiteral | JsonvObjectExpression | JsonvArrayExpression | JsonvIdentifier | JsonvTemplateLiteral | JsonvMemberExpression;
244
+ export type JsonvComment = {
245
+ /**
246
+ * The comment kind.
247
+ */
248
+ type: "Line" | "Block";
249
+ /**
250
+ * The comment text without its delimiters.
251
+ */
252
+ value: string;
253
+ /**
254
+ * The location (1-based lines and columns).
255
+ */
256
+ loc: SourceLocation;
257
+ /**
258
+ * The `[start, end)` source offsets.
259
+ */
260
+ range: SourceRange;
261
+ };
262
+ export type JsonvToken = {
263
+ /**
264
+ * The token type, e.g. `"{"`, `"String"`, `"Identifier"`, `"TemplateHead"`.
265
+ */
266
+ type: `${TokenType}`;
267
+ /**
268
+ * The token's value.
269
+ */
270
+ value: string | number | bigint | boolean | null;
271
+ /**
272
+ * The source text.
273
+ */
274
+ raw: string;
275
+ /**
276
+ * The location (1-based lines and columns).
277
+ */
278
+ loc: SourceLocation;
279
+ /**
280
+ * The `[start, end)` source offsets.
281
+ */
282
+ range: SourceRange;
283
+ };
284
+ export type JsonvProgram = {
285
+ /**
286
+ * The node type.
287
+ */
288
+ type: "Program";
289
+ /**
290
+ * The root value.
291
+ */
292
+ body: JsonvExpression;
293
+ /**
294
+ * The comments.
295
+ */
296
+ comments: JsonvComment[];
297
+ /**
298
+ * The tokens, excluding comments.
299
+ */
300
+ tokens: JsonvToken[];
301
+ /**
302
+ * The location of the whole document (1-based lines and columns).
303
+ */
304
+ loc: SourceLocation;
305
+ /**
306
+ * The `[start, end)` source offsets of the whole document.
307
+ */
308
+ range: SourceRange;
309
+ };
310
+ export type JsonvNode = JsonvProgram | JsonvExpression | JsonvProperty | JsonvTemplateElement;
311
+ export type JsonvSyntaxElement = JsonvNode | JsonvToken | JsonvComment;
312
+ export type JsonvLanguage = Language<{
313
+ LangOptions: JsonvLanguageOptions;
314
+ Code: JsonvSourceCode;
315
+ RootNode: JsonvProgram;
316
+ Node: JsonvNode;
317
+ }>;
318
+ export type JsonvOkParseResult = OkParseResult<JsonvProgram>;
319
+ export type JsonvParseResult = ParseResult<JsonvProgram>;
320
+ export type JsonvRuleVisitor = RuleVisitor & CustomRuleVisitorWithExit<{
321
+ Program?: (node: JsonvProgram) => void;
322
+ ObjectExpression?: (node: JsonvObjectExpression, parent?: JsonvNode) => void;
323
+ Property?: (node: JsonvProperty, parent?: JsonvObjectExpression) => void;
324
+ ArrayExpression?: (node: JsonvArrayExpression, parent?: JsonvNode) => void;
325
+ Literal?: (node: JsonvLiteral, parent?: JsonvNode) => void;
326
+ Identifier?: (node: JsonvIdentifier, parent?: JsonvNode) => void;
327
+ MemberExpression?: (node: JsonvMemberExpression, parent?: JsonvNode) => void;
328
+ TemplateLiteral?: (node: JsonvTemplateLiteral, parent?: JsonvNode) => void;
329
+ TemplateElement?: (node: JsonvTemplateElement, parent?: JsonvTemplateLiteral) => void;
330
+ }>;
331
+ export type JsonvRuleDefinition<Options extends Partial<CustomRuleTypeDefinitions> = {}> = CustomRuleDefinitionType<{
332
+ LangOptions: JsonvLanguageOptions;
333
+ Code: JsonvSourceCode;
334
+ Visitor: JsonvRuleVisitor;
335
+ Node: JsonvNode;
336
+ }, Options>;
337
+ /**
338
+ * SourceCode for a parsed `.jsonv` file, modelled on @eslint/json's `JSONSourceCode`:
339
+ * positions, lines and text helpers come from `TextSourceCodeBase`; this class adds AST
340
+ * traversal, parent lookup and inline configuration (`eslint-disable*` / `eslint-enable`
341
+ * directives and `/* eslint rule: ... *\/` config comments).
342
+ *
343
+ * @public
344
+ * @extends {TextSourceCodeBase<{LangOptions: JsonvLanguageOptions, RootNode: JsonvProgram, SyntaxElementWithLoc: JsonvSyntaxElement, ConfigNode: JsonvComment}>}
345
+ */
346
+ declare class JsonvSourceCode extends TextSourceCodeBase<{
347
+ LangOptions: JsonvLanguageOptions;
348
+ RootNode: JsonvProgram;
349
+ SyntaxElementWithLoc: JsonvSyntaxElement;
350
+ ConfigNode: JsonvComment;
351
+ }> {
352
+ #private;
353
+ /** @type {JsonvComment[]} Comments in source order. */
354
+ comments: JsonvComment[];
355
+ /** @type {JsonvToken[]} Tokens in source order, excluding comments. */
356
+ tokens: JsonvToken[];
357
+ /** @type {boolean} Whether the text starts with a byte order mark. */
358
+ hasBOM: boolean;
359
+ /**
360
+ * Creates a SourceCode object.
361
+ * @param {Object} options - Options.
362
+ * @param {string} options.text - The source text.
363
+ * @param {JsonvProgram} options.ast - The `Program` node built by `jsonvLanguage#parse`.
364
+ */
365
+ constructor({ text, ast }: {
366
+ text: string;
367
+ ast: JsonvProgram;
368
+ });
369
+ /**
370
+ * Returns the source text split into lines (a fresh copy of `lines`).
371
+ * @public
372
+ * @returns {string[]} The lines.
373
+ */
374
+ getLines(): string[];
375
+ /**
376
+ * Returns the enter/exit visit steps for every node, depth first in source order.
377
+ * @public
378
+ * @returns {IterableIterator<VisitNodeStep>} The traversal steps.
379
+ */
380
+ traverse(): IterableIterator<VisitNodeStep>;
381
+ /**
382
+ * Returns the parent of a node, or `undefined` for the `Program` root.
383
+ * @public
384
+ * @param {JsonvSyntaxElement} node - An AST node.
385
+ * @returns {JsonvNode|undefined} The parent node.
386
+ */
387
+ getParent(node: JsonvSyntaxElement): JsonvNode | undefined;
388
+ /**
389
+ * Returns the comments that hold inline configuration (`eslint`, `eslint-enable`,
390
+ * `eslint-disable`, `eslint-disable-line`, `eslint-disable-next-line`).
391
+ * @public
392
+ * @returns {JsonvComment[]} The inline configuration comments.
393
+ */
394
+ getInlineConfigNodes(): JsonvComment[];
395
+ /**
396
+ * Returns the `eslint-disable*` / `eslint-enable` directives, plus problems for malformed
397
+ * ones (an `eslint-disable-line` spanning several lines).
398
+ * @public
399
+ * @returns {{problems: FileProblem[], directives: Directive[]}} Directives and problems.
400
+ */
401
+ getDisableDirectives(): {
402
+ problems: FileProblem[];
403
+ directives: Directive[];
404
+ };
405
+ /**
406
+ * Returns the rule configurations from `/* eslint rule: ... *\/` comments, plus problems for
407
+ * ones that fail to parse.
408
+ * @public
409
+ * @returns {{problems: FileProblem[], configs: Array<{config: {rules: RulesConfig}, loc: SourceLocation}>}} Configs and problems.
410
+ */
411
+ applyInlineConfig(): {
412
+ problems: FileProblem[];
413
+ configs: Array<{
414
+ config: {
415
+ rules: RulesConfig;
416
+ };
417
+ loc: SourceLocation;
418
+ }>;
419
+ };
420
+ }
421
+ /**
422
+ * ESLint plugin export. `@satisfies` checks it against @eslint/core's `Plugin` (which ESLint's
423
+ * own `ESLint.Plugin` is) while keeping its literal keys (`languages.jsonv`, `configs.recommended`).
4
424
  *
5
425
  * @public
6
- * @type {Object}
426
+ * @satisfies {Plugin}
7
427
  */
8
- declare const plugin: Object;
428
+ declare const plugin: {
429
+ meta: {
430
+ name: string;
431
+ version: string;
432
+ };
433
+ languages: {
434
+ jsonv: JsonvLanguage;
435
+ };
436
+ configs: {
437
+ recommended: {
438
+ rules: {};
439
+ };
440
+ };
441
+ rules: {};
442
+ };
443
+ export default plugin;
444
+ export { JsonvSourceCode };
9
445
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../index.mjs"],"names":[],"mappings":";AAsRA;;;;;GAKG;AACH,sBAFU,MAAM,CAkBd"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../index.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG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