eslint-plugin-yml 3.3.0 → 3.3.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.
package/lib/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { AST } from "yaml-eslint-parser";
2
2
  import { IDirective, TextSourceCodeBase, TraversalStep } from "@eslint/plugin-kit";
3
3
  import { CursorWithCountOptionsWithComment, CursorWithCountOptionsWithFilter, CursorWithCountOptionsWithoutFilter, CursorWithSkipOptionsWithComment, CursorWithSkipOptionsWithFilter, CursorWithSkipOptionsWithoutFilter } from "@ota-meshi/ast-token-store";
4
4
  import * as _eslint_core0 from "@eslint/core";
5
- import { File, FileProblem, Language, OkParseResult, RuleDefinition, RulesConfig } from "@eslint/core";
5
+ import { File, FileProblem, Language, OkParseResult, ParseResult, RuleDefinition, RulesConfig } from "@eslint/core";
6
6
  import { Linter, Scope } from "eslint";
7
7
 
8
8
  //#region src/meta.d.ts
@@ -283,13 +283,6 @@ declare class YAMLSourceCode extends TextSourceCodeBase<{
283
283
  }
284
284
  //#endregion
285
285
  //#region src/language/yaml-language.d.ts
286
- /**
287
- * Parse result
288
- */
289
- interface YAMLParseResult {
290
- ok: true;
291
- ast: AST.YAMLProgram;
292
- }
293
286
  /**
294
287
  * Language options for YAML
295
288
  */
@@ -333,11 +326,11 @@ declare class YAMLLanguage implements Language<{
333
326
  */
334
327
  parse(file: File, context: {
335
328
  languageOptions?: YAMLLanguageOptions;
336
- }): OkParseResult<AST.YAMLProgram> | YAMLParseResult;
329
+ }): ParseResult<AST.YAMLProgram>;
337
330
  /**
338
331
  * Creates a new SourceCode object for the given file and parse result.
339
332
  */
340
- createSourceCode(file: File, parseResult: OkParseResult<AST.YAMLProgram> | YAMLParseResult): YAMLSourceCode;
333
+ createSourceCode(file: File, parseResult: OkParseResult<AST.YAMLProgram>): YAMLSourceCode;
341
334
  }
342
335
  //#endregion
343
336
  //#region src/index.d.ts
package/lib/index.mjs CHANGED
@@ -5336,7 +5336,7 @@ var prettier_default = [...base_default, { rules: {
5336
5336
  //#endregion
5337
5337
  //#region package.json
5338
5338
  var name$1 = "eslint-plugin-yml";
5339
- var version$1 = "3.3.0";
5339
+ var version$1 = "3.3.1";
5340
5340
 
5341
5341
  //#endregion
5342
5342
  //#region src/meta.ts
@@ -5694,13 +5694,26 @@ var YAMLLanguage = class {
5694
5694
  */
5695
5695
  parse(file, context) {
5696
5696
  const text = file.body;
5697
- return {
5698
- ok: true,
5699
- ast: parseYAML(text, {
5700
- filePath: file.path,
5701
- defaultYAMLVersion: context.languageOptions?.parserOptions?.defaultYAMLVersion
5702
- })
5703
- };
5697
+ try {
5698
+ return {
5699
+ ok: true,
5700
+ ast: parseYAML(text, {
5701
+ filePath: file.path,
5702
+ defaultYAMLVersion: context.languageOptions?.parserOptions?.defaultYAMLVersion
5703
+ })
5704
+ };
5705
+ } catch (error) {
5706
+ const message = error instanceof Error ? error.message : String(error);
5707
+ const parseError = error;
5708
+ return {
5709
+ ok: false,
5710
+ errors: [{
5711
+ message,
5712
+ line: parseError.lineNumber ?? 1,
5713
+ column: parseError.column ?? 1
5714
+ }]
5715
+ };
5716
+ }
5704
5717
  }
5705
5718
  /**
5706
5719
  * Creates a new SourceCode object for the given file and parse result.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-yml",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "This ESLint plugin provides linting rules for YAML.",
5
5
  "type": "module",
6
6
  "main": "lib/index.mjs",
@@ -77,7 +77,7 @@
77
77
  "eslint": ">=9.38.0"
78
78
  },
79
79
  "devDependencies": {
80
- "@changesets/changelog-github": "^0.5.0",
80
+ "@changesets/changelog-github": "^0.6.0",
81
81
  "@changesets/cli": "^2.24.2",
82
82
  "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
83
83
  "@eslint/eslintrc": "^3.1.0",
@@ -112,7 +112,7 @@
112
112
  "events": "^3.3.0",
113
113
  "mocha": "^11.0.0",
114
114
  "monaco-editor": "^0.55.0",
115
- "nyc": "^17.0.0",
115
+ "nyc": "^18.0.0",
116
116
  "pako": "^2.1.0",
117
117
  "prettier": "^3.0.3",
118
118
  "semver": "^7.3.2",
@@ -125,7 +125,7 @@
125
125
  "tsx": "^4.21.0",
126
126
  "typescript": "~5.9.0",
127
127
  "typescript-eslint": "^8.0.0",
128
- "vite-plugin-eslint4b": "^0.6.0",
128
+ "vite-plugin-eslint4b": "^0.7.0",
129
129
  "vitepress": "^1.0.0-rc.17",
130
130
  "vue-eslint-parser": "^10.0.0",
131
131
  "yaml": "^2.1.1"