@@ -19,19 +19,12 @@ import {
1919// Types
2020//-----------------------------------------------------------------------------
2121
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+ */
3528
3629//-----------------------------------------------------------------------------
3730// Helpers
@@ -48,14 +41,14 @@ const INLINE_CONFIG =
4841class JSONTraversalStep extends VisitNodeStep {
4942 /**
5043 * The target of the step.
51- * @type {JSONNode }
44+ * @type {Node }
5245 */
5346 target = undefined ;
5447
5548 /**
5649 * Creates a new instance.
5750 * @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.
5952 * @param {1|2 } options.phase The phase of the step.
6053 * @param {Array<any> } options.args The arguments of the step.
6154 */
@@ -72,7 +65,7 @@ class JSONTraversalStep extends VisitNodeStep {
7265
7366/**
7467 * JSON Source Code Object
75- * @implements {IJSONSourceCode }
68+ * @implements {TextSourceCode<{LangOptions: JSONLanguageOptions, RootNode: DocumentNode, SyntaxElementWithLoc: JSONSyntaxElement, ConfigNode: Token} > }
7669 */
7770export class JSONSourceCode extends TextSourceCodeBase {
7871 /**
@@ -83,13 +76,13 @@ export class JSONSourceCode extends TextSourceCodeBase {
8376
8477 /**
8578 * Cache of parent nodes.
86- * @type {WeakMap<JSONNode, JSONNode > }
79+ * @type {WeakMap<Node, Node > }
8780 */
8881 #parents = new WeakMap ( ) ;
8982
9083 /**
9184 * Collection of inline configuration comments.
92- * @type {Array<JSONToken > }
85+ * @type {Array<Token > }
9386 */
9487 #inlineConfigComments;
9588
@@ -101,7 +94,7 @@ export class JSONSourceCode extends TextSourceCodeBase {
10194
10295 /**
10396 * The comment node in the source code.
104- * @type {Array<JSONToken >|undefined }
97+ * @type {Array<Token >|undefined }
10598 */
10699 comments ;
107100
@@ -121,7 +114,7 @@ export class JSONSourceCode extends TextSourceCodeBase {
121114
122115 /**
123116 * 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.
125118 * @returns {string } The value of the comment.
126119 * @throws {Error } When an unexpected comment type is passed.
127120 */
@@ -140,7 +133,7 @@ export class JSONSourceCode extends TextSourceCodeBase {
140133 /**
141134 * Returns an array of all inline configuration nodes found in the
142135 * source code.
143- * @returns {Array<JSONToken > } An array of all inline configuration nodes.
136+ * @returns {Array<Token > } An array of all inline configuration nodes.
144137 */
145138 getInlineConfigNodes ( ) {
146139 if ( ! this . #inlineConfigComments) {
@@ -251,8 +244,8 @@ export class JSONSourceCode extends TextSourceCodeBase {
251244
252245 /**
253246 * 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.
256249 */
257250 getParent ( node ) {
258251 return this . #parents. get ( node ) ;
0 commit comments