eslint-plugin-yml 1.15.0 → 1.17.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 +1 -1
- package/lib/configs/flat/base.js +17 -7
- package/lib/index.js +17 -7
- package/lib/meta.d.ts +1 -1
- package/lib/meta.js +1 -1
- package/lib/rules/block-mapping-colon-indicator-newline.js +2 -1
- package/lib/rules/block-mapping-question-indicator-newline.js +2 -1
- package/lib/rules/block-mapping.js +2 -1
- package/lib/rules/block-sequence-hyphen-indicator-newline.js +4 -4
- package/lib/rules/block-sequence.js +2 -1
- package/lib/rules/file-extension.js +4 -4
- package/lib/rules/flow-mapping-curly-newline.js +2 -1
- package/lib/rules/flow-mapping-curly-spacing.js +2 -1
- package/lib/rules/flow-sequence-bracket-newline.js +2 -1
- package/lib/rules/flow-sequence-bracket-spacing.js +2 -1
- package/lib/rules/indent.js +2 -1
- package/lib/rules/key-name-casing.js +2 -1
- package/lib/rules/key-spacing.js +2 -1
- package/lib/rules/no-empty-document.js +2 -1
- package/lib/rules/no-empty-key.js +2 -1
- package/lib/rules/no-empty-mapping-value.js +2 -1
- package/lib/rules/no-empty-sequence-entry.js +2 -1
- package/lib/rules/no-irregular-whitespace.js +2 -1
- package/lib/rules/no-multiple-empty-lines.js +5 -5
- package/lib/rules/no-tab-indent.js +2 -1
- package/lib/rules/no-trailing-zeros.js +2 -1
- package/lib/rules/plain-scalar.js +5 -5
- package/lib/rules/quotes.js +2 -1
- package/lib/rules/require-string-key.js +2 -1
- package/lib/rules/sort-keys.js +2 -1
- package/lib/rules/sort-sequence-values.js +2 -1
- package/lib/rules/spaced-comment.js +4 -3
- package/lib/types.d.ts +1 -1
- package/lib/utils/index.js +19 -8
- package/package.json +14 -14
package/README.md
CHANGED
package/lib/configs/flat/base.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
const parser = __importStar(require("yaml-eslint-parser"));
|
|
27
37
|
exports.default = [
|
package/lib/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
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.
|
|
2
|
+
export declare const version = "1.17.0";
|
package/lib/meta.js
CHANGED
|
@@ -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 = ((
|
|
40
|
-
const blockMappingStyle = ((
|
|
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 = ((
|
|
43
|
-
const caseSensitive = (
|
|
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";
|
package/lib/rules/indent.js
CHANGED
|
@@ -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]);
|
package/lib/rules/key-spacing.js
CHANGED
|
@@ -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 = (
|
|
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: (
|
|
52
|
-
maxBOF: (
|
|
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 = (
|
|
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 ((
|
|
82
|
-
valueOption.ignorePatterns = toRegExps((
|
|
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") {
|
package/lib/rules/quotes.js
CHANGED
|
@@ -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 = {};
|
package/lib/rules/sort-keys.js
CHANGED
|
@@ -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);
|
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const escape_string_regexp_1 = __importDefault(require("escape-string-regexp"));
|
|
7
7
|
const index_1 = require("../utils/index");
|
|
8
8
|
const compat_1 = require("../utils/compat");
|
|
9
9
|
function escapeText(s) {
|
|
10
|
-
return `(?:${
|
|
10
|
+
return `(?:${(0, escape_string_regexp_1.default)(s)})`;
|
|
11
11
|
}
|
|
12
12
|
function escapeAndRepeat(s) {
|
|
13
13
|
return `${escapeText(s)}+`;
|
|
@@ -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
package/lib/utils/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -34,8 +44,9 @@ function createRule(ruleName, rule) {
|
|
|
34
44
|
return {
|
|
35
45
|
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
46
|
create(context) {
|
|
47
|
+
var _a;
|
|
37
48
|
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
38
|
-
if (typeof sourceCode.parserServices.defineCustomBlocksVisitor ===
|
|
49
|
+
if (typeof ((_a = sourceCode.parserServices) === null || _a === void 0 ? void 0 : _a.defineCustomBlocksVisitor) ===
|
|
39
50
|
"function" &&
|
|
40
51
|
path_1.default.extname((0, compat_1.getFilename)(context)) === ".vue") {
|
|
41
52
|
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.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "This ESLint plugin provides linting rules for YAML.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"homepage": "https://ota-meshi.github.io/eslint-plugin-yml/",
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"debug": "^4.3.2",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
61
|
+
"escape-string-regexp": "4.0.0",
|
|
62
|
+
"eslint-compat-utils": "^0.6.0",
|
|
63
63
|
"natural-compare": "^1.4.0",
|
|
64
64
|
"yaml-eslint-parser": "^1.2.1"
|
|
65
65
|
},
|
|
@@ -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.10.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",
|
|
@@ -79,19 +80,18 @@
|
|
|
79
80
|
"@types/eslint-scope": "^3.7.0",
|
|
80
81
|
"@types/eslint-visitor-keys": "^3.0.0",
|
|
81
82
|
"@types/estree": "^1.0.0",
|
|
82
|
-
"@types/lodash": "^4.14.158",
|
|
83
83
|
"@types/mocha": "^10.0.0",
|
|
84
84
|
"@types/natural-compare": "^1.4.0",
|
|
85
85
|
"@types/node": "^22.0.0",
|
|
86
86
|
"@types/semver": "^7.3.1",
|
|
87
|
-
"@typescript-eslint/eslint-plugin": "~8.
|
|
88
|
-
"@typescript-eslint/parser": "~8.
|
|
87
|
+
"@typescript-eslint/eslint-plugin": "~8.24.0",
|
|
88
|
+
"@typescript-eslint/parser": "~8.24.0",
|
|
89
89
|
"cross-env": "^7.0.2",
|
|
90
90
|
"env-cmd": "^10.1.0",
|
|
91
|
-
"esbuild": "^0.
|
|
91
|
+
"esbuild": "^0.25.0",
|
|
92
92
|
"esbuild-register": "^3.2.0",
|
|
93
|
-
"eslint": "^9.
|
|
94
|
-
"eslint-config-prettier": "^
|
|
93
|
+
"eslint": "^9.16.0",
|
|
94
|
+
"eslint-config-prettier": "^10.0.0",
|
|
95
95
|
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
96
96
|
"eslint-plugin-eslint-rule-tester": "^0.6.0",
|
|
97
97
|
"eslint-plugin-jsdoc": "^50.0.0",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"eslint-plugin-vue": "^9.0.0",
|
|
106
106
|
"eslint-plugin-yml": "^1.0.0",
|
|
107
107
|
"events": "^3.3.0",
|
|
108
|
-
"mocha": "^
|
|
108
|
+
"mocha": "^11.0.0",
|
|
109
109
|
"monaco-editor": "^0.52.0",
|
|
110
110
|
"nyc": "^17.0.0",
|
|
111
111
|
"pako": "^2.1.0",
|
|
@@ -113,12 +113,12 @@
|
|
|
113
113
|
"semver": "^7.3.2",
|
|
114
114
|
"stylelint": "^16.0.0",
|
|
115
115
|
"stylelint-config-recommended-vue": "^1.0.0",
|
|
116
|
-
"stylelint-config-standard": "^
|
|
116
|
+
"stylelint-config-standard": "^37.0.0",
|
|
117
117
|
"stylelint-config-standard-vue": "^1.0.0",
|
|
118
118
|
"stylelint-stylus": "^1.0.0",
|
|
119
|
-
"typescript": "~5.
|
|
119
|
+
"typescript": "~5.7.0",
|
|
120
120
|
"typescript-eslint": "^8.0.0",
|
|
121
|
-
"vite-plugin-eslint4b": "^0.
|
|
121
|
+
"vite-plugin-eslint4b": "^0.5.0",
|
|
122
122
|
"vitepress": "^1.0.0-rc.17",
|
|
123
123
|
"vue-eslint-parser": "^9.0.0",
|
|
124
124
|
"yaml": "^2.1.1"
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"publishConfig": {
|
|
127
127
|
"access": "public"
|
|
128
128
|
},
|
|
129
|
-
"packageManager": "npm@
|
|
129
|
+
"packageManager": "npm@11.1.0"
|
|
130
130
|
}
|