eslint-plugin-toml 1.3.0 → 1.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, TOMLVersionOption } from "toml-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 TOMLSourceCode extends TextSourceCodeBase<{
283
283
  }
284
284
  //#endregion
285
285
  //#region src/language/toml-language.d.ts
286
- /**
287
- * Parse result
288
- */
289
- interface TOMLParseResult {
290
- ok: true;
291
- ast: AST.TOMLProgram;
292
- }
293
286
  /**
294
287
  * Language options for TOML
295
288
  * Currently no options are defined.
@@ -334,11 +327,11 @@ declare class TOMLLanguage implements Language<{
334
327
  */
335
328
  parse(file: File, context: {
336
329
  languageOptions?: TOMLLanguageOptions;
337
- }): OkParseResult<AST.TOMLProgram> | TOMLParseResult;
330
+ }): ParseResult<AST.TOMLProgram>;
338
331
  /**
339
332
  * Creates a new SourceCode object for the given file and parse result.
340
333
  */
341
- createSourceCode(file: File, parseResult: OkParseResult<AST.TOMLProgram> | TOMLParseResult): TOMLSourceCode;
334
+ createSourceCode(file: File, parseResult: OkParseResult<AST.TOMLProgram>): TOMLSourceCode;
342
335
  }
343
336
  //#endregion
344
337
  //#region src/index.d.ts
package/lib/index.mjs CHANGED
@@ -3385,7 +3385,7 @@ var standard_default = [...base_default, { rules: {
3385
3385
  //#endregion
3386
3386
  //#region package.json
3387
3387
  var name$1 = "eslint-plugin-toml";
3388
- var version$1 = "1.3.0";
3388
+ var version$1 = "1.3.1";
3389
3389
 
3390
3390
  //#endregion
3391
3391
  //#region src/meta.ts
@@ -3729,13 +3729,26 @@ var TOMLLanguage = class {
3729
3729
  */
3730
3730
  parse(file, context) {
3731
3731
  const text = file.body;
3732
- return {
3733
- ok: true,
3734
- ast: parseTOML(text, {
3735
- filePath: file.path,
3736
- tomlVersion: context.languageOptions?.parserOptions?.tomlVersion
3737
- })
3738
- };
3732
+ try {
3733
+ return {
3734
+ ok: true,
3735
+ ast: parseTOML(text, {
3736
+ filePath: file.path,
3737
+ tomlVersion: context.languageOptions?.parserOptions?.tomlVersion
3738
+ })
3739
+ };
3740
+ } catch (error) {
3741
+ const message = error instanceof Error ? error.message : String(error);
3742
+ const parseError = error;
3743
+ return {
3744
+ ok: false,
3745
+ errors: [{
3746
+ message,
3747
+ line: parseError.lineNumber ?? 1,
3748
+ column: parseError.column ?? 1
3749
+ }]
3750
+ };
3751
+ }
3739
3752
  }
3740
3753
  /**
3741
3754
  * 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-toml",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "This ESLint plugin provides linting rules for TOML.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -71,7 +71,7 @@
71
71
  "toml-eslint-parser": "^1.0.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@changesets/changelog-github": "^0.5.0",
74
+ "@changesets/changelog-github": "^0.6.0",
75
75
  "@changesets/cli": "^2.27.5",
76
76
  "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
77
77
  "@eslint/json": "^1.0.0",
@@ -103,7 +103,7 @@
103
103
  "eslint-plugin-yml": "^3.0.0",
104
104
  "events": "^3.3.0",
105
105
  "mocha": "^11.0.0",
106
- "nyc": "^17.0.0",
106
+ "nyc": "^18.0.0",
107
107
  "pako": "^2.1.0",
108
108
  "prettier": "^3.3.2",
109
109
  "semver": "^7.6.2",
@@ -116,7 +116,7 @@
116
116
  "tsx": "^4.21.0",
117
117
  "typescript": "~5.9.0",
118
118
  "typescript-eslint": "^8.16.0",
119
- "vite-plugin-eslint4b": "^0.6.0",
119
+ "vite-plugin-eslint4b": "^0.7.0",
120
120
  "vitepress": "^1.2.3",
121
121
  "vue-eslint-parser": "^10.0.0"
122
122
  },