eslint-plugin-yml 1.15.0 → 1.16.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/lib/meta.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const name = "eslint-plugin-yml";
2
- export declare const version = "1.15.0";
2
+ export declare const version = "1.16.0";
package/lib/meta.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = "eslint-plugin-yml";
5
- exports.version = "1.15.0";
5
+ exports.version = "1.16.0";
@@ -24,8 +24,9 @@ exports.default = (0, index_1.createRule)("block-mapping-colon-indicator-newline
24
24
  type: "layout",
25
25
  },
26
26
  create(context) {
27
+ var _a;
27
28
  const sourceCode = (0, compat_1.getSourceCode)(context);
28
- if (!sourceCode.parserServices.isYAML) {
29
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
29
30
  return {};
30
31
  }
31
32
  const option = context.options[0] || "never";
@@ -24,8 +24,9 @@ exports.default = (0, index_1.createRule)("block-mapping-question-indicator-newl
24
24
  type: "layout",
25
25
  },
26
26
  create(context) {
27
+ var _a;
27
28
  const sourceCode = (0, compat_1.getSourceCode)(context);
28
- if (!sourceCode.parserServices.isYAML) {
29
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
29
30
  return {};
30
31
  }
31
32
  const option = context.options[0] || "never";
@@ -57,8 +57,9 @@ exports.default = (0, index_1.createRule)("block-mapping", {
57
57
  type: "layout",
58
58
  },
59
59
  create(context) {
60
+ var _a;
60
61
  const sourceCode = (0, compat_1.getSourceCode)(context);
61
- if (!sourceCode.parserServices.isYAML) {
62
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
62
63
  return {};
63
64
  }
64
65
  const options = parseOptions(context.options[0]);
@@ -30,14 +30,14 @@ exports.default = (0, index_1.createRule)("block-sequence-hyphen-indicator-newli
30
30
  type: "layout",
31
31
  },
32
32
  create(context) {
33
- var _a, _b;
33
+ var _a, _b, _c;
34
34
  const sourceCode = (0, compat_1.getSourceCode)(context);
35
- if (!sourceCode.parserServices.isYAML) {
35
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
36
36
  return {};
37
37
  }
38
38
  const style = context.options[0] || "never";
39
- const nestedHyphenStyle = ((_a = context.options[1]) === null || _a === void 0 ? void 0 : _a.nestedHyphen) || "always";
40
- const blockMappingStyle = ((_b = context.options[1]) === null || _b === void 0 ? void 0 : _b.blockMapping) || style;
39
+ const nestedHyphenStyle = ((_b = context.options[1]) === null || _b === void 0 ? void 0 : _b.nestedHyphen) || "always";
40
+ const blockMappingStyle = ((_c = context.options[1]) === null || _c === void 0 ? void 0 : _c.blockMapping) || style;
41
41
  function getStyleOption(hyphen, entry) {
42
42
  const next = sourceCode.getTokenAfter(hyphen);
43
43
  if (next && (0, ast_utils_1.isHyphen)(next)) {
@@ -57,8 +57,9 @@ exports.default = (0, index_1.createRule)("block-sequence", {
57
57
  type: "layout",
58
58
  },
59
59
  create(context) {
60
+ var _a;
60
61
  const sourceCode = (0, compat_1.getSourceCode)(context);
61
- if (!sourceCode.parserServices.isYAML) {
62
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
62
63
  return {};
63
64
  }
64
65
  const options = parseOptions(context.options[0]);
@@ -34,13 +34,13 @@ exports.default = (0, index_1.createRule)("file-extension", {
34
34
  type: "suggestion",
35
35
  },
36
36
  create(context) {
37
- var _a, _b, _c;
37
+ var _a, _b, _c, _d;
38
38
  const sourceCode = (0, compat_1.getSourceCode)(context);
39
- if (!sourceCode.parserServices.isYAML) {
39
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
40
40
  return {};
41
41
  }
42
- const expected = ((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.extension) || "yaml";
43
- const caseSensitive = (_c = (_b = context.options[0]) === null || _b === void 0 ? void 0 : _b.caseSensitive) !== null && _c !== void 0 ? _c : true;
42
+ const expected = ((_b = context.options[0]) === null || _b === void 0 ? void 0 : _b.extension) || "yaml";
43
+ const caseSensitive = (_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.caseSensitive) !== null && _d !== void 0 ? _d : true;
44
44
  return {
45
45
  Program(node) {
46
46
  const filename = (0, compat_1.getFilename)(context);
@@ -76,8 +76,9 @@ exports.default = (0, index_1.createRule)("flow-mapping-curly-newline", {
76
76
  type: "layout",
77
77
  },
78
78
  create(context) {
79
+ var _a;
79
80
  const sourceCode = (0, compat_1.getSourceCode)(context);
80
- if (!sourceCode.parserServices.isYAML) {
81
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
81
82
  return {};
82
83
  }
83
84
  const options = normalizeOptionValue(context.options[0]);
@@ -39,8 +39,9 @@ exports.default = (0, index_1.createRule)("flow-mapping-curly-spacing", {
39
39
  },
40
40
  },
41
41
  create(context) {
42
+ var _a;
42
43
  const sourceCode = (0, compat_1.getSourceCode)(context);
43
- if (!sourceCode.parserServices.isYAML) {
44
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
44
45
  return {};
45
46
  }
46
47
  const spaced = context.options[0] === "always";
@@ -44,8 +44,9 @@ exports.default = (0, index_1.createRule)("flow-sequence-bracket-newline", {
44
44
  type: "layout",
45
45
  },
46
46
  create(context) {
47
+ var _a;
47
48
  const sourceCode = (0, compat_1.getSourceCode)(context);
48
- if (!sourceCode.parserServices.isYAML) {
49
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
49
50
  return {};
50
51
  }
51
52
  function normalizeOptionValue(option) {
@@ -42,8 +42,9 @@ exports.default = (0, index_1.createRule)("flow-sequence-bracket-spacing", {
42
42
  },
43
43
  },
44
44
  create(context) {
45
+ var _a;
45
46
  const sourceCode = (0, compat_1.getSourceCode)(context);
46
- if (!sourceCode.parserServices.isYAML) {
47
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
47
48
  return {};
48
49
  }
49
50
  const spaced = context.options[0] === "always";
@@ -58,8 +58,9 @@ exports.default = (0, index_1.createRule)("indent", {
58
58
  type: "layout",
59
59
  },
60
60
  create(context) {
61
+ var _a;
61
62
  const sourceCode = (0, compat_1.getSourceCode)(context);
62
- if (!sourceCode.parserServices.isYAML) {
63
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
63
64
  return {};
64
65
  }
65
66
  if ((0, yaml_1.hasTabIndent)(context)) {
@@ -55,8 +55,9 @@ exports.default = (0, index_1.createRule)("key-name-casing", {
55
55
  type: "suggestion",
56
56
  },
57
57
  create(context) {
58
+ var _a;
58
59
  const sourceCode = (0, compat_1.getSourceCode)(context);
59
- if (!sourceCode.parserServices.isYAML) {
60
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
60
61
  return {};
61
62
  }
62
63
  const option = Object.assign({}, context.options[0]);
@@ -157,8 +157,9 @@ exports.default = (0, index_1.createRule)("key-spacing", {
157
157
  create,
158
158
  });
159
159
  function create(context) {
160
+ var _a;
160
161
  const sourceCode = (0, compat_1.getSourceCode)(context);
161
- if (!sourceCode.parserServices.isYAML) {
162
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
162
163
  return {};
163
164
  }
164
165
  const options = context.options[0] || {};
@@ -17,8 +17,9 @@ exports.default = (0, index_1.createRule)("no-empty-document", {
17
17
  type: "suggestion",
18
18
  },
19
19
  create(context) {
20
+ var _a;
20
21
  const sourceCode = (0, compat_1.getSourceCode)(context);
21
- if (!sourceCode.parserServices.isYAML) {
22
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
22
23
  return {};
23
24
  }
24
25
  function isEmptyNode(node) {
@@ -17,8 +17,9 @@ exports.default = (0, index_1.createRule)("no-empty-key", {
17
17
  type: "suggestion",
18
18
  },
19
19
  create(context) {
20
+ var _a;
20
21
  const sourceCode = (0, compat_1.getSourceCode)(context);
21
- if (!sourceCode.parserServices.isYAML) {
22
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
22
23
  return {};
23
24
  }
24
25
  function isEmptyNode(node) {
@@ -17,8 +17,9 @@ exports.default = (0, index_1.createRule)("no-empty-mapping-value", {
17
17
  type: "suggestion",
18
18
  },
19
19
  create(context) {
20
+ var _a;
20
21
  const sourceCode = (0, compat_1.getSourceCode)(context);
21
- if (!sourceCode.parserServices.isYAML) {
22
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
22
23
  return {};
23
24
  }
24
25
  function isEmptyNode(node) {
@@ -18,8 +18,9 @@ exports.default = (0, index_1.createRule)("no-empty-sequence-entry", {
18
18
  type: "suggestion",
19
19
  },
20
20
  create(context) {
21
+ var _a;
21
22
  const sourceCode = (0, compat_1.getSourceCode)(context);
22
- if (!sourceCode.parserServices.isYAML) {
23
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
23
24
  return {};
24
25
  }
25
26
  function isEmptyNode(node) {
@@ -35,8 +35,9 @@ exports.default = (0, index_1.createRule)("no-irregular-whitespace", {
35
35
  type: "problem",
36
36
  },
37
37
  create(context) {
38
+ var _a;
38
39
  const sourceCode = (0, compat_1.getSourceCode)(context);
39
- if (!sourceCode.parserServices.isYAML) {
40
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
40
41
  return {};
41
42
  }
42
43
  let errorIndexes = [];
@@ -40,16 +40,16 @@ exports.default = (0, index_1.createRule)("no-multiple-empty-lines", {
40
40
  type: "layout",
41
41
  },
42
42
  create(context) {
43
- var _a, _b, _c, _d, _e, _f;
43
+ var _a, _b, _c, _d, _e, _f, _g;
44
44
  const sourceCode = (0, compat_1.getSourceCode)(context);
45
- if (!sourceCode.parserServices.isYAML) {
45
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
46
46
  return {};
47
47
  }
48
- const maxOption = (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.max) !== null && _b !== void 0 ? _b : 2;
48
+ const maxOption = (_c = (_b = context.options[0]) === null || _b === void 0 ? void 0 : _b.max) !== null && _c !== void 0 ? _c : 2;
49
49
  const options = {
50
50
  max: maxOption,
51
- maxEOF: (_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.maxEOF) !== null && _d !== void 0 ? _d : maxOption,
52
- maxBOF: (_f = (_e = context.options[0]) === null || _e === void 0 ? void 0 : _e.maxBOF) !== null && _f !== void 0 ? _f : maxOption,
51
+ maxEOF: (_e = (_d = context.options[0]) === null || _d === void 0 ? void 0 : _d.maxEOF) !== null && _e !== void 0 ? _e : maxOption,
52
+ maxBOF: (_g = (_f = context.options[0]) === null || _f === void 0 ? void 0 : _f.maxBOF) !== null && _g !== void 0 ? _g : maxOption,
53
53
  };
54
54
  const allLines = [...sourceCode.lines];
55
55
  if (allLines[allLines.length - 1] === "") {
@@ -17,8 +17,9 @@ exports.default = (0, index_1.createRule)("no-tab-indent", {
17
17
  type: "problem",
18
18
  },
19
19
  create(context) {
20
+ var _a;
20
21
  const sourceCode = (0, compat_1.getSourceCode)(context);
21
- if (!sourceCode.parserServices.isYAML) {
22
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
22
23
  return {};
23
24
  }
24
25
  return {
@@ -18,8 +18,9 @@ exports.default = (0, index_1.createRule)("no-trailing-zeros", {
18
18
  type: "layout",
19
19
  },
20
20
  create(context) {
21
+ var _a;
21
22
  const sourceCode = (0, compat_1.getSourceCode)(context);
22
- if (!sourceCode.parserServices.isYAML) {
23
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
23
24
  return {};
24
25
  }
25
26
  return {
@@ -62,24 +62,24 @@ exports.default = (0, index_1.createRule)("plain-scalar", {
62
62
  type: "layout",
63
63
  },
64
64
  create(context) {
65
- var _a, _b, _c, _d;
65
+ var _a, _b, _c, _d, _e;
66
66
  const sourceCode = (0, compat_1.getSourceCode)(context);
67
- if (!sourceCode.parserServices.isYAML) {
67
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
68
68
  return {};
69
69
  }
70
70
  const valueOption = {
71
71
  prefer: context.options[0] || "always",
72
72
  ignorePatterns: [],
73
73
  };
74
- const overridesMappingKey = (_b = (_a = context.options[1]) === null || _a === void 0 ? void 0 : _a.overrides) === null || _b === void 0 ? void 0 : _b.mappingKey;
74
+ const overridesMappingKey = (_c = (_b = context.options[1]) === null || _b === void 0 ? void 0 : _b.overrides) === null || _c === void 0 ? void 0 : _c.mappingKey;
75
75
  const keyOption = overridesMappingKey
76
76
  ? {
77
77
  prefer: overridesMappingKey,
78
78
  ignorePatterns: [],
79
79
  }
80
80
  : valueOption;
81
- if ((_c = context.options[1]) === null || _c === void 0 ? void 0 : _c.ignorePatterns) {
82
- valueOption.ignorePatterns = toRegExps((_d = context.options[1]) === null || _d === void 0 ? void 0 : _d.ignorePatterns);
81
+ if ((_d = context.options[1]) === null || _d === void 0 ? void 0 : _d.ignorePatterns) {
82
+ valueOption.ignorePatterns = toRegExps((_e = context.options[1]) === null || _e === void 0 ? void 0 : _e.ignorePatterns);
83
83
  }
84
84
  else {
85
85
  if (valueOption.prefer === "always") {
@@ -27,8 +27,9 @@ exports.default = (0, index_1.createRule)("quotes", {
27
27
  type: "layout",
28
28
  },
29
29
  create(context) {
30
+ var _a;
30
31
  const sourceCode = (0, compat_1.getSourceCode)(context);
31
- if (!sourceCode.parserServices.isYAML) {
32
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
32
33
  return {};
33
34
  }
34
35
  const objectOption = context.options[0] || {};
@@ -17,8 +17,9 @@ exports.default = (0, index_1.createRule)("require-string-key", {
17
17
  type: "suggestion",
18
18
  },
19
19
  create(context) {
20
+ var _a;
20
21
  const sourceCode = (0, compat_1.getSourceCode)(context);
21
- if (!sourceCode.parserServices.isYAML) {
22
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
22
23
  return {};
23
24
  }
24
25
  let anchors = {};
@@ -311,8 +311,9 @@ exports.default = (0, index_1.createRule)("sort-keys", {
311
311
  type: "suggestion",
312
312
  },
313
313
  create(context) {
314
+ var _a;
314
315
  const sourceCode = (0, compat_1.getSourceCode)(context);
315
- if (!sourceCode.parserServices.isYAML) {
316
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
316
317
  return {};
317
318
  }
318
319
  const parsedOptions = parseOptions(context.options, sourceCode);
@@ -303,8 +303,9 @@ exports.default = (0, index_1.createRule)("sort-sequence-values", {
303
303
  type: "suggestion",
304
304
  },
305
305
  create(context) {
306
+ var _a;
306
307
  const sourceCode = (0, compat_1.getSourceCode)(context);
307
- if (!sourceCode.parserServices.isYAML) {
308
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
308
309
  return {};
309
310
  }
310
311
  const parsedOptions = parseOptions(context.options, sourceCode);
@@ -90,8 +90,9 @@ exports.default = (0, index_1.createRule)("spaced-comment", {
90
90
  type: "suggestion",
91
91
  },
92
92
  create(context) {
93
+ var _a;
93
94
  const sourceCode = (0, compat_1.getSourceCode)(context);
94
- if (!sourceCode.parserServices.isYAML) {
95
+ if (!((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.isYAML)) {
95
96
  return {};
96
97
  }
97
98
  const requireSpace = context.options[0] !== "never";
package/lib/types.d.ts CHANGED
@@ -105,7 +105,7 @@ export interface SourceCode {
105
105
  ast: AST.YAMLProgram;
106
106
  lines: string[];
107
107
  hasBOM: boolean;
108
- parserServices: {
108
+ parserServices?: {
109
109
  isYAML?: true;
110
110
  parseError?: any;
111
111
  };
@@ -34,8 +34,9 @@ function createRule(ruleName, rule) {
34
34
  return {
35
35
  meta: Object.assign(Object.assign({}, rule.meta), { docs: Object.assign(Object.assign({}, rule.meta.docs), { url: `https://ota-meshi.github.io/eslint-plugin-yml/rules/${ruleName}.html`, ruleId: `yml/${ruleName}`, ruleName }) }),
36
36
  create(context) {
37
+ var _a;
37
38
  const sourceCode = (0, compat_1.getSourceCode)(context);
38
- if (typeof sourceCode.parserServices.defineCustomBlocksVisitor ===
39
+ if (typeof ((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.defineCustomBlocksVisitor) ===
39
40
  "function" &&
40
41
  path_1.default.extname((0, compat_1.getFilename)(context)) === ".vue") {
41
42
  return sourceCode.parserServices.defineCustomBlocksVisitor(context, yamlESLintParser, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-yml",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "This ESLint plugin provides linting rules for YAML.",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -58,7 +58,7 @@
58
58
  "homepage": "https://ota-meshi.github.io/eslint-plugin-yml/",
59
59
  "dependencies": {
60
60
  "debug": "^4.3.2",
61
- "eslint-compat-utils": "^0.5.0",
61
+ "eslint-compat-utils": "^0.6.0",
62
62
  "lodash": "^4.17.21",
63
63
  "natural-compare": "^1.4.0",
64
64
  "yaml-eslint-parser": "^1.2.1"
@@ -72,6 +72,7 @@
72
72
  "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
73
73
  "@eslint/eslintrc": "^3.1.0",
74
74
  "@eslint/js": "^9.5.0",
75
+ "@eslint/json": "^0.8.0",
75
76
  "@ota-meshi/eslint-plugin": "^0.17.3",
76
77
  "@ota-meshi/site-kit-eslint-editor-vue": "^0.2.0",
77
78
  "@types/debug": "^4.1.5",
@@ -84,13 +85,13 @@
84
85
  "@types/natural-compare": "^1.4.0",
85
86
  "@types/node": "^22.0.0",
86
87
  "@types/semver": "^7.3.1",
87
- "@typescript-eslint/eslint-plugin": "~8.12.0",
88
- "@typescript-eslint/parser": "~8.12.0",
88
+ "@typescript-eslint/eslint-plugin": "~8.16.0",
89
+ "@typescript-eslint/parser": "~8.16.0",
89
90
  "cross-env": "^7.0.2",
90
91
  "env-cmd": "^10.1.0",
91
92
  "esbuild": "^0.24.0",
92
93
  "esbuild-register": "^3.2.0",
93
- "eslint": "^9.5.0",
94
+ "eslint": "^9.16.0",
94
95
  "eslint-config-prettier": "^9.0.0",
95
96
  "eslint-plugin-eslint-plugin": "^6.0.0",
96
97
  "eslint-plugin-eslint-rule-tester": "^0.6.0",
@@ -118,7 +119,7 @@
118
119
  "stylelint-stylus": "^1.0.0",
119
120
  "typescript": "~5.6.0",
120
121
  "typescript-eslint": "^8.0.0",
121
- "vite-plugin-eslint4b": "^0.4.6",
122
+ "vite-plugin-eslint4b": "^0.5.0",
122
123
  "vitepress": "^1.0.0-rc.17",
123
124
  "vue-eslint-parser": "^9.0.0",
124
125
  "yaml": "^2.1.1"
@@ -126,5 +127,5 @@
126
127
  "publishConfig": {
127
128
  "access": "public"
128
129
  },
129
- "packageManager": "npm@10.9.0"
130
+ "packageManager": "npm@10.9.1"
130
131
  }