@@ -19,19 +19,12 @@ import {
19
19
// Types
20
20
//-----------------------------------------------------------------------------
21
21
22
- /** @typedef {import("@humanwhocodes/momoa").DocumentNode } DocumentNode */
23
- /** @typedef {import("@humanwhocodes/momoa").Node } JSONNode */
24
- /** @typedef {import("@humanwhocodes/momoa").Token } JSONToken */
25
- /** @typedef {import("@eslint/core").SourceRange } SourceRange */
26
- /** @typedef {import("@eslint/core").SourceLocation } SourceLocation */
27
- /** @typedef {import("@eslint/core").File } File */
28
- /** @typedef {import("@eslint/core").TraversalStep } TraversalStep */
29
- /** @typedef {import("@eslint/core").VisitTraversalStep } VisitTraversalStep */
30
- /** @typedef {import("@eslint/core").FileProblem } FileProblem */
31
- /** @typedef {import("@eslint/core").DirectiveType } DirectiveType */
32
- /** @typedef {import("@eslint/core").RulesConfig } RulesConfig */
33
- /** @typedef {import("../types.ts").IJSONSourceCode } IJSONSourceCode */
34
- /** @typedef {import("../types.ts").JSONSyntaxElement } JSONSyntaxElement */
22
+ /**
23
+ * @import { DocumentNode, Node, Token } from "@humanwhocodes/momoa";
24
+ * @import { SourceLocation, FileProblem, DirectiveType, RulesConfig, TextSourceCode} from "@eslint/core";
25
+ * @import { JSONSyntaxElement } from "../types.ts";
26
+ * @import { JSONLanguageOptions } from "./json-language.js";
27
+ */
35
28
36
29
//-----------------------------------------------------------------------------
37
30
// Helpers
@@ -48,14 +41,14 @@ const INLINE_CONFIG =
48
41
class JSONTraversalStep extends VisitNodeStep {
49
42
/**
50
43
* The target of the step.
51
- * @type {JSONNode }
44
+ * @type {Node }
52
45
*/
53
46
target = undefined ;
54
47
55
48
/**
56
49
* Creates a new instance.
57
50
* @param {Object } options The options for the step.
58
- * @param {JSONNode } options.target The target of the step.
51
+ * @param {Node } options.target The target of the step.
59
52
* @param {1|2 } options.phase The phase of the step.
60
53
* @param {Array<any> } options.args The arguments of the step.
61
54
*/
@@ -72,7 +65,7 @@ class JSONTraversalStep extends VisitNodeStep {
72
65
73
66
/**
74
67
* JSON Source Code Object
75
- * @implements {IJSONSourceCode }
68
+ * @implements {TextSourceCode<{LangOptions: JSONLanguageOptions, RootNode: DocumentNode, SyntaxElementWithLoc: JSONSyntaxElement, ConfigNode: Token} > }
76
69
*/
77
70
export class JSONSourceCode extends TextSourceCodeBase {
78
71
/**
@@ -83,13 +76,13 @@ export class JSONSourceCode extends TextSourceCodeBase {
83
76
84
77
/**
85
78
* Cache of parent nodes.
86
- * @type {WeakMap<JSONNode, JSONNode > }
79
+ * @type {WeakMap<Node, Node > }
87
80
*/
88
81
#parents = new WeakMap ( ) ;
89
82
90
83
/**
91
84
* Collection of inline configuration comments.
92
- * @type {Array<JSONToken > }
85
+ * @type {Array<Token > }
93
86
*/
94
87
#inlineConfigComments;
95
88
@@ -101,7 +94,7 @@ export class JSONSourceCode extends TextSourceCodeBase {
101
94
102
95
/**
103
96
* The comment node in the source code.
104
- * @type {Array<JSONToken >|undefined }
97
+ * @type {Array<Token >|undefined }
105
98
*/
106
99
comments ;
107
100
@@ -121,7 +114,7 @@ export class JSONSourceCode extends TextSourceCodeBase {
121
114
122
115
/**
123
116
* Returns the value of the given comment.
124
- * @param {JSONToken } comment The comment to get the value of.
117
+ * @param {Token } comment The comment to get the value of.
125
118
* @returns {string } The value of the comment.
126
119
* @throws {Error } When an unexpected comment type is passed.
127
120
*/
@@ -140,7 +133,7 @@ export class JSONSourceCode extends TextSourceCodeBase {
140
133
/**
141
134
* Returns an array of all inline configuration nodes found in the
142
135
* source code.
143
- * @returns {Array<JSONToken > } An array of all inline configuration nodes.
136
+ * @returns {Array<Token > } An array of all inline configuration nodes.
144
137
*/
145
138
getInlineConfigNodes ( ) {
146
139
if ( ! this . #inlineConfigComments) {
@@ -251,8 +244,8 @@ export class JSONSourceCode extends TextSourceCodeBase {
251
244
252
245
/**
253
246
* Returns the parent of the given node.
254
- * @param {JSONNode } node The node to get the parent of.
255
- * @returns {JSONNode |undefined } The parent of the node.
247
+ * @param {Node } node The node to get the parent of.
248
+ * @returns {Node |undefined } The parent of the node.
256
249
*/
257
250
getParent ( node ) {
258
251
return this . #parents. get ( node ) ;
0 commit comments