eslint-plugin-yml 1.19.1 → 2.0.1

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.
Files changed (97) hide show
  1. package/README.md +60 -66
  2. package/lib/chunk-15K8U1wQ.mjs +18 -0
  3. package/lib/index.d.mts +217 -0
  4. package/lib/index.mjs +5910 -0
  5. package/package.json +32 -25
  6. package/lib/configs/base.d.ts +0 -13
  7. package/lib/configs/base.js +0 -15
  8. package/lib/configs/flat/base.d.ts +0 -22
  9. package/lib/configs/flat/base.js +0 -56
  10. package/lib/configs/flat/prettier.d.ts +0 -35
  11. package/lib/configs/flat/prettier.js +0 -25
  12. package/lib/configs/flat/recommended.d.ts +0 -30
  13. package/lib/configs/flat/recommended.js +0 -20
  14. package/lib/configs/flat/standard.d.ts +0 -43
  15. package/lib/configs/flat/standard.js +0 -33
  16. package/lib/configs/prettier.d.ts +0 -18
  17. package/lib/configs/prettier.js +0 -24
  18. package/lib/configs/recommended.d.ts +0 -13
  19. package/lib/configs/recommended.js +0 -19
  20. package/lib/configs/standard.d.ts +0 -26
  21. package/lib/configs/standard.js +0 -32
  22. package/lib/index.d.ts +0 -201
  23. package/lib/index.js +0 -66
  24. package/lib/meta.d.ts +0 -2
  25. package/lib/meta.js +0 -5
  26. package/lib/rules/block-mapping-colon-indicator-newline.d.ts +0 -2
  27. package/lib/rules/block-mapping-colon-indicator-newline.js +0 -107
  28. package/lib/rules/block-mapping-question-indicator-newline.d.ts +0 -2
  29. package/lib/rules/block-mapping-question-indicator-newline.js +0 -80
  30. package/lib/rules/block-mapping.d.ts +0 -2
  31. package/lib/rules/block-mapping.js +0 -270
  32. package/lib/rules/block-sequence-hyphen-indicator-newline.d.ts +0 -2
  33. package/lib/rules/block-sequence-hyphen-indicator-newline.js +0 -98
  34. package/lib/rules/block-sequence.d.ts +0 -2
  35. package/lib/rules/block-sequence.js +0 -326
  36. package/lib/rules/file-extension.d.ts +0 -2
  37. package/lib/rules/file-extension.js +0 -64
  38. package/lib/rules/flow-mapping-curly-newline.d.ts +0 -2
  39. package/lib/rules/flow-mapping-curly-newline.js +0 -182
  40. package/lib/rules/flow-mapping-curly-spacing.d.ts +0 -2
  41. package/lib/rules/flow-mapping-curly-spacing.js +0 -192
  42. package/lib/rules/flow-sequence-bracket-newline.d.ts +0 -2
  43. package/lib/rules/flow-sequence-bracket-newline.js +0 -197
  44. package/lib/rules/flow-sequence-bracket-spacing.d.ts +0 -2
  45. package/lib/rules/flow-sequence-bracket-spacing.js +0 -184
  46. package/lib/rules/indent.d.ts +0 -2
  47. package/lib/rules/indent.js +0 -762
  48. package/lib/rules/key-name-casing.d.ts +0 -2
  49. package/lib/rules/key-name-casing.js +0 -99
  50. package/lib/rules/key-spacing.d.ts +0 -2
  51. package/lib/rules/key-spacing.js +0 -465
  52. package/lib/rules/no-empty-document.d.ts +0 -2
  53. package/lib/rules/no-empty-document.js +0 -45
  54. package/lib/rules/no-empty-key.d.ts +0 -2
  55. package/lib/rules/no-empty-key.js +0 -45
  56. package/lib/rules/no-empty-mapping-value.d.ts +0 -2
  57. package/lib/rules/no-empty-mapping-value.js +0 -45
  58. package/lib/rules/no-empty-sequence-entry.d.ts +0 -2
  59. package/lib/rules/no-empty-sequence-entry.js +0 -68
  60. package/lib/rules/no-irregular-whitespace.d.ts +0 -2
  61. package/lib/rules/no-irregular-whitespace.js +0 -93
  62. package/lib/rules/no-multiple-empty-lines.d.ts +0 -2
  63. package/lib/rules/no-multiple-empty-lines.js +0 -131
  64. package/lib/rules/no-tab-indent.d.ts +0 -2
  65. package/lib/rules/no-tab-indent.js +0 -50
  66. package/lib/rules/no-trailing-zeros.d.ts +0 -2
  67. package/lib/rules/no-trailing-zeros.js +0 -97
  68. package/lib/rules/plain-scalar.d.ts +0 -2
  69. package/lib/rules/plain-scalar.js +0 -208
  70. package/lib/rules/quotes.d.ts +0 -2
  71. package/lib/rules/quotes.js +0 -89
  72. package/lib/rules/require-string-key.d.ts +0 -2
  73. package/lib/rules/require-string-key.js +0 -82
  74. package/lib/rules/sort-keys.d.ts +0 -2
  75. package/lib/rules/sort-keys.js +0 -804
  76. package/lib/rules/sort-sequence-values.d.ts +0 -2
  77. package/lib/rules/sort-sequence-values.js +0 -656
  78. package/lib/rules/spaced-comment.d.ts +0 -2
  79. package/lib/rules/spaced-comment.js +0 -164
  80. package/lib/rules/vue-custom-block/no-parsing-error.d.ts +0 -2
  81. package/lib/rules/vue-custom-block/no-parsing-error.js +0 -45
  82. package/lib/types.d.ts +0 -211
  83. package/lib/types.js +0 -2
  84. package/lib/utils/ast-utils.d.ts +0 -14
  85. package/lib/utils/ast-utils.js +0 -42
  86. package/lib/utils/calc-shortest-edit-script.d.ts +0 -15
  87. package/lib/utils/calc-shortest-edit-script.js +0 -44
  88. package/lib/utils/casing.d.ts +0 -15
  89. package/lib/utils/casing.js +0 -134
  90. package/lib/utils/compat.d.ts +0 -5
  91. package/lib/utils/compat.js +0 -11
  92. package/lib/utils/index.d.ts +0 -2
  93. package/lib/utils/index.js +0 -66
  94. package/lib/utils/rules.d.ts +0 -2
  95. package/lib/utils/rules.js +0 -64
  96. package/lib/utils/yaml.d.ts +0 -15
  97. package/lib/utils/yaml.js +0 -265
package/README.md CHANGED
@@ -53,8 +53,8 @@ npm install --save-dev eslint eslint-plugin-yml
53
53
 
54
54
  > **Requirements**
55
55
  >
56
- > - ESLint v6.0.0 and above
57
- > - Node.js v14.17.x, v16.x and above
56
+ > - ESLint v9.38.0 and above
57
+ > - Node.js v20.19.0 or higher (in the 20.x line), v22.13.0 or higher (in the 22.x line), or v24.0.0 and above
58
58
 
59
59
  <!--DOCS_IGNORE_END-->
60
60
 
@@ -65,8 +65,6 @@ npm install --save-dev eslint eslint-plugin-yml
65
65
 
66
66
  ### Configuration
67
67
 
68
- #### New Config (`eslint.config.js`)
69
-
70
68
  Use `eslint.config.js` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/configuration-files-new>.
71
69
 
72
70
  Example **eslint.config.js**:
@@ -76,7 +74,7 @@ import eslintPluginYml from 'eslint-plugin-yml';
76
74
  export default [
77
75
  // add more generic rule sets here, such as:
78
76
  // js.configs.recommended,
79
- ...eslintPluginYml.configs['flat/recommended'],
77
+ ...eslintPluginYml.configs.recommended,
80
78
  {
81
79
  rules: {
82
80
  // override/add rules settings here, such as:
@@ -88,41 +86,14 @@ export default [
88
86
 
89
87
  This plugin provides configs:
90
88
 
91
- - `*.configs['flat/base']` ... Configuration to enable correct YAML parsing.
92
- - `*.configs['flat/recommended']` ... Above, plus rules to prevent errors or unintended behavior.
93
- - `*.configs['flat/standard']` ... Above, plus rules to enforce the common stylistic conventions.
94
- - `*.configs['flat/prettier']` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
89
+ - `*.configs.base` ... Configuration to enable correct YAML parsing.
90
+ - `*.configs.recommended` ... Above, plus rules to prevent errors or unintended behavior.
91
+ - `*.configs.standard` ... Above, plus rules to enforce the common stylistic conventions.
92
+ - `*.configs.prettier` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
95
93
 
96
94
  See [the rule list](https://ota-meshi.github.io/eslint-plugin-yml/rules/) to get the `rules` that this plugin provides.
97
95
 
98
- #### Legacy Config (`.eslintrc`)
99
-
100
- Use `.eslintrc.*` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/>.
101
-
102
- Example **.eslintrc.js**:
103
-
104
- ```js
105
- module.exports = {
106
- extends: [
107
- // add more generic rulesets here, such as:
108
- // 'eslint:recommended',
109
- "plugin:yml/standard",
110
- ],
111
- rules: {
112
- // override/add rules settings here, such as:
113
- // 'yml/rule-name': 'error'
114
- },
115
- };
116
- ```
117
-
118
- This plugin provides configs:
119
-
120
- - `plugin:yml/base` ... Configuration to enable correct YAML parsing.
121
- - `plugin:yml/recommended` ... Above, plus rules to prevent errors or unintended behavior.
122
- - `plugin:yml/standard` ... Above, plus rules to enforce the common stylistic conventions.
123
- - `plugin:yml/prettier` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
124
-
125
- See [the rule list](https://ota-meshi.github.io/eslint-plugin-yml/rules/) to get the `rules` that this plugin provides.
96
+ **Note:** The `*.configs['flat/*']` configs are still available for backward compatibility, but it is recommended to use the new config names without the `flat/` prefix.
126
97
 
127
98
  #### Parser Configuration
128
99
 
@@ -131,20 +102,19 @@ If you have specified a parser, you need to configure a parser for `.yaml`.
131
102
  For example, if you are using the `"@babel/eslint-parser"`, configure it as follows:
132
103
 
133
104
  ```js
134
- module.exports = {
135
- // ...
136
- extends: ["plugin:yml/standard"],
137
- // ...
138
- parser: "@babel/eslint-parser",
139
- // Add an `overrides` section to add a parser configuration for YAML.
140
- overrides: [
141
- {
142
- files: ["*.yaml", "*.yml"],
143
- parser: "yaml-eslint-parser",
105
+ import eslintPluginYml from 'eslint-plugin-yml';
106
+ import babelParser from '@babel/eslint-parser';
107
+
108
+ export default [
109
+ ...eslintPluginYml.configs.standard,
110
+ {
111
+ files: ['**/*.js'],
112
+ languageOptions: {
113
+ parser: babelParser,
144
114
  },
145
- ],
146
- // ...
147
- };
115
+ },
116
+ // YAML files are already configured by the plugin
117
+ ];
148
118
  ```
149
119
 
150
120
  #### Parser Options
@@ -152,35 +122,59 @@ module.exports = {
152
122
  The following parser options for `yaml-eslint-parser` are available by specifying them in [parserOptions](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options) in the ESLint configuration file.
153
123
 
154
124
  ```js
155
- module.exports = {
156
- // ...
157
- overrides: [
158
- {
159
- files: ["*.yaml", "*.yml"],
160
- parser: "yaml-eslint-parser",
161
- // Options used with yaml-eslint-parser.
125
+ import eslintPluginYml from 'eslint-plugin-yml';
126
+
127
+ export default [
128
+ ...eslintPluginYml.configs.recommended,
129
+ {
130
+ files: ['**/*.yaml', '**/*.yml'],
131
+ languageOptions: {
162
132
  parserOptions: {
163
- defaultYAMLVersion: "1.2",
133
+ defaultYAMLVersion: '1.2',
164
134
  },
165
135
  },
166
- ],
167
- // ...
168
- };
136
+ },
137
+ ];
169
138
  ```
170
139
 
171
140
  See also [https://github.com/ota-meshi/yaml-eslint-parser#readme](https://github.com/ota-meshi/yaml-eslint-parser#readme).
172
141
 
173
142
  ### Running ESLint from the command line
174
143
 
175
- If you want to run `eslint` from the command line, make sure you include the `.yaml` extension using [the `--ext` option](https://eslint.org/docs/user-guide/configuring#specifying-file-extensions-to-lint) or a glob pattern, because ESLint targets only `.js` files by default.
144
+ With ESLint v9 and flat config, ESLint automatically lints all files matched by your config. You typically don't need the `--ext` option anymore.
176
145
 
177
146
  Examples:
178
147
 
179
148
  ```bash
180
- eslint --ext .js,.yaml,.yml src
149
+ eslint .
181
150
  eslint "src/**/*.{js,yaml,yml}"
182
151
  ```
183
152
 
153
+ #### Languages
154
+
155
+ This plugin provides the following language identifiers for use in ESLint configurations:
156
+
157
+ - `yml/yaml` ... YAML files
158
+
159
+ For example, to apply settings specifically to YAML files, you can use the `language` field in your ESLint configuration:
160
+
161
+ ```js
162
+ import eslintPluginYml from 'eslint-plugin-yml';
163
+ export default [
164
+ {
165
+ files: ["*.yaml", "*.yml", "**/*.yaml", "**/*.yml"],
166
+ plugins: {
167
+ yml: eslintPluginYml,
168
+ },
169
+ language: "yml/yaml",
170
+ }
171
+ ]
172
+ ```
173
+
174
+ The configuration above is included in the shareable configs provided by this plugin, so using `configs` is generally recommended.
175
+
176
+ See also <https://eslint.org/docs/latest/use/configure/plugins#specify-a-language>
177
+
184
178
  ## :computer: Editor Integrations
185
179
 
186
180
  ### Visual Studio Code
@@ -231,7 +225,7 @@ The rules with the following star :star: are included in the config.
231
225
 
232
226
  | Rule ID | Description | Fixable | RECOMMENDED | STANDARD |
233
227
  |:--------|:------------|:-------:|:-----------:|:--------:|
234
- | [yml/block-mapping-colon-indicator-newline](https://ota-meshi.github.io/eslint-plugin-yml/rules/block-mapping-colon-indicator-newline.html) | enforce consistent line breaks after `:` indicator | :wrench: | | |
228
+ | [yml/block-mapping-colon-indicator-newline](https://ota-meshi.github.io/eslint-plugin-yml/rules/block-mapping-colon-indicator-newline.html) | enforce consistent line breaks after `:` indicator | :wrench: | | :star: |
235
229
  | [yml/block-mapping-question-indicator-newline](https://ota-meshi.github.io/eslint-plugin-yml/rules/block-mapping-question-indicator-newline.html) | enforce consistent line breaks after `?` indicator | :wrench: | | :star: |
236
230
  | [yml/block-mapping](https://ota-meshi.github.io/eslint-plugin-yml/rules/block-mapping.html) | require or disallow block style mappings. | :wrench: | | :star: |
237
231
  | [yml/block-sequence-hyphen-indicator-newline](https://ota-meshi.github.io/eslint-plugin-yml/rules/block-sequence-hyphen-indicator-newline.html) | enforce consistent line breaks after `-` indicator | :wrench: | | :star: |
@@ -244,7 +238,7 @@ The rules with the following star :star: are included in the config.
244
238
  | [yml/no-empty-mapping-value](https://ota-meshi.github.io/eslint-plugin-yml/rules/no-empty-mapping-value.html) | disallow empty mapping values | | :star: | :star: |
245
239
  | [yml/no-empty-sequence-entry](https://ota-meshi.github.io/eslint-plugin-yml/rules/no-empty-sequence-entry.html) | disallow empty sequence entries | | :star: | :star: |
246
240
  | [yml/no-tab-indent](https://ota-meshi.github.io/eslint-plugin-yml/rules/no-tab-indent.html) | disallow tabs for indentation. | | :star: | :star: |
247
- | [yml/no-trailing-zeros](https://ota-meshi.github.io/eslint-plugin-yml/rules/no-trailing-zeros.html) | disallow trailing zeros for floats | :wrench: | | |
241
+ | [yml/no-trailing-zeros](https://ota-meshi.github.io/eslint-plugin-yml/rules/no-trailing-zeros.html) | disallow trailing zeros for floats | :wrench: | | :star: |
248
242
  | [yml/plain-scalar](https://ota-meshi.github.io/eslint-plugin-yml/rules/plain-scalar.html) | require or disallow plain style scalar. | :wrench: | | :star: |
249
243
  | [yml/quotes](https://ota-meshi.github.io/eslint-plugin-yml/rules/quotes.html) | enforce the consistent use of either double, or single quotes | :wrench: | | :star: |
250
244
  | [yml/require-string-key](https://ota-meshi.github.io/eslint-plugin-yml/rules/require-string-key.html) | disallow mapping keys other than strings | | | |
@@ -262,7 +256,7 @@ The rules with the following star :star: are included in the config.
262
256
  | [yml/flow-sequence-bracket-spacing](https://ota-meshi.github.io/eslint-plugin-yml/rules/flow-sequence-bracket-spacing.html) | enforce consistent spacing inside flow sequence brackets | :wrench: | | :star: |
263
257
  | [yml/key-spacing](https://ota-meshi.github.io/eslint-plugin-yml/rules/key-spacing.html) | enforce consistent spacing between keys and values in mapping pairs | :wrench: | | :star: |
264
258
  | [yml/no-irregular-whitespace](https://ota-meshi.github.io/eslint-plugin-yml/rules/no-irregular-whitespace.html) | disallow irregular whitespace | | :star: | :star: |
265
- | [yml/no-multiple-empty-lines](https://ota-meshi.github.io/eslint-plugin-yml/rules/no-multiple-empty-lines.html) | disallow multiple empty lines | :wrench: | | |
259
+ | [yml/no-multiple-empty-lines](https://ota-meshi.github.io/eslint-plugin-yml/rules/no-multiple-empty-lines.html) | disallow multiple empty lines | :wrench: | | :star: |
266
260
  | [yml/spaced-comment](https://ota-meshi.github.io/eslint-plugin-yml/rules/spaced-comment.html) | enforce consistent spacing after the `#` in a comment | :wrench: | | :star: |
267
261
 
268
262
  <!--RULES_TABLE_END-->
@@ -0,0 +1,18 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __exportAll as t };
@@ -0,0 +1,217 @@
1
+ import { AST } from "yaml-eslint-parser";
2
+ import { IDirective, TextSourceCodeBase, TraversalStep } from "@eslint/plugin-kit";
3
+ import * as _eslint_core0 from "@eslint/core";
4
+ import { File, FileProblem, Language, OkParseResult, RuleDefinition, RulesConfig } from "@eslint/core";
5
+ import { Linter, Scope } from "eslint";
6
+
7
+ //#region src/meta.d.ts
8
+ declare namespace meta_d_exports {
9
+ export { name, version };
10
+ }
11
+ declare const name: string;
12
+ declare const version: string;
13
+ //#endregion
14
+ //#region src/language/token-store.d.ts
15
+ type FilterPredicate = (tokenOrComment: YAMLToken) => boolean;
16
+ type CursorWithSkipOptions = number | FilterPredicate | {
17
+ includeComments?: boolean;
18
+ filter?: FilterPredicate;
19
+ skip?: number;
20
+ };
21
+ type CursorWithCountOptions = number | FilterPredicate | {
22
+ includeComments?: boolean;
23
+ filter?: FilterPredicate;
24
+ count?: number;
25
+ };
26
+ //#endregion
27
+ //#region src/language/yaml-source-code.d.ts
28
+ /**
29
+ * YAML-specific syntax element type
30
+ */
31
+ type YAMLSyntaxElement = AST.YAMLNode | AST.Token | AST.Comment;
32
+ type YAMLToken = AST.Token | AST.Comment;
33
+ /**
34
+ * YAML Source Code Object
35
+ */
36
+ declare class YAMLSourceCode extends TextSourceCodeBase<{
37
+ LangOptions: Record<never, never>;
38
+ RootNode: AST.YAMLProgram;
39
+ SyntaxElementWithLoc: YAMLSyntaxElement;
40
+ ConfigNode: AST.Comment;
41
+ }> {
42
+ #private;
43
+ readonly hasBOM: boolean;
44
+ readonly parserServices: {
45
+ isYAML?: boolean;
46
+ parseError?: unknown;
47
+ };
48
+ readonly visitorKeys: Record<string, string[]>;
49
+ private readonly tokenStore;
50
+ /**
51
+ * Creates a new instance.
52
+ */
53
+ constructor(config: {
54
+ text: string;
55
+ ast: AST.YAMLProgram;
56
+ hasBOM: boolean;
57
+ parserServices: {
58
+ isYAML: boolean;
59
+ parseError?: unknown;
60
+ };
61
+ visitorKeys?: Record<string, string[]> | null | undefined;
62
+ });
63
+ traverse(): Iterable<TraversalStep>;
64
+ /**
65
+ * Gets all tokens and comments.
66
+ */
67
+ get tokensAndComments(): YAMLToken[];
68
+ getLines(): string[];
69
+ getAllComments(): AST.Comment[];
70
+ /**
71
+ * Returns an array of all inline configuration nodes found in the source code.
72
+ * This includes eslint-disable, eslint-enable, eslint-disable-line,
73
+ * eslint-disable-next-line, and eslint (for inline config) comments.
74
+ */
75
+ getInlineConfigNodes(): AST.Comment[];
76
+ /**
77
+ * Returns directives that enable or disable rules along with any problems
78
+ * encountered while parsing the directives.
79
+ */
80
+ getDisableDirectives(): {
81
+ directives: IDirective[];
82
+ problems: FileProblem[];
83
+ };
84
+ /**
85
+ * Returns inline rule configurations along with any problems
86
+ * encountered while parsing the configurations.
87
+ */
88
+ applyInlineConfig(): {
89
+ configs: {
90
+ config: {
91
+ rules: RulesConfig;
92
+ };
93
+ loc: AST.SourceLocation;
94
+ }[];
95
+ problems: FileProblem[];
96
+ };
97
+ getNodeByRangeIndex(index: number): AST.YAMLNode | null;
98
+ getFirstToken(node: YAMLSyntaxElement): AST.Token;
99
+ getFirstToken(node: YAMLSyntaxElement, options?: CursorWithSkipOptions): YAMLToken | null;
100
+ getLastToken(node: YAMLSyntaxElement): AST.Token;
101
+ getLastToken(node: YAMLSyntaxElement, options?: CursorWithSkipOptions): YAMLToken | null;
102
+ getTokenBefore(node: YAMLSyntaxElement): AST.Token | null;
103
+ getTokenBefore(node: YAMLSyntaxElement, options?: CursorWithSkipOptions): YAMLToken | null;
104
+ getTokensBefore(node: YAMLSyntaxElement, options?: CursorWithCountOptions): YAMLToken[];
105
+ getTokenAfter(node: YAMLSyntaxElement): AST.Token | null;
106
+ getTokenAfter(node: YAMLSyntaxElement, options?: CursorWithSkipOptions): YAMLToken | null;
107
+ getFirstTokenBetween(left: YAMLSyntaxElement, right: YAMLSyntaxElement, options?: CursorWithSkipOptions): YAMLToken | null;
108
+ getTokensBetween(left: YAMLSyntaxElement, right: YAMLSyntaxElement, paddingOrOptions?: number | FilterPredicate | CursorWithCountOptions): YAMLToken[];
109
+ getTokens(node: AST.YAMLNode, options?: FilterPredicate | CursorWithCountOptions): YAMLToken[];
110
+ getCommentsBefore(nodeOrToken: YAMLSyntaxElement): AST.Comment[];
111
+ getCommentsAfter(nodeOrToken: YAMLSyntaxElement): AST.Comment[];
112
+ isSpaceBetween(first: YAMLToken, second: YAMLToken): boolean;
113
+ /**
114
+ * Compatibility for ESLint's SourceCode API
115
+ * @deprecated YAML does not have scopes
116
+ */
117
+ getScope(node?: AST.YAMLNode): Scope.Scope | null;
118
+ /**
119
+ * Compatibility for ESLint's SourceCode API
120
+ * @deprecated
121
+ */
122
+ isSpaceBetweenTokens(first: YAMLToken, second: YAMLToken): boolean;
123
+ private _getChildren;
124
+ }
125
+ //#endregion
126
+ //#region src/language/yaml-language.d.ts
127
+ /**
128
+ * Parse result
129
+ */
130
+ interface YAMLParseResult {
131
+ ok: true;
132
+ ast: AST.YAMLProgram;
133
+ }
134
+ /**
135
+ * Language options for YAML
136
+ */
137
+ type YAMLLanguageOptions = {
138
+ parserOptions?: {
139
+ defaultYAMLVersion?: "1.1" | "1.2";
140
+ };
141
+ };
142
+ /**
143
+ * The YAML language implementation for ESLint.
144
+ */
145
+ declare class YAMLLanguage implements Language<{
146
+ LangOptions: YAMLLanguageOptions;
147
+ Code: YAMLSourceCode;
148
+ RootNode: AST.YAMLProgram;
149
+ Node: AST.YAMLNode;
150
+ }> {
151
+ /**
152
+ * The type of file to read.
153
+ */
154
+ fileType: "text";
155
+ /**
156
+ * The line number at which the parser starts counting.
157
+ */
158
+ lineStart: 1;
159
+ /**
160
+ * The column number at which the parser starts counting.
161
+ */
162
+ columnStart: 0;
163
+ /**
164
+ * The name of the key that holds the type of the node.
165
+ */
166
+ nodeTypeKey: "type";
167
+ /**
168
+ * Validates the language options.
169
+ */
170
+ validateLanguageOptions(_languageOptions: YAMLLanguageOptions): void;
171
+ normalizeLanguageOptions(languageOptions: YAMLLanguageOptions): YAMLLanguageOptions;
172
+ /**
173
+ * Parses the given file into an AST.
174
+ */
175
+ parse(file: File, context: {
176
+ languageOptions?: YAMLLanguageOptions;
177
+ }): OkParseResult<AST.YAMLProgram> | YAMLParseResult;
178
+ /**
179
+ * Creates a new SourceCode object for the given file and parse result.
180
+ */
181
+ createSourceCode(file: File, parseResult: OkParseResult<AST.YAMLProgram> | YAMLParseResult): YAMLSourceCode;
182
+ }
183
+ //#endregion
184
+ //#region src/index.d.ts
185
+ declare const configs: {
186
+ base: Linter.Config[];
187
+ recommended: Linter.Config[];
188
+ standard: Linter.Config[];
189
+ prettier: Linter.Config[];
190
+ "flat/base": Linter.Config[];
191
+ "flat/recommended": Linter.Config[];
192
+ "flat/standard": Linter.Config[];
193
+ "flat/prettier": Linter.Config[];
194
+ };
195
+ declare const rules: Record<string, RuleDefinition>;
196
+ declare const languages: {
197
+ yaml: YAMLLanguage;
198
+ };
199
+ declare const _default: {
200
+ meta: typeof meta_d_exports;
201
+ configs: {
202
+ base: Linter.Config[];
203
+ recommended: Linter.Config[];
204
+ standard: Linter.Config[];
205
+ prettier: Linter.Config[];
206
+ "flat/base": Linter.Config[];
207
+ "flat/recommended": Linter.Config[];
208
+ "flat/standard": Linter.Config[];
209
+ "flat/prettier": Linter.Config[];
210
+ };
211
+ rules: Record<string, RuleDefinition<_eslint_core0.RuleDefinitionTypeOptions>>;
212
+ languages: {
213
+ yaml: YAMLLanguage;
214
+ };
215
+ };
216
+ //#endregion
217
+ export { type YAMLLanguageOptions, type YAMLSourceCode, configs, _default as default, languages, meta_d_exports as meta, rules };