eslint-plugin-yml 1.9.0 → 1.10.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 +6 -1
- package/lib/meta.d.ts +1 -1
- package/lib/meta.js +1 -1
- package/lib/rules/block-mapping-colon-indicator-newline.js +3 -2
- package/lib/rules/block-mapping-question-indicator-newline.js +3 -2
- package/lib/rules/block-mapping.js +4 -2
- package/lib/rules/block-sequence-hyphen-indicator-newline.js +3 -2
- package/lib/rules/block-sequence.js +6 -4
- package/lib/rules/file-extension.js +4 -2
- package/lib/rules/flow-mapping-curly-newline.js +3 -2
- package/lib/rules/flow-mapping-curly-spacing.js +3 -1
- package/lib/rules/flow-sequence-bracket-newline.js +3 -2
- package/lib/rules/flow-sequence-bracket-spacing.js +3 -1
- package/lib/rules/indent.js +3 -2
- package/lib/rules/key-name-casing.js +3 -1
- package/lib/rules/key-spacing.js +3 -2
- package/lib/rules/no-empty-document.js +3 -1
- package/lib/rules/no-empty-key.js +3 -1
- package/lib/rules/no-empty-mapping-value.js +3 -1
- package/lib/rules/no-empty-sequence-entry.js +3 -2
- package/lib/rules/no-irregular-whitespace.js +3 -2
- package/lib/rules/no-multiple-empty-lines.js +3 -2
- package/lib/rules/no-tab-indent.js +3 -2
- package/lib/rules/no-trailing-zeros.js +3 -1
- package/lib/rules/plain-scalar.js +3 -2
- package/lib/rules/quotes.js +3 -1
- package/lib/rules/require-string-key.js +3 -1
- package/lib/rules/sort-keys.js +3 -2
- package/lib/rules/sort-sequence-values.js +3 -2
- package/lib/rules/spaced-comment.js +3 -2
- package/lib/rules/vue-custom-block/no-parsing-error.js +5 -1
- package/lib/types.d.ts +1 -0
- package/lib/utils/compat.d.ts +5 -0
- package/lib/utils/compat.js +12 -0
- package/lib/utils/index.js +7 -4
- package/lib/utils/yaml.js +7 -6
- package/package.json +12 -9
package/README.md
CHANGED
|
@@ -161,7 +161,12 @@ Example **.vscode/settings.json**:
|
|
|
161
161
|
|
|
162
162
|
```json
|
|
163
163
|
{
|
|
164
|
-
"eslint.validate": [
|
|
164
|
+
"eslint.validate": [
|
|
165
|
+
"javascript",
|
|
166
|
+
"javascriptreact",
|
|
167
|
+
"yaml",
|
|
168
|
+
"github-actions-workflow" // for GitHub Actions workflow files
|
|
169
|
+
]
|
|
165
170
|
}
|
|
166
171
|
```
|
|
167
172
|
|
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.10.0";
|
package/lib/meta.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
|
+
const compat_1 = require("../utils/compat");
|
|
5
6
|
exports.default = (0, utils_1.createRule)("block-mapping-colon-indicator-newline", {
|
|
6
7
|
meta: {
|
|
7
8
|
docs: {
|
|
@@ -23,8 +24,8 @@ exports.default = (0, utils_1.createRule)("block-mapping-colon-indicator-newline
|
|
|
23
24
|
type: "layout",
|
|
24
25
|
},
|
|
25
26
|
create(context) {
|
|
26
|
-
const sourceCode =
|
|
27
|
-
if (!
|
|
27
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
28
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
28
29
|
return {};
|
|
29
30
|
}
|
|
30
31
|
const option = context.options[0] || "never";
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
|
+
const compat_1 = require("../utils/compat");
|
|
5
6
|
exports.default = (0, utils_1.createRule)("block-mapping-question-indicator-newline", {
|
|
6
7
|
meta: {
|
|
7
8
|
docs: {
|
|
@@ -23,8 +24,8 @@ exports.default = (0, utils_1.createRule)("block-mapping-question-indicator-newl
|
|
|
23
24
|
type: "layout",
|
|
24
25
|
},
|
|
25
26
|
create(context) {
|
|
26
|
-
const sourceCode =
|
|
27
|
-
if (!
|
|
27
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
28
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
28
29
|
return {};
|
|
29
30
|
}
|
|
30
31
|
const option = context.options[0] || "never";
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const yaml_1 = require("../utils/yaml");
|
|
6
|
+
const compat_1 = require("../utils/compat");
|
|
6
7
|
const OPTIONS_ENUM = ["always", "never", "ignore"];
|
|
7
8
|
function parseOptions(option) {
|
|
8
9
|
const opt = {
|
|
@@ -56,7 +57,8 @@ exports.default = (0, utils_1.createRule)("block-mapping", {
|
|
|
56
57
|
type: "layout",
|
|
57
58
|
},
|
|
58
59
|
create(context) {
|
|
59
|
-
|
|
60
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
61
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
60
62
|
return {};
|
|
61
63
|
}
|
|
62
64
|
const options = parseOptions(context.options[0]);
|
|
@@ -201,7 +203,7 @@ function canFixToFlow(mappingInfo, node) {
|
|
|
201
203
|
}
|
|
202
204
|
function buildFixFlowToBlock(node, context) {
|
|
203
205
|
return function* (fixer) {
|
|
204
|
-
const sourceCode =
|
|
206
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
205
207
|
const open = sourceCode.getFirstToken(node);
|
|
206
208
|
const close = sourceCode.getLastToken(node);
|
|
207
209
|
if ((open === null || open === void 0 ? void 0 : open.value) !== "{" || (close === null || close === void 0 ? void 0 : close.value) !== "}") {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
|
+
const compat_1 = require("../utils/compat");
|
|
5
6
|
exports.default = (0, utils_1.createRule)("block-sequence-hyphen-indicator-newline", {
|
|
6
7
|
meta: {
|
|
7
8
|
docs: {
|
|
@@ -30,8 +31,8 @@ exports.default = (0, utils_1.createRule)("block-sequence-hyphen-indicator-newli
|
|
|
30
31
|
},
|
|
31
32
|
create(context) {
|
|
32
33
|
var _a, _b;
|
|
33
|
-
const sourceCode =
|
|
34
|
-
if (!
|
|
34
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
35
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
35
36
|
return {};
|
|
36
37
|
}
|
|
37
38
|
const style = context.options[0] || "never";
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const yaml_1 = require("../utils/yaml");
|
|
5
5
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
6
|
+
const compat_1 = require("../utils/compat");
|
|
6
7
|
const OPTIONS_ENUM = ["always", "never", "ignore"];
|
|
7
8
|
function parseOptions(option) {
|
|
8
9
|
const opt = {
|
|
@@ -56,7 +57,8 @@ exports.default = (0, utils_1.createRule)("block-sequence", {
|
|
|
56
57
|
type: "layout",
|
|
57
58
|
},
|
|
58
59
|
create(context) {
|
|
59
|
-
|
|
60
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
61
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
60
62
|
return {};
|
|
61
63
|
}
|
|
62
64
|
const options = parseOptions(context.options[0]);
|
|
@@ -130,7 +132,7 @@ exports.default = (0, utils_1.createRule)("block-sequence", {
|
|
|
130
132
|
if ((0, yaml_1.isKeyNode)(node)) {
|
|
131
133
|
return;
|
|
132
134
|
}
|
|
133
|
-
const canFix = canFixToBlock(sequenceInfo, node,
|
|
135
|
+
const canFix = canFixToBlock(sequenceInfo, node, sourceCode) &&
|
|
134
136
|
!(0, yaml_1.hasTabIndent)(context);
|
|
135
137
|
context.report({
|
|
136
138
|
loc: node.loc,
|
|
@@ -213,7 +215,7 @@ function canFixToFlow(sequenceInfo, node, context) {
|
|
|
213
215
|
}
|
|
214
216
|
function buildFixFlowToBlock(node, context) {
|
|
215
217
|
return function* (fixer) {
|
|
216
|
-
const sourceCode =
|
|
218
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
217
219
|
const open = sourceCode.getFirstToken(node);
|
|
218
220
|
const close = sourceCode.getLastToken(node);
|
|
219
221
|
if ((open === null || open === void 0 ? void 0 : open.value) !== "[" || (close === null || close === void 0 ? void 0 : close.value) !== "]") {
|
|
@@ -295,7 +297,7 @@ function buildFixFlowToBlock(node, context) {
|
|
|
295
297
|
};
|
|
296
298
|
}
|
|
297
299
|
function buildFixBlockToFlow(node, context) {
|
|
298
|
-
const sourceCode =
|
|
300
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
299
301
|
return function* (fixer) {
|
|
300
302
|
const entries = node.entries.filter((e) => e != null);
|
|
301
303
|
if (entries.length !== node.entries.length) {
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
+
const compat_1 = require("../utils/compat");
|
|
8
9
|
exports.default = (0, utils_1.createRule)("file-extension", {
|
|
9
10
|
meta: {
|
|
10
11
|
docs: {
|
|
@@ -34,14 +35,15 @@ exports.default = (0, utils_1.createRule)("file-extension", {
|
|
|
34
35
|
},
|
|
35
36
|
create(context) {
|
|
36
37
|
var _a, _b, _c;
|
|
37
|
-
|
|
38
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
39
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
38
40
|
return {};
|
|
39
41
|
}
|
|
40
42
|
const expected = ((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.extension) || "yaml";
|
|
41
43
|
const caseSensitive = (_c = (_b = context.options[0]) === null || _b === void 0 ? void 0 : _b.caseSensitive) !== null && _c !== void 0 ? _c : true;
|
|
42
44
|
return {
|
|
43
45
|
Program(node) {
|
|
44
|
-
const filename =
|
|
46
|
+
const filename = (0, compat_1.getFilename)(context);
|
|
45
47
|
const actual = path_1.default.extname(filename);
|
|
46
48
|
if ((caseSensitive ? actual : actual.toLocaleLowerCase()) ===
|
|
47
49
|
`.${expected}`) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const yaml_1 = require("../utils/yaml");
|
|
6
|
+
const compat_1 = require("../utils/compat");
|
|
6
7
|
const OPTION_VALUE = {
|
|
7
8
|
oneOf: [
|
|
8
9
|
{
|
|
@@ -75,10 +76,10 @@ exports.default = (0, utils_1.createRule)("flow-mapping-curly-newline", {
|
|
|
75
76
|
type: "layout",
|
|
76
77
|
},
|
|
77
78
|
create(context) {
|
|
78
|
-
|
|
79
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
80
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
79
81
|
return {};
|
|
80
82
|
}
|
|
81
|
-
const sourceCode = context.getSourceCode();
|
|
82
83
|
const options = normalizeOptionValue(context.options[0]);
|
|
83
84
|
function check(node) {
|
|
84
85
|
if ((0, yaml_1.isKeyNode)(node)) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
const coreRule = (0, utils_1.getCoreRule)("object-curly-spacing");
|
|
5
6
|
exports.default = (0, utils_1.createRule)("flow-mapping-curly-spacing", {
|
|
6
7
|
meta: {
|
|
@@ -17,7 +18,8 @@ exports.default = (0, utils_1.createRule)("flow-mapping-curly-spacing", {
|
|
|
17
18
|
type: coreRule.meta.type,
|
|
18
19
|
},
|
|
19
20
|
create(context) {
|
|
20
|
-
|
|
21
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
22
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
21
23
|
return {};
|
|
22
24
|
}
|
|
23
25
|
return (0, utils_1.defineWrapperListener)(coreRule, context, {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const yaml_1 = require("../utils/yaml");
|
|
5
5
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
6
|
+
const compat_1 = require("../utils/compat");
|
|
6
7
|
exports.default = (0, utils_1.createRule)("flow-sequence-bracket-newline", {
|
|
7
8
|
meta: {
|
|
8
9
|
docs: {
|
|
@@ -43,10 +44,10 @@ exports.default = (0, utils_1.createRule)("flow-sequence-bracket-newline", {
|
|
|
43
44
|
type: "layout",
|
|
44
45
|
},
|
|
45
46
|
create(context) {
|
|
46
|
-
|
|
47
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
48
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
47
49
|
return {};
|
|
48
50
|
}
|
|
49
|
-
const sourceCode = context.getSourceCode();
|
|
50
51
|
function normalizeOptionValue(option) {
|
|
51
52
|
let consistent = false;
|
|
52
53
|
let multiline = false;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
const coreRule = (0, utils_1.getCoreRule)("array-bracket-spacing");
|
|
5
6
|
exports.default = (0, utils_1.createRule)("flow-sequence-bracket-spacing", {
|
|
6
7
|
meta: {
|
|
@@ -17,7 +18,8 @@ exports.default = (0, utils_1.createRule)("flow-sequence-bracket-spacing", {
|
|
|
17
18
|
type: coreRule.meta.type,
|
|
18
19
|
},
|
|
19
20
|
create(context) {
|
|
20
|
-
|
|
21
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
22
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
21
23
|
return {};
|
|
22
24
|
}
|
|
23
25
|
return (0, utils_1.defineWrapperListener)(coreRule, context, {
|
package/lib/rules/indent.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const yaml_1 = require("../utils/yaml");
|
|
5
5
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
6
|
+
const compat_1 = require("../utils/compat");
|
|
6
7
|
const ITERATION_OPTS = Object.freeze({
|
|
7
8
|
includeComments: true,
|
|
8
9
|
});
|
|
@@ -57,14 +58,14 @@ exports.default = (0, utils_1.createRule)("indent", {
|
|
|
57
58
|
type: "layout",
|
|
58
59
|
},
|
|
59
60
|
create(context) {
|
|
60
|
-
|
|
61
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
62
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
61
63
|
return {};
|
|
62
64
|
}
|
|
63
65
|
if ((0, yaml_1.hasTabIndent)(context)) {
|
|
64
66
|
return {};
|
|
65
67
|
}
|
|
66
68
|
const { numOfIndent, indentBlockSequences, indicatorValueIndent } = parseOptions(context);
|
|
67
|
-
const sourceCode = context.getSourceCode();
|
|
68
69
|
const indents = new Map();
|
|
69
70
|
const indicators = new Set();
|
|
70
71
|
const blockLiteralMarks = new Set();
|
|
@@ -4,6 +4,7 @@ const yaml_eslint_parser_1 = require("yaml-eslint-parser");
|
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const casing_1 = require("../utils/casing");
|
|
6
6
|
const casing_2 = require("../utils/casing");
|
|
7
|
+
const compat_1 = require("../utils/compat");
|
|
7
8
|
exports.default = (0, utils_1.createRule)("key-name-casing", {
|
|
8
9
|
meta: {
|
|
9
10
|
docs: {
|
|
@@ -54,7 +55,8 @@ exports.default = (0, utils_1.createRule)("key-name-casing", {
|
|
|
54
55
|
type: "suggestion",
|
|
55
56
|
},
|
|
56
57
|
create(context) {
|
|
57
|
-
|
|
58
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
59
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
58
60
|
return {};
|
|
59
61
|
}
|
|
60
62
|
const option = Object.assign({}, context.options[0]);
|
package/lib/rules/key-spacing.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
|
+
const compat_1 = require("../utils/compat");
|
|
5
6
|
function containsLineTerminator(str) {
|
|
6
7
|
return /[\n\r\u2028\u2029]/u.test(str);
|
|
7
8
|
}
|
|
@@ -156,12 +157,12 @@ exports.default = (0, utils_1.createRule)("key-spacing", {
|
|
|
156
157
|
create,
|
|
157
158
|
});
|
|
158
159
|
function create(context) {
|
|
159
|
-
|
|
160
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
161
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
160
162
|
return {};
|
|
161
163
|
}
|
|
162
164
|
const options = context.options[0] || {};
|
|
163
165
|
const { multiLine: multiLineOptions, singleLine: singleLineOptions, align: alignmentOptions, } = initOptions(options);
|
|
164
|
-
const sourceCode = context.getSourceCode();
|
|
165
166
|
function isKeyValueProperty(property) {
|
|
166
167
|
return property.key != null && property.value != null;
|
|
167
168
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("no-empty-document", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -16,7 +17,8 @@ exports.default = (0, utils_1.createRule)("no-empty-document", {
|
|
|
16
17
|
type: "suggestion",
|
|
17
18
|
},
|
|
18
19
|
create(context) {
|
|
19
|
-
|
|
20
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
21
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
20
22
|
return {};
|
|
21
23
|
}
|
|
22
24
|
function isEmptyNode(node) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("no-empty-key", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -16,7 +17,8 @@ exports.default = (0, utils_1.createRule)("no-empty-key", {
|
|
|
16
17
|
type: "suggestion",
|
|
17
18
|
},
|
|
18
19
|
create(context) {
|
|
19
|
-
|
|
20
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
21
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
20
22
|
return {};
|
|
21
23
|
}
|
|
22
24
|
function isEmptyNode(node) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("no-empty-mapping-value", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -16,7 +17,8 @@ exports.default = (0, utils_1.createRule)("no-empty-mapping-value", {
|
|
|
16
17
|
type: "suggestion",
|
|
17
18
|
},
|
|
18
19
|
create(context) {
|
|
19
|
-
|
|
20
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
21
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
20
22
|
return {};
|
|
21
23
|
}
|
|
22
24
|
function isEmptyNode(node) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
|
+
const compat_1 = require("../utils/compat");
|
|
5
6
|
exports.default = (0, utils_1.createRule)("no-empty-sequence-entry", {
|
|
6
7
|
meta: {
|
|
7
8
|
docs: {
|
|
@@ -17,7 +18,8 @@ exports.default = (0, utils_1.createRule)("no-empty-sequence-entry", {
|
|
|
17
18
|
type: "suggestion",
|
|
18
19
|
},
|
|
19
20
|
create(context) {
|
|
20
|
-
|
|
21
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
22
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
21
23
|
return {};
|
|
22
24
|
}
|
|
23
25
|
function isEmptyNode(node) {
|
|
@@ -29,7 +31,6 @@ exports.default = (0, utils_1.createRule)("no-empty-sequence-entry", {
|
|
|
29
31
|
}
|
|
30
32
|
return false;
|
|
31
33
|
}
|
|
32
|
-
const sourceCode = context.getSourceCode();
|
|
33
34
|
return {
|
|
34
35
|
YAMLSequence(node) {
|
|
35
36
|
if (node.style !== "block") {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
const ALL_IRREGULARS = /[\v\f\u0085\u00a0\u1680\u180e\u2000-\u200b\u2028\u2029\u202f\u205f\u3000\ufeff]/u;
|
|
5
6
|
const IRREGULAR_WHITESPACE = /[\v\f\u0085\u00a0\u1680\u180e\u2000-\u200b\u202f\u205f\u3000\ufeff]+/gu;
|
|
6
7
|
const IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/gu;
|
|
@@ -34,14 +35,14 @@ exports.default = (0, utils_1.createRule)("no-irregular-whitespace", {
|
|
|
34
35
|
type: "problem",
|
|
35
36
|
},
|
|
36
37
|
create(context) {
|
|
37
|
-
|
|
38
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
39
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
38
40
|
return {};
|
|
39
41
|
}
|
|
40
42
|
let errorIndexes = [];
|
|
41
43
|
const options = context.options[0] || {};
|
|
42
44
|
const skipComments = Boolean(options.skipComments);
|
|
43
45
|
const skipQuotedScalars = options.skipQuotedScalars !== false;
|
|
44
|
-
const sourceCode = context.getSourceCode();
|
|
45
46
|
function removeWhitespaceError(node) {
|
|
46
47
|
const [startIndex, endIndex] = node.range;
|
|
47
48
|
errorIndexes = errorIndexes.filter((errorIndex) => errorIndex < startIndex || endIndex <= errorIndex);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("no-multiple-empty-lines", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -40,7 +41,8 @@ exports.default = (0, utils_1.createRule)("no-multiple-empty-lines", {
|
|
|
40
41
|
},
|
|
41
42
|
create(context) {
|
|
42
43
|
var _a, _b, _c, _d, _e, _f;
|
|
43
|
-
|
|
44
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
45
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
44
46
|
return {};
|
|
45
47
|
}
|
|
46
48
|
const maxOption = (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.max) !== null && _b !== void 0 ? _b : 2;
|
|
@@ -49,7 +51,6 @@ exports.default = (0, utils_1.createRule)("no-multiple-empty-lines", {
|
|
|
49
51
|
maxEOF: (_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.maxEOF) !== null && _d !== void 0 ? _d : maxOption,
|
|
50
52
|
maxBOF: (_f = (_e = context.options[0]) === null || _e === void 0 ? void 0 : _e.maxBOF) !== null && _f !== void 0 ? _f : maxOption,
|
|
51
53
|
};
|
|
52
|
-
const sourceCode = context.getSourceCode();
|
|
53
54
|
const allLines = [...sourceCode.lines];
|
|
54
55
|
if (allLines[allLines.length - 1] === "") {
|
|
55
56
|
allLines.pop();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("no-tab-indent", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -16,12 +17,12 @@ exports.default = (0, utils_1.createRule)("no-tab-indent", {
|
|
|
16
17
|
type: "problem",
|
|
17
18
|
},
|
|
18
19
|
create(context) {
|
|
19
|
-
|
|
20
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
21
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
20
22
|
return {};
|
|
21
23
|
}
|
|
22
24
|
return {
|
|
23
25
|
Program() {
|
|
24
|
-
const sourceCode = context.getSourceCode();
|
|
25
26
|
const lines = sourceCode.lines;
|
|
26
27
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
27
28
|
const line = lines[lineIndex];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("no-trailing-zeros", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -17,7 +18,8 @@ exports.default = (0, utils_1.createRule)("no-trailing-zeros", {
|
|
|
17
18
|
type: "layout",
|
|
18
19
|
},
|
|
19
20
|
create(context) {
|
|
20
|
-
|
|
21
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
22
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
21
23
|
return {};
|
|
22
24
|
}
|
|
23
25
|
return {
|
|
@@ -6,6 +6,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const yaml_eslint_parser_1 = require("yaml-eslint-parser");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
|
+
const compat_1 = require("../utils/compat");
|
|
9
10
|
const SYMBOLS = new Set([
|
|
10
11
|
":",
|
|
11
12
|
"{",
|
|
@@ -59,7 +60,8 @@ exports.default = (0, utils_1.createRule)("plain-scalar", {
|
|
|
59
60
|
},
|
|
60
61
|
create(context) {
|
|
61
62
|
var _a, _b;
|
|
62
|
-
|
|
63
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
64
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
63
65
|
return {};
|
|
64
66
|
}
|
|
65
67
|
const option = context.options[0] || "always";
|
|
@@ -68,7 +70,6 @@ exports.default = (0, utils_1.createRule)("plain-scalar", {
|
|
|
68
70
|
String.raw(templateObject_1 || (templateObject_1 = __makeTemplateObject(["[\v\f\u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000\uFEFF]"], ["[\\v\\f\\u0085\\u00a0\\u1680\\u180e\\u2000-\\u200b\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]"]))),
|
|
69
71
|
]
|
|
70
72
|
: []));
|
|
71
|
-
const sourceCode = context.getSourceCode();
|
|
72
73
|
let currentDocument;
|
|
73
74
|
function canToPlain(node) {
|
|
74
75
|
if (node.value !== node.value.trim()) {
|
package/lib/rules/quotes.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("quotes", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -26,7 +27,8 @@ exports.default = (0, utils_1.createRule)("quotes", {
|
|
|
26
27
|
type: "layout",
|
|
27
28
|
},
|
|
28
29
|
create(context) {
|
|
29
|
-
|
|
30
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
31
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
30
32
|
return {};
|
|
31
33
|
}
|
|
32
34
|
const objectOption = context.options[0] || {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../utils");
|
|
4
|
+
const compat_1 = require("../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("require-string-key", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -16,7 +17,8 @@ exports.default = (0, utils_1.createRule)("require-string-key", {
|
|
|
16
17
|
type: "suggestion",
|
|
17
18
|
},
|
|
18
19
|
create(context) {
|
|
19
|
-
|
|
20
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
21
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
20
22
|
return {};
|
|
21
23
|
}
|
|
22
24
|
let anchors = {};
|
package/lib/rules/sort-keys.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const natural_compare_1 = __importDefault(require("natural-compare"));
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
8
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
9
|
+
const compat_1 = require("../utils/compat");
|
|
9
10
|
function isNewLine(char) {
|
|
10
11
|
return (char === "\n" || char === "\r" || char === "\u2028" || char === "\u2029");
|
|
11
12
|
}
|
|
@@ -310,10 +311,10 @@ exports.default = (0, utils_1.createRule)("sort-keys", {
|
|
|
310
311
|
type: "suggestion",
|
|
311
312
|
},
|
|
312
313
|
create(context) {
|
|
313
|
-
|
|
314
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
315
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
314
316
|
return {};
|
|
315
317
|
}
|
|
316
|
-
const sourceCode = context.getSourceCode();
|
|
317
318
|
const parsedOptions = parseOptions(context.options, sourceCode);
|
|
318
319
|
function isValidOrder(prevData, thisData, option) {
|
|
319
320
|
if (option.isValidOrder(prevData, thisData)) {
|
|
@@ -7,6 +7,7 @@ const natural_compare_1 = __importDefault(require("natural-compare"));
|
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
8
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
9
9
|
const yaml_eslint_parser_1 = require("yaml-eslint-parser");
|
|
10
|
+
const compat_1 = require("../utils/compat");
|
|
10
11
|
class YAMLEntryData {
|
|
11
12
|
get reportLoc() {
|
|
12
13
|
if (this.node) {
|
|
@@ -302,10 +303,10 @@ exports.default = (0, utils_1.createRule)("sort-sequence-values", {
|
|
|
302
303
|
type: "suggestion",
|
|
303
304
|
},
|
|
304
305
|
create(context) {
|
|
305
|
-
|
|
306
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
307
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
306
308
|
return {};
|
|
307
309
|
}
|
|
308
|
-
const sourceCode = context.getSourceCode();
|
|
309
310
|
const parsedOptions = parseOptions(context.options, sourceCode);
|
|
310
311
|
function isValidOrder(prevData, thisData, option) {
|
|
311
312
|
if (option.isValidOrder(prevData, thisData)) {
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
7
|
const utils_1 = require("../utils");
|
|
8
|
+
const compat_1 = require("../utils/compat");
|
|
8
9
|
function escapeText(s) {
|
|
9
10
|
return `(?:${lodash_1.default.escapeRegExp(s)})`;
|
|
10
11
|
}
|
|
@@ -89,10 +90,10 @@ exports.default = (0, utils_1.createRule)("spaced-comment", {
|
|
|
89
90
|
type: "suggestion",
|
|
90
91
|
},
|
|
91
92
|
create(context) {
|
|
92
|
-
|
|
93
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
94
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
93
95
|
return {};
|
|
94
96
|
}
|
|
95
|
-
const sourceCode = context.getSourceCode();
|
|
96
97
|
const requireSpace = context.options[0] !== "never";
|
|
97
98
|
const config = context.options[1] || {};
|
|
98
99
|
const markers = config.markers || [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_1 = require("../../utils");
|
|
4
|
+
const compat_1 = require("../../utils/compat");
|
|
4
5
|
exports.default = (0, utils_1.createRule)("vue-custom-block/no-parsing-error", {
|
|
5
6
|
meta: {
|
|
6
7
|
docs: {
|
|
@@ -14,10 +15,13 @@ exports.default = (0, utils_1.createRule)("vue-custom-block/no-parsing-error", {
|
|
|
14
15
|
type: "problem",
|
|
15
16
|
},
|
|
16
17
|
create(context, { customBlock }) {
|
|
18
|
+
var _a;
|
|
17
19
|
if (!customBlock) {
|
|
18
20
|
return {};
|
|
19
21
|
}
|
|
20
|
-
const
|
|
22
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
23
|
+
const parserServices = (_a = context.parserServices) !== null && _a !== void 0 ? _a : sourceCode.parserServices;
|
|
24
|
+
const parseError = parserServices.parseError;
|
|
21
25
|
if (parseError) {
|
|
22
26
|
let loc = undefined;
|
|
23
27
|
if ("column" in parseError && "lineNumber" in parseError) {
|
package/lib/types.d.ts
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RuleContext, SourceCode } from "../types";
|
|
2
|
+
import type { Rule, SourceCode as ESLintSourceCode } from "eslint";
|
|
3
|
+
export declare function getSourceCode(context: RuleContext): SourceCode;
|
|
4
|
+
export declare function getSourceCode(context: Rule.RuleContext): ESLintSourceCode;
|
|
5
|
+
export declare function getFilename(context: RuleContext | Rule.RuleContext): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFilename = exports.getSourceCode = void 0;
|
|
4
|
+
const eslint_compat_utils_1 = require("eslint-compat-utils");
|
|
5
|
+
function getSourceCode(context) {
|
|
6
|
+
return (0, eslint_compat_utils_1.getSourceCode)(context);
|
|
7
|
+
}
|
|
8
|
+
exports.getSourceCode = getSourceCode;
|
|
9
|
+
function getFilename(context) {
|
|
10
|
+
return (0, eslint_compat_utils_1.getFilename)(context);
|
|
11
|
+
}
|
|
12
|
+
exports.getFilename = getFilename;
|
package/lib/utils/index.js
CHANGED
|
@@ -30,15 +30,17 @@ exports.getCoreRule = exports.isNode = exports.getProxyNode = exports.defineWrap
|
|
|
30
30
|
const yamlESLintParser = __importStar(require("yaml-eslint-parser"));
|
|
31
31
|
const debug_1 = __importDefault(require("debug"));
|
|
32
32
|
const path_1 = __importDefault(require("path"));
|
|
33
|
+
const compat_1 = require("./compat");
|
|
33
34
|
const log = (0, debug_1.default)("eslint-plugin-yml:utils/index");
|
|
34
35
|
function createRule(ruleName, rule) {
|
|
35
36
|
return {
|
|
36
37
|
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 }) }),
|
|
37
38
|
create(context) {
|
|
38
|
-
|
|
39
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
40
|
+
if (typeof sourceCode.parserServices.defineCustomBlocksVisitor ===
|
|
39
41
|
"function" &&
|
|
40
|
-
path_1.default.extname(
|
|
41
|
-
return
|
|
42
|
+
path_1.default.extname((0, compat_1.getFilename)(context)) === ".vue") {
|
|
43
|
+
return sourceCode.parserServices.defineCustomBlocksVisitor(context, yamlESLintParser, {
|
|
42
44
|
target: ["yaml", "yml"],
|
|
43
45
|
create(blockContext) {
|
|
44
46
|
return rule.create(blockContext, {
|
|
@@ -56,7 +58,8 @@ function createRule(ruleName, rule) {
|
|
|
56
58
|
exports.createRule = createRule;
|
|
57
59
|
function defineWrapperListener(coreRule, context, proxyOptions) {
|
|
58
60
|
var _a, _b;
|
|
59
|
-
|
|
61
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
62
|
+
if (!sourceCode.parserServices.isYAML) {
|
|
60
63
|
return {};
|
|
61
64
|
}
|
|
62
65
|
const listener = coreRule.create({
|
package/lib/utils/yaml.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fixIndent = exports.processIndentFix = exports.unwrapMeta = exports.isKeyNode = exports.compareIndent = exports.getNumOfIndent = exports.decIndent = exports.incIndent = exports.getActualIndentFromLine = exports.getActualIndent = exports.calcExpectIndentForEntries = exports.calcExpectIndentForPairs = exports.hasTabIndent = void 0;
|
|
4
4
|
const ast_utils_1 = require("./ast-utils");
|
|
5
|
+
const compat_1 = require("./compat");
|
|
5
6
|
function hasTabIndent(context) {
|
|
6
|
-
for (const line of
|
|
7
|
+
for (const line of (0, compat_1.getSourceCode)(context).getLines()) {
|
|
7
8
|
if (/^\s*\t/u.test(line)) {
|
|
8
9
|
return true;
|
|
9
10
|
}
|
|
@@ -15,7 +16,7 @@ function hasTabIndent(context) {
|
|
|
15
16
|
}
|
|
16
17
|
exports.hasTabIndent = hasTabIndent;
|
|
17
18
|
function calcExpectIndentForPairs(mapping, context) {
|
|
18
|
-
const sourceCode =
|
|
19
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
19
20
|
let parentNode = mapping.parent;
|
|
20
21
|
if (parentNode.type === "YAMLWithMeta") {
|
|
21
22
|
const before = sourceCode.getTokenBefore(parentNode);
|
|
@@ -58,7 +59,7 @@ function calcExpectIndentForPairs(mapping, context) {
|
|
|
58
59
|
}
|
|
59
60
|
exports.calcExpectIndentForPairs = calcExpectIndentForPairs;
|
|
60
61
|
function calcExpectIndentForEntries(sequence, context) {
|
|
61
|
-
const sourceCode =
|
|
62
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
62
63
|
let parentNode = sequence.parent;
|
|
63
64
|
if (parentNode.type === "YAMLWithMeta") {
|
|
64
65
|
const before = sourceCode.getTokenBefore(parentNode);
|
|
@@ -112,7 +113,7 @@ function calcExpectIndentFromBaseNode(baseNode, node, context) {
|
|
|
112
113
|
return incIndent(baseIndent, context);
|
|
113
114
|
}
|
|
114
115
|
function getActualIndent(node, context) {
|
|
115
|
-
const sourceCode =
|
|
116
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
116
117
|
const before = sourceCode.getTokenBefore(node, { includeComments: true });
|
|
117
118
|
if (!before || before.loc.end.line < node.loc.start.line) {
|
|
118
119
|
return getActualIndentFromLine(node.loc.start.line, context);
|
|
@@ -121,7 +122,7 @@ function getActualIndent(node, context) {
|
|
|
121
122
|
}
|
|
122
123
|
exports.getActualIndent = getActualIndent;
|
|
123
124
|
function getActualIndentFromLine(line, context) {
|
|
124
|
-
const sourceCode =
|
|
125
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
125
126
|
const lineText = sourceCode.getLines()[line - 1];
|
|
126
127
|
return /^[^\S\n\r\u2028\u2029]*/u.exec(lineText)[0];
|
|
127
128
|
}
|
|
@@ -175,7 +176,7 @@ function unwrapMeta(node) {
|
|
|
175
176
|
}
|
|
176
177
|
exports.unwrapMeta = unwrapMeta;
|
|
177
178
|
function* processIndentFix(fixer, baseIndent, targetNode, context) {
|
|
178
|
-
const sourceCode =
|
|
179
|
+
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
179
180
|
if (targetNode.type === "YAMLWithMeta") {
|
|
180
181
|
yield* metaIndent(targetNode);
|
|
181
182
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-yml",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "This ESLint plugin provides linting rules for YAML.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"update": "npm run ts -- ./tools/update.ts && npm run eslint-fix && npm run cover",
|
|
26
26
|
"new": "npm run ts -- ./tools/new-rule.ts",
|
|
27
27
|
"predocs:watch": "npm run build:ts",
|
|
28
|
-
"docs:watch": "
|
|
29
|
-
"docs:build": "
|
|
28
|
+
"docs:watch": "vitepress dev docs",
|
|
29
|
+
"docs:build": "npm run build:ts && vitepress build docs",
|
|
30
30
|
"preversion": "npm test && git add .",
|
|
31
31
|
"version": "env-cmd -e version npm run update && git add .",
|
|
32
32
|
"version:ci": "env-cmd -e version-ci npm run update && changeset version",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"homepage": "https://ota-meshi.github.io/eslint-plugin-yml/",
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"debug": "^4.3.2",
|
|
60
|
+
"eslint-compat-utils": "^0.1.0",
|
|
60
61
|
"lodash": "^4.17.21",
|
|
61
62
|
"natural-compare": "^1.4.0",
|
|
62
63
|
"yaml-eslint-parser": "^1.2.1"
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"@changesets/changelog-github": "^0.4.6",
|
|
69
70
|
"@changesets/cli": "^2.24.2",
|
|
70
71
|
"@ota-meshi/eslint-plugin": "^0.15.0",
|
|
72
|
+
"@ota-meshi/site-kit-eslint-editor-vue": "^0.1.2",
|
|
71
73
|
"@types/debug": "^4.1.5",
|
|
72
74
|
"@types/eslint": "^8.0.0",
|
|
73
75
|
"@types/eslint-scope": "^3.7.0",
|
|
@@ -82,7 +84,7 @@
|
|
|
82
84
|
"@typescript-eslint/parser": "^6.0.0",
|
|
83
85
|
"cross-env": "^7.0.2",
|
|
84
86
|
"env-cmd": "^10.1.0",
|
|
85
|
-
"esbuild": "^0.19.
|
|
87
|
+
"esbuild": "^0.19.3",
|
|
86
88
|
"esbuild-register": "^3.2.0",
|
|
87
89
|
"eslint": "^8.0.0",
|
|
88
90
|
"eslint-config-prettier": "^9.0.0",
|
|
@@ -97,22 +99,23 @@
|
|
|
97
99
|
"eslint-plugin-regexp": "^1.0.0",
|
|
98
100
|
"eslint-plugin-vue": "^9.0.0",
|
|
99
101
|
"eslint-plugin-yml": "^1.0.0",
|
|
100
|
-
"eslint4b": "^7.3.1",
|
|
101
102
|
"espree": "^9.0.0",
|
|
103
|
+
"events": "^3.3.0",
|
|
102
104
|
"mocha": "^10.0.0",
|
|
103
|
-
"monaco-editor": "^0.
|
|
105
|
+
"monaco-editor": "^0.44.0",
|
|
104
106
|
"nyc": "^15.1.0",
|
|
107
|
+
"pako": "^2.1.0",
|
|
105
108
|
"prettier": "^3.0.3",
|
|
106
|
-
"raw-loader": "^4.0.1",
|
|
107
109
|
"semver": "^7.3.2",
|
|
108
110
|
"stylelint": "^15.0.0",
|
|
109
111
|
"stylelint-config-recommended-vue": "^1.0.0",
|
|
110
112
|
"stylelint-config-standard": "^34.0.0",
|
|
113
|
+
"stylelint-config-standard-vue": "^1.0.0",
|
|
111
114
|
"stylelint-stylus": "^0.18.0",
|
|
112
115
|
"typescript": "~5.2.0",
|
|
113
|
-
"
|
|
116
|
+
"vite-plugin-eslint4b": "^0.2.1",
|
|
117
|
+
"vitepress": "^1.0.0-rc.17",
|
|
114
118
|
"vue-eslint-parser": "^9.0.0",
|
|
115
|
-
"vuepress": "^1.5.2",
|
|
116
119
|
"yaml": "^2.1.1"
|
|
117
120
|
},
|
|
118
121
|
"publishConfig": {
|