@eslint/json 0.13.2 → 1.0.0

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
@@ -4,7 +4,7 @@
4
4
 
5
5
  This package contains a plugin that allows you to natively lint JSON, JSONC, and JSON5 files using ESLint.
6
6
 
7
- **Important:** This plugin requires ESLint v9.6.0 or higher and you must be using the [new configuration system](https://eslint.org/docs/latest/use/configure/configuration-files).
7
+ **Important:** This plugin requires ESLint v9.15.0 or higher and you must be using the [new configuration system](https://eslint.org/docs/latest/use/configure/configuration-files).
8
8
 
9
9
  ## Installation
10
10
 
@@ -293,10 +293,10 @@ The following companies, organizations, and individuals support ESLint's ongoing
293
293
  to get your logo on our READMEs and [website](https://eslint.org/sponsors).
294
294
 
295
295
  <h3>Platinum Sponsors</h3>
296
- <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
297
- <p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
298
- <p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
299
- <p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
296
+ <p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a></p><h3>Gold Sponsors</h3>
297
+ <p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
298
+ <p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/d472863/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/2d6c3b6/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
299
+ <p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://opensource.sap.com"><img src="https://avatars.githubusercontent.com/u/2531208" alt="SAP" height="32"></a> <a href="https://www.crawljobs.com/"><img src="https://images.opencollective.com/crawljobs-poland/fa43a17/logo.png" alt="CrawlJobs" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.n-ix.com/"><img src="https://images.opencollective.com/n-ix-ltd/575a7a5/logo.png" alt="N-iX Ltd" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
300
300
  <h3>Technology Sponsors</h3>
301
301
  Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
302
302
  <p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
@@ -0,0 +1,7 @@
1
+ export default rules;
2
+ declare const rules: {
3
+ readonly "json/no-duplicate-keys": "error";
4
+ readonly "json/no-empty-keys": "error";
5
+ readonly "json/no-unnormalized-keys": "error";
6
+ readonly "json/no-unsafe-values": "error";
7
+ };
@@ -0,0 +1,7 @@
1
+ const rules = /** @type {const} */ ({
2
+ "json/no-duplicate-keys": "error",
3
+ "json/no-empty-keys": "error",
4
+ "json/no-unnormalized-keys": "error",
5
+ "json/no-unsafe-values": "error"
6
+ });
7
+ export default rules;
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ "no-duplicate-keys": import("../rules/no-duplicate-keys.js").NoDuplicateKeysRuleDefinition;
3
+ "no-empty-keys": import("../rules/no-empty-keys.js").NoEmptyKeysRuleDefinition;
4
+ "no-unnormalized-keys": import("../rules/no-unnormalized-keys.js").NoUnnormalizedKeysRuleDefinition;
5
+ "no-unsafe-values": import("../rules/no-unsafe-values.js").NoUnsafeValuesRuleDefinition;
6
+ "sort-keys": import("../rules/sort-keys.js").SortKeysRuleDefinition;
7
+ "top-level-interop": import("../rules/top-level-interop.js").TopLevelInteropRuleDefinition;
8
+ };
9
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import rule0 from "../rules/no-duplicate-keys.js";
2
+ import rule1 from "../rules/no-empty-keys.js";
3
+ import rule2 from "../rules/no-unnormalized-keys.js";
4
+ import rule3 from "../rules/no-unsafe-values.js";
5
+ import rule4 from "../rules/sort-keys.js";
6
+ import rule5 from "../rules/top-level-interop.js";
7
+ export default {
8
+ "no-duplicate-keys": rule0,
9
+ "no-empty-keys": rule1,
10
+ "no-unnormalized-keys": rule2,
11
+ "no-unsafe-values": rule3,
12
+ "sort-keys": rule4,
13
+ "top-level-interop": rule5,
14
+ };
@@ -0,0 +1,28 @@
1
+ export default plugin;
2
+ export { JSONSourceCode };
3
+ export * from "./languages/json-language.js";
4
+ export * from "./types.js";
5
+ declare namespace plugin {
6
+ export namespace meta {
7
+ let name: string;
8
+ let version: string;
9
+ }
10
+ export namespace languages {
11
+ let json: JSONLanguage;
12
+ let jsonc: JSONLanguage;
13
+ let json5: JSONLanguage;
14
+ }
15
+ export { rules };
16
+ export namespace configs {
17
+ namespace recommended {
18
+ let name_1: string;
19
+ export { name_1 as name };
20
+ export let plugins: {};
21
+ export { recommendedRules as rules };
22
+ }
23
+ }
24
+ }
25
+ import { JSONSourceCode } from "./languages/json-source-code.js";
26
+ import { JSONLanguage } from "./languages/json-language.js";
27
+ import rules from "./build/rules.js";
28
+ import recommendedRules from "./build/recommended-config.js";
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @fileoverview JSON plugin.
3
+ * @author Nicholas C. Zakas
4
+ */
5
+ //-----------------------------------------------------------------------------
6
+ // Imports
7
+ //-----------------------------------------------------------------------------
8
+ import { JSONLanguage } from "./languages/json-language.js";
9
+ import { JSONSourceCode } from "./languages/json-source-code.js";
10
+ import recommendedRules from "./build/recommended-config.js";
11
+ import rules from "./build/rules.js";
12
+ //-----------------------------------------------------------------------------
13
+ // Plugin
14
+ //-----------------------------------------------------------------------------
15
+ const plugin = {
16
+ meta: {
17
+ name: "@eslint/json",
18
+ version: "1.0.0", // x-release-please-version
19
+ },
20
+ languages: {
21
+ json: new JSONLanguage({ mode: "json" }),
22
+ jsonc: new JSONLanguage({ mode: "jsonc" }),
23
+ json5: new JSONLanguage({ mode: "json5" }),
24
+ },
25
+ rules,
26
+ configs: {
27
+ recommended: {
28
+ name: "@eslint/json/recommended",
29
+ plugins: {},
30
+ rules: recommendedRules,
31
+ },
32
+ },
33
+ };
34
+ // eslint-disable-next-line no-lone-blocks -- The block syntax { ... } ensures that TypeScript does not get confused about the type of `plugin`.
35
+ {
36
+ plugin.configs.recommended.plugins.json = plugin;
37
+ }
38
+ export default plugin;
39
+ export { JSONSourceCode };
40
+ export * from "./languages/json-language.js";
41
+ export * from "./types.js";
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @import { DocumentNode, AnyNode } from "@humanwhocodes/momoa";
3
+ * @import { Language, OkParseResult, ParseResult, File } from "@eslint/core";
4
+ * @typedef {OkParseResult<DocumentNode>} JSONOkParseResult
5
+ * @typedef {ParseResult<DocumentNode>} JSONParseResult
6
+ * @typedef {Object} JSONLanguageOptions
7
+ * @property {boolean} [allowTrailingCommas] Whether to allow trailing commas in JSONC mode.
8
+ */
9
+ /**
10
+ * JSON Language Object
11
+ * @implements {Language<{ LangOptions: JSONLanguageOptions; Code: JSONSourceCode; RootNode: DocumentNode; Node: AnyNode }>}
12
+ */
13
+ export class JSONLanguage implements Language {
14
+ /**
15
+ * Creates a new instance.
16
+ * @param {Object} options The options to use for this instance.
17
+ * @param {"json"|"jsonc"|"json5"} options.mode The parser mode to use.
18
+ */
19
+ constructor({ mode }: {
20
+ mode: "json" | "jsonc" | "json5";
21
+ });
22
+ /**
23
+ * The type of file to read.
24
+ * @type {"text"}
25
+ */
26
+ fileType: "text";
27
+ /**
28
+ * The line number at which the parser starts counting.
29
+ * @type {0|1}
30
+ */
31
+ lineStart: 0 | 1;
32
+ /**
33
+ * The column number at which the parser starts counting.
34
+ * @type {0|1}
35
+ */
36
+ columnStart: 0 | 1;
37
+ /**
38
+ * The name of the key that holds the type of the node.
39
+ * @type {string}
40
+ */
41
+ nodeTypeKey: string;
42
+ /**
43
+ * The visitor keys.
44
+ * @type {Record<string, string[]>}
45
+ */
46
+ visitorKeys: Record<string, string[]>;
47
+ /**
48
+ * Validates the language options.
49
+ * @param {JSONLanguageOptions} languageOptions The language options to validate.
50
+ * @returns {void}
51
+ * @throws {Error} When the language options are invalid.
52
+ */
53
+ validateLanguageOptions(languageOptions: JSONLanguageOptions): void;
54
+ /**
55
+ * Parses the given file into an AST.
56
+ * @param {File} file The virtual file to parse.
57
+ * @param {{languageOptions: JSONLanguageOptions}} context The options to use for parsing.
58
+ * @returns {JSONParseResult} The result of parsing.
59
+ */
60
+ parse(file: File, context: {
61
+ languageOptions: JSONLanguageOptions;
62
+ }): JSONParseResult;
63
+ /**
64
+ * Creates a new `JSONSourceCode` object from the given information.
65
+ * @param {File} file The virtual file to create a `JSONSourceCode` object from.
66
+ * @param {JSONOkParseResult} parseResult The result returned from `parse()`.
67
+ * @returns {JSONSourceCode} The new `JSONSourceCode` object.
68
+ */
69
+ createSourceCode(file: File, parseResult: JSONOkParseResult): JSONSourceCode;
70
+ #private;
71
+ }
72
+ export type JSONOkParseResult = OkParseResult<DocumentNode>;
73
+ export type JSONParseResult = ParseResult<DocumentNode>;
74
+ export type JSONLanguageOptions = {
75
+ /**
76
+ * Whether to allow trailing commas in JSONC mode.
77
+ */
78
+ allowTrailingCommas?: boolean;
79
+ };
80
+ import type { Language } from "@eslint/core";
81
+ import type { File } from "@eslint/core";
82
+ import { JSONSourceCode } from "./json-source-code.js";
83
+ import type { DocumentNode } from "@humanwhocodes/momoa";
84
+ import type { OkParseResult } from "@eslint/core";
85
+ import type { ParseResult } from "@eslint/core";
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @fileoverview The JSONLanguage class.
3
+ * @author Nicholas C. Zakas
4
+ */
5
+ //------------------------------------------------------------------------------
6
+ // Imports
7
+ //------------------------------------------------------------------------------
8
+ import { parse } from "@humanwhocodes/momoa";
9
+ import { JSONSourceCode } from "./json-source-code.js";
10
+ import { visitorKeys } from "@humanwhocodes/momoa";
11
+ //-----------------------------------------------------------------------------
12
+ // Types
13
+ //-----------------------------------------------------------------------------
14
+ /**
15
+ * @import { DocumentNode, AnyNode } from "@humanwhocodes/momoa";
16
+ * @import { Language, OkParseResult, ParseResult, File } from "@eslint/core";
17
+ * @typedef {OkParseResult<DocumentNode>} JSONOkParseResult
18
+ * @typedef {ParseResult<DocumentNode>} JSONParseResult
19
+ * @typedef {Object} JSONLanguageOptions
20
+ * @property {boolean} [allowTrailingCommas] Whether to allow trailing commas in JSONC mode.
21
+ */
22
+ //-----------------------------------------------------------------------------
23
+ // Exports
24
+ //-----------------------------------------------------------------------------
25
+ /**
26
+ * JSON Language Object
27
+ * @implements {Language<{ LangOptions: JSONLanguageOptions; Code: JSONSourceCode; RootNode: DocumentNode; Node: AnyNode }>}
28
+ */
29
+ export class JSONLanguage {
30
+ /**
31
+ * The type of file to read.
32
+ * @type {"text"}
33
+ */
34
+ fileType = "text";
35
+ /**
36
+ * The line number at which the parser starts counting.
37
+ * @type {0|1}
38
+ */
39
+ lineStart = 1;
40
+ /**
41
+ * The column number at which the parser starts counting.
42
+ * @type {0|1}
43
+ */
44
+ columnStart = 1;
45
+ /**
46
+ * The name of the key that holds the type of the node.
47
+ * @type {string}
48
+ */
49
+ nodeTypeKey = "type";
50
+ /**
51
+ * The parser mode.
52
+ * @type {"json"|"jsonc"|"json5"}
53
+ */
54
+ #mode = "json";
55
+ /**
56
+ * The visitor keys.
57
+ * @type {Record<string, string[]>}
58
+ */
59
+ visitorKeys = Object.fromEntries([...visitorKeys]);
60
+ /**
61
+ * Creates a new instance.
62
+ * @param {Object} options The options to use for this instance.
63
+ * @param {"json"|"jsonc"|"json5"} options.mode The parser mode to use.
64
+ */
65
+ constructor({ mode }) {
66
+ this.#mode = mode;
67
+ }
68
+ /**
69
+ * Validates the language options.
70
+ * @param {JSONLanguageOptions} languageOptions The language options to validate.
71
+ * @returns {void}
72
+ * @throws {Error} When the language options are invalid.
73
+ */
74
+ validateLanguageOptions(languageOptions) {
75
+ if (languageOptions.allowTrailingCommas !== undefined) {
76
+ if (typeof languageOptions.allowTrailingCommas !== "boolean") {
77
+ throw new Error("allowTrailingCommas must be a boolean if provided.");
78
+ }
79
+ // we know that allowTrailingCommas is a boolean here
80
+ // only allowed in JSONC mode
81
+ if (this.#mode !== "jsonc") {
82
+ throw new Error("allowTrailingCommas option is only available in JSONC.");
83
+ }
84
+ }
85
+ }
86
+ /**
87
+ * Parses the given file into an AST.
88
+ * @param {File} file The virtual file to parse.
89
+ * @param {{languageOptions: JSONLanguageOptions}} context The options to use for parsing.
90
+ * @returns {JSONParseResult} The result of parsing.
91
+ */
92
+ parse(file, context) {
93
+ // Note: BOM already removed
94
+ const text = /** @type {string} */ (file.body);
95
+ const allowTrailingCommas = context?.languageOptions?.allowTrailingCommas;
96
+ /*
97
+ * Check for parsing errors first. If there's a parsing error, nothing
98
+ * else can happen. However, a parsing error does not throw an error
99
+ * from this method - it's just considered a fatal error message, a
100
+ * problem that ESLint identified just like any other.
101
+ */
102
+ try {
103
+ const root = parse(text, {
104
+ mode: this.#mode,
105
+ ranges: true,
106
+ tokens: true,
107
+ allowTrailingCommas,
108
+ });
109
+ return {
110
+ ok: true,
111
+ ast: root,
112
+ };
113
+ }
114
+ catch (ex) {
115
+ // error messages end with (line:column) so we strip that off for ESLint
116
+ const message = ex.message
117
+ .slice(0, ex.message.lastIndexOf("("))
118
+ .trim();
119
+ return {
120
+ ok: false,
121
+ errors: [
122
+ {
123
+ ...ex,
124
+ message,
125
+ },
126
+ ],
127
+ };
128
+ }
129
+ }
130
+ /* eslint-disable class-methods-use-this -- Required to complete interface. */
131
+ /**
132
+ * Creates a new `JSONSourceCode` object from the given information.
133
+ * @param {File} file The virtual file to create a `JSONSourceCode` object from.
134
+ * @param {JSONOkParseResult} parseResult The result returned from `parse()`.
135
+ * @returns {JSONSourceCode} The new `JSONSourceCode` object.
136
+ */
137
+ createSourceCode(file, parseResult) {
138
+ return new JSONSourceCode({
139
+ text: /** @type {string} */ (file.body),
140
+ ast: parseResult.ast,
141
+ });
142
+ }
143
+ }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * JSON Source Code Object
3
+ * @extends {TextSourceCodeBase<{LangOptions: JSONLanguageOptions, RootNode: DocumentNode, SyntaxElementWithLoc: JSONSyntaxElement, ConfigNode: Token}>}
4
+ */
5
+ export class JSONSourceCode extends TextSourceCodeBase<{
6
+ LangOptions: JSONLanguageOptions;
7
+ RootNode: DocumentNode;
8
+ SyntaxElementWithLoc: JSONSyntaxElement;
9
+ ConfigNode: Token;
10
+ }> {
11
+ /**
12
+ * Creates a new instance.
13
+ * @param {Object} options The options for the instance.
14
+ * @param {string} options.text The source code text.
15
+ * @param {DocumentNode} options.ast The root AST node.
16
+ */
17
+ constructor({ text, ast }: {
18
+ text: string;
19
+ ast: DocumentNode;
20
+ });
21
+ /**
22
+ * The comment tokens in the source code.
23
+ * @type {Array<Token>|undefined}
24
+ */
25
+ comments: Array<Token> | undefined;
26
+ /**
27
+ * Returns an array of all inline configuration nodes found in the
28
+ * source code.
29
+ * @returns {Array<Token>} An array of all inline configuration nodes.
30
+ */
31
+ getInlineConfigNodes(): Array<Token>;
32
+ /**
33
+ * Returns directives that enable or disable rules along with any problems
34
+ * encountered while parsing the directives.
35
+ * @returns {{problems:Array<FileProblem>,directives:Array<Directive>}} Information
36
+ * that ESLint needs to further process the directives.
37
+ */
38
+ getDisableDirectives(): {
39
+ problems: Array<FileProblem>;
40
+ directives: Array<Directive>;
41
+ };
42
+ /**
43
+ * Returns inline rule configurations along with any problems
44
+ * encountered while parsing the configurations.
45
+ * @returns {{problems:Array<FileProblem>,configs:Array<{config:{rules:RulesConfig},loc:LocationRange}>}} Information
46
+ * that ESLint needs to further process the rule configurations.
47
+ */
48
+ applyInlineConfig(): {
49
+ problems: Array<FileProblem>;
50
+ configs: Array<{
51
+ config: {
52
+ rules: RulesConfig;
53
+ };
54
+ loc: LocationRange;
55
+ }>;
56
+ };
57
+ /**
58
+ * Returns the parent of the given node.
59
+ * @param {AnyNode} node The node to get the parent of.
60
+ * @returns {AnyNode|undefined} The parent of the node.
61
+ */
62
+ getParent(node: AnyNode): AnyNode | undefined;
63
+ /**
64
+ * Traverse the source code and return the steps that were taken.
65
+ * @returns {Iterable<JSONTraversalStep>} The steps that were taken while traversing the source code.
66
+ */
67
+ traverse(): Iterable<JSONTraversalStep>;
68
+ /**
69
+ * Gets the token before the given node or token, optionally including comments.
70
+ * @param {AnyNode|Token} nodeOrToken The node or token to get the previous token for.
71
+ * @param {Object} [options] Options object.
72
+ * @param {boolean} [options.includeComments] If true, return comments when they are present.
73
+ * @returns {Token|null} The previous token or comment, or null if there is none.
74
+ */
75
+ getTokenBefore(nodeOrToken: AnyNode | Token, { includeComments }?: {
76
+ includeComments?: boolean;
77
+ }): Token | null;
78
+ /**
79
+ * Gets the token after the given node or token, skipping any comments unless includeComments is true.
80
+ * @param {AnyNode|Token} nodeOrToken The node or token to get the next token for.
81
+ * @param {Object} [options] Options object.
82
+ * @param {boolean} [options.includeComments=false] If true, return comments when they are present.
83
+ * @returns {Token|null} The next token or comment, or null if there is none.
84
+ */
85
+ getTokenAfter(nodeOrToken: AnyNode | Token, { includeComments }?: {
86
+ includeComments?: boolean;
87
+ }): Token | null;
88
+ #private;
89
+ }
90
+ import type { JSONLanguageOptions } from "./json-language.js";
91
+ import type { DocumentNode } from "@humanwhocodes/momoa";
92
+ import type { JSONSyntaxElement } from "../types.js";
93
+ import type { Token } from "@humanwhocodes/momoa";
94
+ import { TextSourceCodeBase } from "@eslint/plugin-kit";
95
+ import type { FileProblem } from "@eslint/core";
96
+ import { Directive } from "@eslint/plugin-kit";
97
+ import type { RulesConfig } from "@eslint/core";
98
+ import type { LocationRange } from "@humanwhocodes/momoa";
99
+ import type { AnyNode } from "@humanwhocodes/momoa";
100
+ /**
101
+ * A class to represent a step in the traversal process.
102
+ */
103
+ declare class JSONTraversalStep extends VisitNodeStep {
104
+ /**
105
+ * Creates a new instance.
106
+ * @param {Object} options The options for the step.
107
+ * @param {AnyNode} options.target The target of the step.
108
+ * @param {1|2} options.phase The phase of the step.
109
+ * @param {Array<any>} options.args The arguments of the step.
110
+ */
111
+ constructor({ target, phase, args }: {
112
+ target: AnyNode;
113
+ phase: 1 | 2;
114
+ args: Array<any>;
115
+ });
116
+ /**
117
+ * The target of the step.
118
+ * @type {AnyNode}
119
+ */
120
+ target: AnyNode;
121
+ }
122
+ import { VisitNodeStep } from "@eslint/plugin-kit";
123
+ export {};