eslint-plugin-yml 1.13.2 → 1.15.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 +2 -2
- package/lib/configs/flat/base.d.ts +3 -3
- package/lib/configs/flat/prettier.d.ts +15 -15
- package/lib/configs/flat/recommended.d.ts +10 -10
- package/lib/configs/flat/standard.d.ts +23 -23
- package/lib/index.d.ts +51 -51
- package/lib/meta.d.ts +1 -1
- package/lib/meta.js +1 -1
- package/lib/rules/block-mapping-colon-indicator-newline.js +2 -2
- package/lib/rules/block-mapping-question-indicator-newline.js +2 -2
- package/lib/rules/block-mapping.js +2 -2
- package/lib/rules/block-sequence-hyphen-indicator-newline.js +2 -2
- package/lib/rules/block-sequence.js +2 -2
- package/lib/rules/file-extension.js +2 -2
- package/lib/rules/flow-mapping-curly-newline.js +2 -2
- package/lib/rules/flow-mapping-curly-spacing.js +2 -2
- package/lib/rules/flow-sequence-bracket-newline.js +2 -2
- package/lib/rules/flow-sequence-bracket-spacing.js +2 -2
- package/lib/rules/indent.js +2 -2
- package/lib/rules/key-name-casing.js +2 -2
- package/lib/rules/key-spacing.js +2 -2
- package/lib/rules/no-empty-document.js +2 -2
- package/lib/rules/no-empty-key.js +2 -2
- package/lib/rules/no-empty-mapping-value.js +2 -2
- package/lib/rules/no-empty-sequence-entry.js +2 -2
- package/lib/rules/no-irregular-whitespace.js +2 -2
- package/lib/rules/no-multiple-empty-lines.js +2 -2
- package/lib/rules/no-tab-indent.js +2 -2
- package/lib/rules/no-trailing-zeros.js +2 -2
- package/lib/rules/plain-scalar.js +50 -11
- package/lib/rules/quotes.js +2 -2
- package/lib/rules/require-string-key.js +2 -2
- package/lib/rules/sort-keys.js +2 -2
- package/lib/rules/sort-sequence-values.js +2 -2
- package/lib/rules/spaced-comment.js +2 -2
- package/lib/rules/vue-custom-block/no-parsing-error.js +2 -2
- package/lib/utils/ast-utils.js +10 -11
- package/lib/utils/casing.js +14 -14
- package/lib/utils/compat.js +2 -3
- package/lib/utils/index.js +1 -2
- package/lib/utils/yaml.js +13 -14
- package/package.json +27 -23
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ npm install --save-dev eslint eslint-plugin-yml
|
|
|
65
65
|
|
|
66
66
|
### Configuration
|
|
67
67
|
|
|
68
|
-
#### New
|
|
68
|
+
#### New Config (`eslint.config.js`)
|
|
69
69
|
|
|
70
70
|
Use `eslint.config.js` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/configuration-files-new>.
|
|
71
71
|
|
|
@@ -95,7 +95,7 @@ This plugin provides configs:
|
|
|
95
95
|
|
|
96
96
|
See [the rule list](https://ota-meshi.github.io/eslint-plugin-yml/rules/) to get the `rules` that this plugin provides.
|
|
97
97
|
|
|
98
|
-
#### Legacy Config (
|
|
98
|
+
#### Legacy Config (`.eslintrc`)
|
|
99
99
|
|
|
100
100
|
Use `.eslintrc.*` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/>.
|
|
101
101
|
|
|
@@ -13,9 +13,9 @@ declare const _default: ({
|
|
|
13
13
|
parser: typeof parser;
|
|
14
14
|
};
|
|
15
15
|
rules: {
|
|
16
|
-
"no-irregular-whitespace":
|
|
17
|
-
"no-unused-vars":
|
|
18
|
-
"spaced-comment":
|
|
16
|
+
"no-irregular-whitespace": "off";
|
|
17
|
+
"no-unused-vars": "off";
|
|
18
|
+
"spaced-comment": "off";
|
|
19
19
|
};
|
|
20
20
|
plugins?: undefined;
|
|
21
21
|
})[];
|
|
@@ -11,25 +11,25 @@ declare const _default: ({
|
|
|
11
11
|
parser: typeof import("yaml-eslint-parser");
|
|
12
12
|
};
|
|
13
13
|
rules: {
|
|
14
|
-
"no-irregular-whitespace":
|
|
15
|
-
"no-unused-vars":
|
|
16
|
-
"spaced-comment":
|
|
14
|
+
"no-irregular-whitespace": "off";
|
|
15
|
+
"no-unused-vars": "off";
|
|
16
|
+
"spaced-comment": "off";
|
|
17
17
|
};
|
|
18
18
|
plugins?: undefined;
|
|
19
19
|
} | {
|
|
20
20
|
rules: {
|
|
21
|
-
"yml/block-mapping-colon-indicator-newline":
|
|
22
|
-
"yml/block-mapping-question-indicator-newline":
|
|
23
|
-
"yml/block-sequence-hyphen-indicator-newline":
|
|
24
|
-
"yml/flow-mapping-curly-newline":
|
|
25
|
-
"yml/flow-mapping-curly-spacing":
|
|
26
|
-
"yml/flow-sequence-bracket-newline":
|
|
27
|
-
"yml/flow-sequence-bracket-spacing":
|
|
28
|
-
"yml/indent":
|
|
29
|
-
"yml/key-spacing":
|
|
30
|
-
"yml/no-multiple-empty-lines":
|
|
31
|
-
"yml/no-trailing-zeros":
|
|
32
|
-
"yml/quotes":
|
|
21
|
+
"yml/block-mapping-colon-indicator-newline": "off";
|
|
22
|
+
"yml/block-mapping-question-indicator-newline": "off";
|
|
23
|
+
"yml/block-sequence-hyphen-indicator-newline": "off";
|
|
24
|
+
"yml/flow-mapping-curly-newline": "off";
|
|
25
|
+
"yml/flow-mapping-curly-spacing": "off";
|
|
26
|
+
"yml/flow-sequence-bracket-newline": "off";
|
|
27
|
+
"yml/flow-sequence-bracket-spacing": "off";
|
|
28
|
+
"yml/indent": "off";
|
|
29
|
+
"yml/key-spacing": "off";
|
|
30
|
+
"yml/no-multiple-empty-lines": "off";
|
|
31
|
+
"yml/no-trailing-zeros": "off";
|
|
32
|
+
"yml/quotes": "off";
|
|
33
33
|
};
|
|
34
34
|
})[];
|
|
35
35
|
export default _default;
|
|
@@ -11,20 +11,20 @@ declare const _default: ({
|
|
|
11
11
|
parser: typeof import("yaml-eslint-parser");
|
|
12
12
|
};
|
|
13
13
|
rules: {
|
|
14
|
-
"no-irregular-whitespace":
|
|
15
|
-
"no-unused-vars":
|
|
16
|
-
"spaced-comment":
|
|
14
|
+
"no-irregular-whitespace": "off";
|
|
15
|
+
"no-unused-vars": "off";
|
|
16
|
+
"spaced-comment": "off";
|
|
17
17
|
};
|
|
18
18
|
plugins?: undefined;
|
|
19
19
|
} | {
|
|
20
20
|
rules: {
|
|
21
|
-
"yml/no-empty-document":
|
|
22
|
-
"yml/no-empty-key":
|
|
23
|
-
"yml/no-empty-mapping-value":
|
|
24
|
-
"yml/no-empty-sequence-entry":
|
|
25
|
-
"yml/no-irregular-whitespace":
|
|
26
|
-
"yml/no-tab-indent":
|
|
27
|
-
"yml/vue-custom-block/no-parsing-error":
|
|
21
|
+
"yml/no-empty-document": "error";
|
|
22
|
+
"yml/no-empty-key": "error";
|
|
23
|
+
"yml/no-empty-mapping-value": "error";
|
|
24
|
+
"yml/no-empty-sequence-entry": "error";
|
|
25
|
+
"yml/no-irregular-whitespace": "error";
|
|
26
|
+
"yml/no-tab-indent": "error";
|
|
27
|
+
"yml/vue-custom-block/no-parsing-error": "error";
|
|
28
28
|
};
|
|
29
29
|
})[];
|
|
30
30
|
export default _default;
|
|
@@ -11,33 +11,33 @@ declare const _default: ({
|
|
|
11
11
|
parser: typeof import("yaml-eslint-parser");
|
|
12
12
|
};
|
|
13
13
|
rules: {
|
|
14
|
-
"no-irregular-whitespace":
|
|
15
|
-
"no-unused-vars":
|
|
16
|
-
"spaced-comment":
|
|
14
|
+
"no-irregular-whitespace": "off";
|
|
15
|
+
"no-unused-vars": "off";
|
|
16
|
+
"spaced-comment": "off";
|
|
17
17
|
};
|
|
18
18
|
plugins?: undefined;
|
|
19
19
|
} | {
|
|
20
20
|
rules: {
|
|
21
|
-
"yml/block-mapping-question-indicator-newline":
|
|
22
|
-
"yml/block-mapping":
|
|
23
|
-
"yml/block-sequence-hyphen-indicator-newline":
|
|
24
|
-
"yml/block-sequence":
|
|
25
|
-
"yml/flow-mapping-curly-newline":
|
|
26
|
-
"yml/flow-mapping-curly-spacing":
|
|
27
|
-
"yml/flow-sequence-bracket-newline":
|
|
28
|
-
"yml/flow-sequence-bracket-spacing":
|
|
29
|
-
"yml/indent":
|
|
30
|
-
"yml/key-spacing":
|
|
31
|
-
"yml/no-empty-document":
|
|
32
|
-
"yml/no-empty-key":
|
|
33
|
-
"yml/no-empty-mapping-value":
|
|
34
|
-
"yml/no-empty-sequence-entry":
|
|
35
|
-
"yml/no-irregular-whitespace":
|
|
36
|
-
"yml/no-tab-indent":
|
|
37
|
-
"yml/plain-scalar":
|
|
38
|
-
"yml/quotes":
|
|
39
|
-
"yml/spaced-comment":
|
|
40
|
-
"yml/vue-custom-block/no-parsing-error":
|
|
21
|
+
"yml/block-mapping-question-indicator-newline": "error";
|
|
22
|
+
"yml/block-mapping": "error";
|
|
23
|
+
"yml/block-sequence-hyphen-indicator-newline": "error";
|
|
24
|
+
"yml/block-sequence": "error";
|
|
25
|
+
"yml/flow-mapping-curly-newline": "error";
|
|
26
|
+
"yml/flow-mapping-curly-spacing": "error";
|
|
27
|
+
"yml/flow-sequence-bracket-newline": "error";
|
|
28
|
+
"yml/flow-sequence-bracket-spacing": "error";
|
|
29
|
+
"yml/indent": "error";
|
|
30
|
+
"yml/key-spacing": "error";
|
|
31
|
+
"yml/no-empty-document": "error";
|
|
32
|
+
"yml/no-empty-key": "error";
|
|
33
|
+
"yml/no-empty-mapping-value": "error";
|
|
34
|
+
"yml/no-empty-sequence-entry": "error";
|
|
35
|
+
"yml/no-irregular-whitespace": "error";
|
|
36
|
+
"yml/no-tab-indent": "error";
|
|
37
|
+
"yml/plain-scalar": "error";
|
|
38
|
+
"yml/quotes": "error";
|
|
39
|
+
"yml/spaced-comment": "error";
|
|
40
|
+
"yml/vue-custom-block/no-parsing-error": "error";
|
|
41
41
|
};
|
|
42
42
|
})[];
|
|
43
43
|
export default _default;
|
package/lib/index.d.ts
CHANGED
|
@@ -82,9 +82,9 @@ declare const _default: {
|
|
|
82
82
|
parser: typeof import("yaml-eslint-parser");
|
|
83
83
|
};
|
|
84
84
|
rules: {
|
|
85
|
-
"no-irregular-whitespace":
|
|
86
|
-
"no-unused-vars":
|
|
87
|
-
"spaced-comment":
|
|
85
|
+
"no-irregular-whitespace": "off";
|
|
86
|
+
"no-unused-vars": "off";
|
|
87
|
+
"spaced-comment": "off";
|
|
88
88
|
};
|
|
89
89
|
plugins?: undefined;
|
|
90
90
|
})[];
|
|
@@ -101,20 +101,20 @@ declare const _default: {
|
|
|
101
101
|
parser: typeof import("yaml-eslint-parser");
|
|
102
102
|
};
|
|
103
103
|
rules: {
|
|
104
|
-
"no-irregular-whitespace":
|
|
105
|
-
"no-unused-vars":
|
|
106
|
-
"spaced-comment":
|
|
104
|
+
"no-irregular-whitespace": "off";
|
|
105
|
+
"no-unused-vars": "off";
|
|
106
|
+
"spaced-comment": "off";
|
|
107
107
|
};
|
|
108
108
|
plugins?: undefined;
|
|
109
109
|
} | {
|
|
110
110
|
rules: {
|
|
111
|
-
"yml/no-empty-document":
|
|
112
|
-
"yml/no-empty-key":
|
|
113
|
-
"yml/no-empty-mapping-value":
|
|
114
|
-
"yml/no-empty-sequence-entry":
|
|
115
|
-
"yml/no-irregular-whitespace":
|
|
116
|
-
"yml/no-tab-indent":
|
|
117
|
-
"yml/vue-custom-block/no-parsing-error":
|
|
111
|
+
"yml/no-empty-document": "error";
|
|
112
|
+
"yml/no-empty-key": "error";
|
|
113
|
+
"yml/no-empty-mapping-value": "error";
|
|
114
|
+
"yml/no-empty-sequence-entry": "error";
|
|
115
|
+
"yml/no-irregular-whitespace": "error";
|
|
116
|
+
"yml/no-tab-indent": "error";
|
|
117
|
+
"yml/vue-custom-block/no-parsing-error": "error";
|
|
118
118
|
};
|
|
119
119
|
})[];
|
|
120
120
|
"flat/standard": ({
|
|
@@ -130,33 +130,33 @@ declare const _default: {
|
|
|
130
130
|
parser: typeof import("yaml-eslint-parser");
|
|
131
131
|
};
|
|
132
132
|
rules: {
|
|
133
|
-
"no-irregular-whitespace":
|
|
134
|
-
"no-unused-vars":
|
|
135
|
-
"spaced-comment":
|
|
133
|
+
"no-irregular-whitespace": "off";
|
|
134
|
+
"no-unused-vars": "off";
|
|
135
|
+
"spaced-comment": "off";
|
|
136
136
|
};
|
|
137
137
|
plugins?: undefined;
|
|
138
138
|
} | {
|
|
139
139
|
rules: {
|
|
140
|
-
"yml/block-mapping-question-indicator-newline":
|
|
141
|
-
"yml/block-mapping":
|
|
142
|
-
"yml/block-sequence-hyphen-indicator-newline":
|
|
143
|
-
"yml/block-sequence":
|
|
144
|
-
"yml/flow-mapping-curly-newline":
|
|
145
|
-
"yml/flow-mapping-curly-spacing":
|
|
146
|
-
"yml/flow-sequence-bracket-newline":
|
|
147
|
-
"yml/flow-sequence-bracket-spacing":
|
|
148
|
-
"yml/indent":
|
|
149
|
-
"yml/key-spacing":
|
|
150
|
-
"yml/no-empty-document":
|
|
151
|
-
"yml/no-empty-key":
|
|
152
|
-
"yml/no-empty-mapping-value":
|
|
153
|
-
"yml/no-empty-sequence-entry":
|
|
154
|
-
"yml/no-irregular-whitespace":
|
|
155
|
-
"yml/no-tab-indent":
|
|
156
|
-
"yml/plain-scalar":
|
|
157
|
-
"yml/quotes":
|
|
158
|
-
"yml/spaced-comment":
|
|
159
|
-
"yml/vue-custom-block/no-parsing-error":
|
|
140
|
+
"yml/block-mapping-question-indicator-newline": "error";
|
|
141
|
+
"yml/block-mapping": "error";
|
|
142
|
+
"yml/block-sequence-hyphen-indicator-newline": "error";
|
|
143
|
+
"yml/block-sequence": "error";
|
|
144
|
+
"yml/flow-mapping-curly-newline": "error";
|
|
145
|
+
"yml/flow-mapping-curly-spacing": "error";
|
|
146
|
+
"yml/flow-sequence-bracket-newline": "error";
|
|
147
|
+
"yml/flow-sequence-bracket-spacing": "error";
|
|
148
|
+
"yml/indent": "error";
|
|
149
|
+
"yml/key-spacing": "error";
|
|
150
|
+
"yml/no-empty-document": "error";
|
|
151
|
+
"yml/no-empty-key": "error";
|
|
152
|
+
"yml/no-empty-mapping-value": "error";
|
|
153
|
+
"yml/no-empty-sequence-entry": "error";
|
|
154
|
+
"yml/no-irregular-whitespace": "error";
|
|
155
|
+
"yml/no-tab-indent": "error";
|
|
156
|
+
"yml/plain-scalar": "error";
|
|
157
|
+
"yml/quotes": "error";
|
|
158
|
+
"yml/spaced-comment": "error";
|
|
159
|
+
"yml/vue-custom-block/no-parsing-error": "error";
|
|
160
160
|
};
|
|
161
161
|
})[];
|
|
162
162
|
"flat/prettier": ({
|
|
@@ -172,25 +172,25 @@ declare const _default: {
|
|
|
172
172
|
parser: typeof import("yaml-eslint-parser");
|
|
173
173
|
};
|
|
174
174
|
rules: {
|
|
175
|
-
"no-irregular-whitespace":
|
|
176
|
-
"no-unused-vars":
|
|
177
|
-
"spaced-comment":
|
|
175
|
+
"no-irregular-whitespace": "off";
|
|
176
|
+
"no-unused-vars": "off";
|
|
177
|
+
"spaced-comment": "off";
|
|
178
178
|
};
|
|
179
179
|
plugins?: undefined;
|
|
180
180
|
} | {
|
|
181
181
|
rules: {
|
|
182
|
-
"yml/block-mapping-colon-indicator-newline":
|
|
183
|
-
"yml/block-mapping-question-indicator-newline":
|
|
184
|
-
"yml/block-sequence-hyphen-indicator-newline":
|
|
185
|
-
"yml/flow-mapping-curly-newline":
|
|
186
|
-
"yml/flow-mapping-curly-spacing":
|
|
187
|
-
"yml/flow-sequence-bracket-newline":
|
|
188
|
-
"yml/flow-sequence-bracket-spacing":
|
|
189
|
-
"yml/indent":
|
|
190
|
-
"yml/key-spacing":
|
|
191
|
-
"yml/no-multiple-empty-lines":
|
|
192
|
-
"yml/no-trailing-zeros":
|
|
193
|
-
"yml/quotes":
|
|
182
|
+
"yml/block-mapping-colon-indicator-newline": "off";
|
|
183
|
+
"yml/block-mapping-question-indicator-newline": "off";
|
|
184
|
+
"yml/block-sequence-hyphen-indicator-newline": "off";
|
|
185
|
+
"yml/flow-mapping-curly-newline": "off";
|
|
186
|
+
"yml/flow-mapping-curly-spacing": "off";
|
|
187
|
+
"yml/flow-sequence-bracket-newline": "off";
|
|
188
|
+
"yml/flow-sequence-bracket-spacing": "off";
|
|
189
|
+
"yml/indent": "off";
|
|
190
|
+
"yml/key-spacing": "off";
|
|
191
|
+
"yml/no-multiple-empty-lines": "off";
|
|
192
|
+
"yml/no-trailing-zeros": "off";
|
|
193
|
+
"yml/quotes": "off";
|
|
194
194
|
};
|
|
195
195
|
})[];
|
|
196
196
|
};
|
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.15.0";
|
package/lib/meta.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const compat_1 = require("../utils/compat");
|
|
6
|
-
exports.default = (0,
|
|
6
|
+
exports.default = (0, index_1.createRule)("block-mapping-colon-indicator-newline", {
|
|
7
7
|
meta: {
|
|
8
8
|
docs: {
|
|
9
9
|
description: "enforce consistent line breaks after `:` indicator",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const compat_1 = require("../utils/compat");
|
|
6
|
-
exports.default = (0,
|
|
6
|
+
exports.default = (0, index_1.createRule)("block-mapping-question-indicator-newline", {
|
|
7
7
|
meta: {
|
|
8
8
|
docs: {
|
|
9
9
|
description: "enforce consistent line breaks after `?` indicator",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const yaml_1 = require("../utils/yaml");
|
|
6
6
|
const compat_1 = require("../utils/compat");
|
|
@@ -26,7 +26,7 @@ function parseOptions(option) {
|
|
|
26
26
|
}
|
|
27
27
|
return opt;
|
|
28
28
|
}
|
|
29
|
-
exports.default = (0,
|
|
29
|
+
exports.default = (0, index_1.createRule)("block-mapping", {
|
|
30
30
|
meta: {
|
|
31
31
|
docs: {
|
|
32
32
|
description: "require or disallow block style mappings.",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const compat_1 = require("../utils/compat");
|
|
6
|
-
exports.default = (0,
|
|
6
|
+
exports.default = (0, index_1.createRule)("block-sequence-hyphen-indicator-newline", {
|
|
7
7
|
meta: {
|
|
8
8
|
docs: {
|
|
9
9
|
description: "enforce consistent line breaks after `-` indicator",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const yaml_1 = require("../utils/yaml");
|
|
5
5
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
6
6
|
const compat_1 = require("../utils/compat");
|
|
@@ -26,7 +26,7 @@ function parseOptions(option) {
|
|
|
26
26
|
}
|
|
27
27
|
return opt;
|
|
28
28
|
}
|
|
29
|
-
exports.default = (0,
|
|
29
|
+
exports.default = (0, index_1.createRule)("block-sequence", {
|
|
30
30
|
meta: {
|
|
31
31
|
docs: {
|
|
32
32
|
description: "require or disallow block style sequences.",
|
|
@@ -4,9 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const
|
|
7
|
+
const index_1 = require("../utils/index");
|
|
8
8
|
const compat_1 = require("../utils/compat");
|
|
9
|
-
exports.default = (0,
|
|
9
|
+
exports.default = (0, index_1.createRule)("file-extension", {
|
|
10
10
|
meta: {
|
|
11
11
|
docs: {
|
|
12
12
|
description: "enforce YAML file extension",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const yaml_1 = require("../utils/yaml");
|
|
6
6
|
const compat_1 = require("../utils/compat");
|
|
@@ -57,7 +57,7 @@ function areLineBreaksRequired(node, options, first, last) {
|
|
|
57
57
|
objectProperties.length > 0 &&
|
|
58
58
|
first.loc.start.line !== last.loc.end.line));
|
|
59
59
|
}
|
|
60
|
-
exports.default = (0,
|
|
60
|
+
exports.default = (0, index_1.createRule)("flow-mapping-curly-newline", {
|
|
61
61
|
meta: {
|
|
62
62
|
docs: {
|
|
63
63
|
description: "enforce consistent line breaks inside braces",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
5
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
6
|
-
exports.default = (0,
|
|
6
|
+
exports.default = (0, index_1.createRule)("flow-mapping-curly-spacing", {
|
|
7
7
|
meta: {
|
|
8
8
|
docs: {
|
|
9
9
|
description: "enforce consistent spacing inside braces",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const yaml_1 = require("../utils/yaml");
|
|
5
5
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
6
6
|
const compat_1 = require("../utils/compat");
|
|
7
|
-
exports.default = (0,
|
|
7
|
+
exports.default = (0, index_1.createRule)("flow-sequence-bracket-newline", {
|
|
8
8
|
meta: {
|
|
9
9
|
docs: {
|
|
10
10
|
description: "enforce linebreaks after opening and before closing flow sequence brackets",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
5
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
6
|
-
exports.default = (0,
|
|
6
|
+
exports.default = (0, index_1.createRule)("flow-sequence-bracket-spacing", {
|
|
7
7
|
meta: {
|
|
8
8
|
docs: {
|
|
9
9
|
description: "enforce consistent spacing inside flow sequence brackets",
|
package/lib/rules/indent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const yaml_1 = require("../utils/yaml");
|
|
5
5
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
6
6
|
const compat_1 = require("../utils/compat");
|
|
@@ -26,7 +26,7 @@ function parseOptions(context) {
|
|
|
26
26
|
indicatorValueIndent,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
exports.default = (0,
|
|
29
|
+
exports.default = (0, index_1.createRule)("indent", {
|
|
30
30
|
meta: {
|
|
31
31
|
docs: {
|
|
32
32
|
description: "enforce consistent indentation",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const yaml_eslint_parser_1 = require("yaml-eslint-parser");
|
|
4
|
-
const
|
|
4
|
+
const index_1 = require("../utils/index");
|
|
5
5
|
const casing_1 = require("../utils/casing");
|
|
6
6
|
const casing_2 = require("../utils/casing");
|
|
7
7
|
const compat_1 = require("../utils/compat");
|
|
8
|
-
exports.default = (0,
|
|
8
|
+
exports.default = (0, index_1.createRule)("key-name-casing", {
|
|
9
9
|
meta: {
|
|
10
10
|
docs: {
|
|
11
11
|
description: "enforce naming convention to key names",
|
package/lib/rules/key-spacing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const compat_1 = require("../utils/compat");
|
|
6
6
|
function containsLineTerminator(str) {
|
|
@@ -101,7 +101,7 @@ const ALIGN_OBJECT_SCHEMA = {
|
|
|
101
101
|
properties: Object.assign({ on: ON_SCHEMA }, OBJECT_WITHOUT_ON_SCHEMA.properties),
|
|
102
102
|
additionalProperties: false,
|
|
103
103
|
};
|
|
104
|
-
exports.default = (0,
|
|
104
|
+
exports.default = (0, index_1.createRule)("key-spacing", {
|
|
105
105
|
meta: {
|
|
106
106
|
docs: {
|
|
107
107
|
description: "enforce consistent spacing between keys and values in mapping pairs",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("no-empty-document", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "disallow empty document",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("no-empty-key", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "disallow empty mapping keys",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("no-empty-mapping-value", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "disallow empty mapping values",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
5
|
const compat_1 = require("../utils/compat");
|
|
6
|
-
exports.default = (0,
|
|
6
|
+
exports.default = (0, index_1.createRule)("no-empty-sequence-entry", {
|
|
7
7
|
meta: {
|
|
8
8
|
docs: {
|
|
9
9
|
description: "disallow empty sequence entries",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
5
|
const ALL_IRREGULARS = /[\v\f\u0085\u00a0\u1680\u180e\u2000-\u200b\u2028\u2029\u202f\u205f\u3000\ufeff]/u;
|
|
6
6
|
const IRREGULAR_WHITESPACE = /[\v\f\u0085\u00a0\u1680\u180e\u2000-\u200b\u202f\u205f\u3000\ufeff]+/gu;
|
|
7
7
|
const IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/gu;
|
|
8
|
-
exports.default = (0,
|
|
8
|
+
exports.default = (0, index_1.createRule)("no-irregular-whitespace", {
|
|
9
9
|
meta: {
|
|
10
10
|
docs: {
|
|
11
11
|
description: "disallow irregular whitespace",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("no-multiple-empty-lines", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "disallow multiple empty lines",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("no-tab-indent", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "disallow tabs for indentation.",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("no-trailing-zeros", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "disallow trailing zeros for floats",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const yaml_eslint_parser_1 = require("yaml-eslint-parser");
|
|
4
|
-
const
|
|
4
|
+
const index_1 = require("../utils/index");
|
|
5
5
|
const compat_1 = require("../utils/compat");
|
|
6
6
|
const SYMBOLS = new Set([
|
|
7
7
|
":",
|
|
@@ -26,7 +26,7 @@ function toRegExps(patterns) {
|
|
|
26
26
|
function isStringScalar(node) {
|
|
27
27
|
return typeof node.value === "string";
|
|
28
28
|
}
|
|
29
|
-
exports.default = (0,
|
|
29
|
+
exports.default = (0, index_1.createRule)("plain-scalar", {
|
|
30
30
|
meta: {
|
|
31
31
|
docs: {
|
|
32
32
|
description: "require or disallow plain style scalar.",
|
|
@@ -44,6 +44,13 @@ exports.default = (0, utils_1.createRule)("plain-scalar", {
|
|
|
44
44
|
type: "array",
|
|
45
45
|
items: { type: "string" },
|
|
46
46
|
},
|
|
47
|
+
overrides: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {
|
|
50
|
+
mappingKey: { enum: ["always", "never", null] },
|
|
51
|
+
},
|
|
52
|
+
additionalProperties: false,
|
|
53
|
+
},
|
|
47
54
|
},
|
|
48
55
|
additionalProperties: false,
|
|
49
56
|
},
|
|
@@ -55,17 +62,37 @@ exports.default = (0, utils_1.createRule)("plain-scalar", {
|
|
|
55
62
|
type: "layout",
|
|
56
63
|
},
|
|
57
64
|
create(context) {
|
|
58
|
-
var _a, _b;
|
|
65
|
+
var _a, _b, _c, _d;
|
|
59
66
|
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
60
67
|
if (!sourceCode.parserServices.isYAML) {
|
|
61
68
|
return {};
|
|
62
69
|
}
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
const valueOption = {
|
|
71
|
+
prefer: context.options[0] || "always",
|
|
72
|
+
ignorePatterns: [],
|
|
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;
|
|
75
|
+
const keyOption = overridesMappingKey
|
|
76
|
+
? {
|
|
77
|
+
prefer: overridesMappingKey,
|
|
78
|
+
ignorePatterns: [],
|
|
79
|
+
}
|
|
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);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
if (valueOption.prefer === "always") {
|
|
86
|
+
valueOption.ignorePatterns = toRegExps([
|
|
87
|
+
String.raw `[\v\f\u0085\u00a0\u1680\u180e\u2000-\u200b\u2028\u2029\u202f\u205f\u3000\ufeff]`,
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
if (overridesMappingKey && keyOption.prefer === "always") {
|
|
91
|
+
keyOption.ignorePatterns = toRegExps([
|
|
92
|
+
String.raw `[\v\f\u0085\u00a0\u1680\u180e\u2000-\u200b\u2028\u2029\u202f\u205f\u3000\ufeff]`,
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
69
96
|
let currentDocument;
|
|
70
97
|
function canToPlain(node) {
|
|
71
98
|
if (node.value !== node.value.trim()) {
|
|
@@ -146,6 +173,17 @@ exports.default = (0, utils_1.createRule)("plain-scalar", {
|
|
|
146
173
|
},
|
|
147
174
|
});
|
|
148
175
|
}
|
|
176
|
+
function withinKey(node) {
|
|
177
|
+
const parent = node.parent;
|
|
178
|
+
if (parent.type === "YAMLPair" && parent.key === node) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
const grandParent = parent.parent;
|
|
182
|
+
if (grandParent.type === "YAMLWithMeta") {
|
|
183
|
+
return withinKey(grandParent);
|
|
184
|
+
}
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
149
187
|
return {
|
|
150
188
|
YAMLDocument(node) {
|
|
151
189
|
currentDocument = node;
|
|
@@ -154,10 +192,11 @@ exports.default = (0, utils_1.createRule)("plain-scalar", {
|
|
|
154
192
|
if (!isStringScalar(node)) {
|
|
155
193
|
return;
|
|
156
194
|
}
|
|
157
|
-
|
|
195
|
+
const option = withinKey(node) ? keyOption : valueOption;
|
|
196
|
+
if (option.ignorePatterns.some((p) => p.test(node.value))) {
|
|
158
197
|
return;
|
|
159
198
|
}
|
|
160
|
-
if (option === "always") {
|
|
199
|
+
if (option.prefer === "always") {
|
|
161
200
|
verifyAlways(node);
|
|
162
201
|
}
|
|
163
202
|
else {
|
package/lib/rules/quotes.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("quotes", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "enforce the consistent use of either double, or single quotes",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../utils/index");
|
|
4
4
|
const compat_1 = require("../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("require-string-key", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "disallow mapping keys other than strings",
|
package/lib/rules/sort-keys.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const natural_compare_1 = __importDefault(require("natural-compare"));
|
|
7
|
-
const
|
|
7
|
+
const index_1 = require("../utils/index");
|
|
8
8
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
9
9
|
const compat_1 = require("../utils/compat");
|
|
10
10
|
function isNewLine(char) {
|
|
@@ -217,7 +217,7 @@ const ORDER_OBJECT_SCHEMA = {
|
|
|
217
217
|
},
|
|
218
218
|
additionalProperties: false,
|
|
219
219
|
};
|
|
220
|
-
exports.default = (0,
|
|
220
|
+
exports.default = (0, index_1.createRule)("sort-keys", {
|
|
221
221
|
meta: {
|
|
222
222
|
docs: {
|
|
223
223
|
description: "require mapping keys to be sorted",
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const natural_compare_1 = __importDefault(require("natural-compare"));
|
|
7
|
-
const
|
|
7
|
+
const index_1 = require("../utils/index");
|
|
8
8
|
const ast_utils_1 = require("../utils/ast-utils");
|
|
9
9
|
const yaml_eslint_parser_1 = require("yaml-eslint-parser");
|
|
10
10
|
const compat_1 = require("../utils/compat");
|
|
@@ -248,7 +248,7 @@ const ORDER_OBJECT_SCHEMA = {
|
|
|
248
248
|
},
|
|
249
249
|
additionalProperties: false,
|
|
250
250
|
};
|
|
251
|
-
exports.default = (0,
|
|
251
|
+
exports.default = (0, index_1.createRule)("sort-sequence-values", {
|
|
252
252
|
meta: {
|
|
253
253
|
docs: {
|
|
254
254
|
description: "require sequence values to be sorted",
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const
|
|
7
|
+
const index_1 = require("../utils/index");
|
|
8
8
|
const compat_1 = require("../utils/compat");
|
|
9
9
|
function escapeText(s) {
|
|
10
10
|
return `(?:${lodash_1.default.escapeRegExp(s)})`;
|
|
@@ -49,7 +49,7 @@ function createNeverStylePattern(markers) {
|
|
|
49
49
|
const pattern = `^(${markers.map(escapeText).join("|")})?[ \t]+`;
|
|
50
50
|
return new RegExp(pattern, "u");
|
|
51
51
|
}
|
|
52
|
-
exports.default = (0,
|
|
52
|
+
exports.default = (0, index_1.createRule)("spaced-comment", {
|
|
53
53
|
meta: {
|
|
54
54
|
docs: {
|
|
55
55
|
description: "enforce consistent spacing after the `#` in a comment",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const index_1 = require("../../utils/index");
|
|
4
4
|
const compat_1 = require("../../utils/compat");
|
|
5
|
-
exports.default = (0,
|
|
5
|
+
exports.default = (0, index_1.createRule)("vue-custom-block/no-parsing-error", {
|
|
6
6
|
meta: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: "disallow parsing errors in Vue custom blocks",
|
package/lib/utils/ast-utils.js
CHANGED
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isCommentToken = isCommentToken;
|
|
4
|
+
exports.isTokenOnSameLine = isTokenOnSameLine;
|
|
5
|
+
exports.isQuestion = isQuestion;
|
|
6
|
+
exports.isHyphen = isHyphen;
|
|
7
|
+
exports.isColon = isColon;
|
|
8
|
+
exports.isComma = isComma;
|
|
9
|
+
exports.isOpeningBracketToken = isOpeningBracketToken;
|
|
10
|
+
exports.isClosingBracketToken = isClosingBracketToken;
|
|
11
|
+
exports.isOpeningBraceToken = isOpeningBraceToken;
|
|
12
|
+
exports.isClosingBraceToken = isClosingBraceToken;
|
|
4
13
|
function isCommentToken(token) {
|
|
5
14
|
return Boolean(token && (token.type === "Block" || token.type === "Line"));
|
|
6
15
|
}
|
|
7
|
-
exports.isCommentToken = isCommentToken;
|
|
8
16
|
function isTokenOnSameLine(left, right) {
|
|
9
17
|
return left.loc.end.line === right.loc.start.line;
|
|
10
18
|
}
|
|
11
|
-
exports.isTokenOnSameLine = isTokenOnSameLine;
|
|
12
19
|
function isQuestion(token) {
|
|
13
20
|
return token != null && token.type === "Punctuator" && token.value === "?";
|
|
14
21
|
}
|
|
15
|
-
exports.isQuestion = isQuestion;
|
|
16
22
|
function isHyphen(token) {
|
|
17
23
|
return token != null && token.type === "Punctuator" && token.value === "-";
|
|
18
24
|
}
|
|
19
|
-
exports.isHyphen = isHyphen;
|
|
20
25
|
function isColon(token) {
|
|
21
26
|
return token != null && token.type === "Punctuator" && token.value === ":";
|
|
22
27
|
}
|
|
23
|
-
exports.isColon = isColon;
|
|
24
28
|
function isComma(token) {
|
|
25
29
|
return token != null && token.type === "Punctuator" && token.value === ",";
|
|
26
30
|
}
|
|
27
|
-
exports.isComma = isComma;
|
|
28
31
|
function isOpeningBracketToken(token) {
|
|
29
32
|
return token != null && token.value === "[" && token.type === "Punctuator";
|
|
30
33
|
}
|
|
31
|
-
exports.isOpeningBracketToken = isOpeningBracketToken;
|
|
32
34
|
function isClosingBracketToken(token) {
|
|
33
35
|
return token != null && token.value === "]" && token.type === "Punctuator";
|
|
34
36
|
}
|
|
35
|
-
exports.isClosingBracketToken = isClosingBracketToken;
|
|
36
37
|
function isOpeningBraceToken(token) {
|
|
37
38
|
return token != null && token.value === "{" && token.type === "Punctuator";
|
|
38
39
|
}
|
|
39
|
-
exports.isOpeningBraceToken = isOpeningBraceToken;
|
|
40
40
|
function isClosingBraceToken(token) {
|
|
41
41
|
return token != null && token.value === "}" && token.type === "Punctuator";
|
|
42
42
|
}
|
|
43
|
-
exports.isClosingBraceToken = isClosingBraceToken;
|
package/lib/utils/casing.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.allowedCaseOptions = void 0;
|
|
4
|
+
exports.kebabCase = kebabCase;
|
|
5
|
+
exports.isKebabCase = isKebabCase;
|
|
6
|
+
exports.snakeCase = snakeCase;
|
|
7
|
+
exports.isSnakeCase = isSnakeCase;
|
|
8
|
+
exports.screamingSnakeCase = screamingSnakeCase;
|
|
9
|
+
exports.isScreamingSnakeCase = isScreamingSnakeCase;
|
|
10
|
+
exports.camelCase = camelCase;
|
|
11
|
+
exports.isCamelCase = isCamelCase;
|
|
12
|
+
exports.pascalCase = pascalCase;
|
|
13
|
+
exports.isPascalCase = isPascalCase;
|
|
14
|
+
exports.getChecker = getChecker;
|
|
15
|
+
exports.getConverter = getConverter;
|
|
16
|
+
exports.getExactConverter = getExactConverter;
|
|
4
17
|
exports.allowedCaseOptions = [
|
|
5
18
|
"camelCase",
|
|
6
19
|
"kebab-case",
|
|
@@ -27,7 +40,6 @@ function kebabCase(str) {
|
|
|
27
40
|
}
|
|
28
41
|
return res.toLowerCase();
|
|
29
42
|
}
|
|
30
|
-
exports.kebabCase = kebabCase;
|
|
31
43
|
function isKebabCase(str) {
|
|
32
44
|
if (hasUpper(str) ||
|
|
33
45
|
hasSymbols(str) ||
|
|
@@ -37,7 +49,6 @@ function isKebabCase(str) {
|
|
|
37
49
|
}
|
|
38
50
|
return true;
|
|
39
51
|
}
|
|
40
|
-
exports.isKebabCase = isKebabCase;
|
|
41
52
|
function snakeCase(str) {
|
|
42
53
|
let res = str.replace(/-/gu, "_");
|
|
43
54
|
if (hasLower(res)) {
|
|
@@ -45,14 +56,12 @@ function snakeCase(str) {
|
|
|
45
56
|
}
|
|
46
57
|
return res.toLowerCase();
|
|
47
58
|
}
|
|
48
|
-
exports.snakeCase = snakeCase;
|
|
49
59
|
function isSnakeCase(str) {
|
|
50
60
|
if (hasUpper(str) || hasSymbols(str) || /-|__|\s/u.test(str)) {
|
|
51
61
|
return false;
|
|
52
62
|
}
|
|
53
63
|
return true;
|
|
54
64
|
}
|
|
55
|
-
exports.isSnakeCase = isSnakeCase;
|
|
56
65
|
function screamingSnakeCase(str) {
|
|
57
66
|
let res = str.replace(/-/gu, "_");
|
|
58
67
|
if (hasLower(res)) {
|
|
@@ -60,14 +69,12 @@ function screamingSnakeCase(str) {
|
|
|
60
69
|
}
|
|
61
70
|
return res.toUpperCase();
|
|
62
71
|
}
|
|
63
|
-
exports.screamingSnakeCase = screamingSnakeCase;
|
|
64
72
|
function isScreamingSnakeCase(str) {
|
|
65
73
|
if (hasLower(str) || hasSymbols(str) || /-|__|\s/u.test(str)) {
|
|
66
74
|
return false;
|
|
67
75
|
}
|
|
68
76
|
return true;
|
|
69
77
|
}
|
|
70
|
-
exports.isScreamingSnakeCase = isScreamingSnakeCase;
|
|
71
78
|
function camelCase(str) {
|
|
72
79
|
if (isPascalCase(str)) {
|
|
73
80
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
@@ -78,7 +85,6 @@ function camelCase(str) {
|
|
|
78
85
|
}
|
|
79
86
|
return s.replace(/[-_](\w)/gu, (_, c) => (c ? c.toUpperCase() : ""));
|
|
80
87
|
}
|
|
81
|
-
exports.camelCase = camelCase;
|
|
82
88
|
function isCamelCase(str) {
|
|
83
89
|
if (hasSymbols(str) ||
|
|
84
90
|
/^[A-Z]/u.test(str) ||
|
|
@@ -87,11 +93,9 @@ function isCamelCase(str) {
|
|
|
87
93
|
}
|
|
88
94
|
return true;
|
|
89
95
|
}
|
|
90
|
-
exports.isCamelCase = isCamelCase;
|
|
91
96
|
function pascalCase(str) {
|
|
92
97
|
return capitalize(camelCase(str));
|
|
93
98
|
}
|
|
94
|
-
exports.pascalCase = pascalCase;
|
|
95
99
|
function isPascalCase(str) {
|
|
96
100
|
if (hasSymbols(str) ||
|
|
97
101
|
/^[a-z]/u.test(str) ||
|
|
@@ -100,7 +104,6 @@ function isPascalCase(str) {
|
|
|
100
104
|
}
|
|
101
105
|
return true;
|
|
102
106
|
}
|
|
103
|
-
exports.isPascalCase = isPascalCase;
|
|
104
107
|
const convertersMap = {
|
|
105
108
|
"kebab-case": kebabCase,
|
|
106
109
|
snake_case: snakeCase,
|
|
@@ -118,11 +121,9 @@ const checkersMap = {
|
|
|
118
121
|
function getChecker(name) {
|
|
119
122
|
return checkersMap[name] || isPascalCase;
|
|
120
123
|
}
|
|
121
|
-
exports.getChecker = getChecker;
|
|
122
124
|
function getConverter(name) {
|
|
123
125
|
return convertersMap[name] || pascalCase;
|
|
124
126
|
}
|
|
125
|
-
exports.getConverter = getConverter;
|
|
126
127
|
function getExactConverter(name) {
|
|
127
128
|
const converter = getConverter(name);
|
|
128
129
|
const checker = getChecker(name);
|
|
@@ -131,4 +132,3 @@ function getExactConverter(name) {
|
|
|
131
132
|
return checker(result) ? result : str;
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
|
-
exports.getExactConverter = getExactConverter;
|
package/lib/utils/compat.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getSourceCode = getSourceCode;
|
|
4
|
+
exports.getFilename = getFilename;
|
|
4
5
|
const eslint_compat_utils_1 = require("eslint-compat-utils");
|
|
5
6
|
function getSourceCode(context) {
|
|
6
7
|
return (0, eslint_compat_utils_1.getSourceCode)(context);
|
|
7
8
|
}
|
|
8
|
-
exports.getSourceCode = getSourceCode;
|
|
9
9
|
function getFilename(context) {
|
|
10
10
|
return (0, eslint_compat_utils_1.getFilename)(context);
|
|
11
11
|
}
|
|
12
|
-
exports.getFilename = getFilename;
|
package/lib/utils/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.createRule =
|
|
29
|
+
exports.createRule = createRule;
|
|
30
30
|
const yamlESLintParser = __importStar(require("yaml-eslint-parser"));
|
|
31
31
|
const path_1 = __importDefault(require("path"));
|
|
32
32
|
const compat_1 = require("./compat");
|
|
@@ -53,4 +53,3 @@ function createRule(ruleName, rule) {
|
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
exports.createRule = createRule;
|
package/lib/utils/yaml.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.hasTabIndent = hasTabIndent;
|
|
4
|
+
exports.calcExpectIndentForPairs = calcExpectIndentForPairs;
|
|
5
|
+
exports.calcExpectIndentForEntries = calcExpectIndentForEntries;
|
|
6
|
+
exports.getActualIndent = getActualIndent;
|
|
7
|
+
exports.getActualIndentFromLine = getActualIndentFromLine;
|
|
8
|
+
exports.incIndent = incIndent;
|
|
9
|
+
exports.decIndent = decIndent;
|
|
10
|
+
exports.getNumOfIndent = getNumOfIndent;
|
|
11
|
+
exports.compareIndent = compareIndent;
|
|
12
|
+
exports.isKeyNode = isKeyNode;
|
|
13
|
+
exports.unwrapMeta = unwrapMeta;
|
|
14
|
+
exports.processIndentFix = processIndentFix;
|
|
15
|
+
exports.fixIndent = fixIndent;
|
|
4
16
|
const ast_utils_1 = require("./ast-utils");
|
|
5
17
|
const compat_1 = require("./compat");
|
|
6
18
|
function hasTabIndent(context) {
|
|
@@ -14,7 +26,6 @@ function hasTabIndent(context) {
|
|
|
14
26
|
}
|
|
15
27
|
return false;
|
|
16
28
|
}
|
|
17
|
-
exports.hasTabIndent = hasTabIndent;
|
|
18
29
|
function calcExpectIndentForPairs(mapping, context) {
|
|
19
30
|
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
20
31
|
let parentNode = mapping.parent;
|
|
@@ -57,7 +68,6 @@ function calcExpectIndentForPairs(mapping, context) {
|
|
|
57
68
|
}
|
|
58
69
|
return calcExpectIndentFromBaseNode(parentNode, mapping.pairs[0], context);
|
|
59
70
|
}
|
|
60
|
-
exports.calcExpectIndentForPairs = calcExpectIndentForPairs;
|
|
61
71
|
function calcExpectIndentForEntries(sequence, context) {
|
|
62
72
|
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
63
73
|
let parentNode = sequence.parent;
|
|
@@ -100,7 +110,6 @@ function calcExpectIndentForEntries(sequence, context) {
|
|
|
100
110
|
}
|
|
101
111
|
return calcExpectIndentFromBaseNode(parentNode, sequence.entries[0], context);
|
|
102
112
|
}
|
|
103
|
-
exports.calcExpectIndentForEntries = calcExpectIndentForEntries;
|
|
104
113
|
function calcExpectIndentFromBaseNode(baseNode, node, context) {
|
|
105
114
|
const baseIndent = getActualIndent(baseNode, context);
|
|
106
115
|
if (baseIndent == null) {
|
|
@@ -120,13 +129,11 @@ function getActualIndent(node, context) {
|
|
|
120
129
|
}
|
|
121
130
|
return null;
|
|
122
131
|
}
|
|
123
|
-
exports.getActualIndent = getActualIndent;
|
|
124
132
|
function getActualIndentFromLine(line, context) {
|
|
125
133
|
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
126
134
|
const lineText = sourceCode.getLines()[line - 1];
|
|
127
135
|
return /^[^\S\n\r\u2028\u2029]*/u.exec(lineText)[0];
|
|
128
136
|
}
|
|
129
|
-
exports.getActualIndentFromLine = getActualIndentFromLine;
|
|
130
137
|
function incIndent(indent, context) {
|
|
131
138
|
const numOfIndent = getNumOfIndent(context);
|
|
132
139
|
const add = numOfIndent === 2
|
|
@@ -136,18 +143,15 @@ function incIndent(indent, context) {
|
|
|
136
143
|
: " ".repeat(numOfIndent);
|
|
137
144
|
return `${indent}${add}`;
|
|
138
145
|
}
|
|
139
|
-
exports.incIndent = incIndent;
|
|
140
146
|
function decIndent(indent, context) {
|
|
141
147
|
const numOfIndent = getNumOfIndent(context);
|
|
142
148
|
return " ".repeat(indent.length - numOfIndent);
|
|
143
149
|
}
|
|
144
|
-
exports.decIndent = decIndent;
|
|
145
150
|
function getNumOfIndent(context, optionValue) {
|
|
146
151
|
var _a, _b;
|
|
147
152
|
const num = optionValue !== null && optionValue !== void 0 ? optionValue : (_b = (_a = context.settings) === null || _a === void 0 ? void 0 : _a.yml) === null || _b === void 0 ? void 0 : _b.indent;
|
|
148
153
|
return num == null || num < 2 ? 2 : num;
|
|
149
154
|
}
|
|
150
|
-
exports.getNumOfIndent = getNumOfIndent;
|
|
151
155
|
function compareIndent(a, b) {
|
|
152
156
|
const minLen = Math.min(a.length, b.length);
|
|
153
157
|
for (let index = 0; index < minLen; index++) {
|
|
@@ -157,14 +161,12 @@ function compareIndent(a, b) {
|
|
|
157
161
|
}
|
|
158
162
|
return a.length > b.length ? 1 : a.length < b.length ? -1 : 0;
|
|
159
163
|
}
|
|
160
|
-
exports.compareIndent = compareIndent;
|
|
161
164
|
function isKeyNode(node) {
|
|
162
165
|
if (node.parent.type === "YAMLWithMeta") {
|
|
163
166
|
return isKeyNode(node.parent);
|
|
164
167
|
}
|
|
165
168
|
return node.parent.type === "YAMLPair" && node.parent.key === node;
|
|
166
169
|
}
|
|
167
|
-
exports.isKeyNode = isKeyNode;
|
|
168
170
|
function unwrapMeta(node) {
|
|
169
171
|
if (!node) {
|
|
170
172
|
return node;
|
|
@@ -174,7 +176,6 @@ function unwrapMeta(node) {
|
|
|
174
176
|
}
|
|
175
177
|
return node;
|
|
176
178
|
}
|
|
177
|
-
exports.unwrapMeta = unwrapMeta;
|
|
178
179
|
function* processIndentFix(fixer, baseIndent, targetNode, context) {
|
|
179
180
|
const sourceCode = (0, compat_1.getSourceCode)(context);
|
|
180
181
|
if (targetNode.type === "YAMLWithMeta") {
|
|
@@ -256,11 +257,9 @@ function* processIndentFix(fixer, baseIndent, targetNode, context) {
|
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
}
|
|
259
|
-
exports.processIndentFix = processIndentFix;
|
|
260
260
|
function fixIndent(fixer, sourceCode, indent, node) {
|
|
261
261
|
const prevToken = sourceCode.getTokenBefore(node, {
|
|
262
262
|
includeComments: true,
|
|
263
263
|
});
|
|
264
264
|
return fixer.replaceTextRange([prevToken.range[1], node.range[0]], `\n${indent}`);
|
|
265
265
|
}
|
|
266
|
-
exports.fixIndent = fixIndent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-yml",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "This ESLint plugin provides linting rules for YAML.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"build:meta": "npm run ts -- ./tools/update-meta.ts",
|
|
16
16
|
"build:ts": "tsc --project ./tsconfig.build.json",
|
|
17
17
|
"clean": "rimraf .nyc_output dist coverage",
|
|
18
|
-
"lint": "eslint .
|
|
19
|
-
"eslint-fix": "eslint . --
|
|
18
|
+
"lint": "eslint .",
|
|
19
|
+
"eslint-fix": "eslint . --fix",
|
|
20
20
|
"eslint-test-fix": "eslint tests/src/rules/*.ts --fix -c .eslintrc.for-vscode.js",
|
|
21
21
|
"pretest:base": "cross-env DEBUG=eslint-plugin-yml*",
|
|
22
22
|
"test:base": "npm run mocha -- \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
|
|
@@ -69,43 +69,45 @@
|
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@changesets/changelog-github": "^0.5.0",
|
|
71
71
|
"@changesets/cli": "^2.24.2",
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
72
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
|
|
73
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
74
|
+
"@eslint/js": "^9.5.0",
|
|
75
|
+
"@ota-meshi/eslint-plugin": "^0.17.3",
|
|
76
|
+
"@ota-meshi/site-kit-eslint-editor-vue": "^0.2.0",
|
|
74
77
|
"@types/debug": "^4.1.5",
|
|
75
|
-
"@types/eslint": "^
|
|
78
|
+
"@types/eslint": "^9.0.0",
|
|
76
79
|
"@types/eslint-scope": "^3.7.0",
|
|
77
80
|
"@types/eslint-visitor-keys": "^3.0.0",
|
|
78
81
|
"@types/estree": "^1.0.0",
|
|
79
82
|
"@types/lodash": "^4.14.158",
|
|
80
83
|
"@types/mocha": "^10.0.0",
|
|
81
84
|
"@types/natural-compare": "^1.4.0",
|
|
82
|
-
"@types/node": "^
|
|
85
|
+
"@types/node": "^22.0.0",
|
|
83
86
|
"@types/semver": "^7.3.1",
|
|
84
|
-
"@typescript-eslint/eslint-plugin": "
|
|
85
|
-
"@typescript-eslint/parser": "
|
|
87
|
+
"@typescript-eslint/eslint-plugin": "~8.12.0",
|
|
88
|
+
"@typescript-eslint/parser": "~8.12.0",
|
|
86
89
|
"cross-env": "^7.0.2",
|
|
87
90
|
"env-cmd": "^10.1.0",
|
|
88
|
-
"esbuild": "^0.
|
|
91
|
+
"esbuild": "^0.24.0",
|
|
89
92
|
"esbuild-register": "^3.2.0",
|
|
90
|
-
"eslint": "^
|
|
93
|
+
"eslint": "^9.5.0",
|
|
91
94
|
"eslint-config-prettier": "^9.0.0",
|
|
92
|
-
"eslint-plugin-eslint-
|
|
93
|
-
"eslint-plugin-eslint-plugin": "^5.0.0",
|
|
95
|
+
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
94
96
|
"eslint-plugin-eslint-rule-tester": "^0.6.0",
|
|
95
|
-
"eslint-plugin-
|
|
97
|
+
"eslint-plugin-jsdoc": "^50.0.0",
|
|
98
|
+
"eslint-plugin-json-schema-validator": "^5.0.0",
|
|
96
99
|
"eslint-plugin-jsonc": "^2.0.0",
|
|
97
|
-
"eslint-plugin-markdown": "^
|
|
98
|
-
"eslint-plugin-n": "^
|
|
99
|
-
"eslint-plugin-node-dependencies": "^0.
|
|
100
|
+
"eslint-plugin-markdown": "^5.0.0",
|
|
101
|
+
"eslint-plugin-n": "^17.0.0",
|
|
102
|
+
"eslint-plugin-node-dependencies": "^0.12.0",
|
|
100
103
|
"eslint-plugin-prettier": "^5.0.0",
|
|
101
104
|
"eslint-plugin-regexp": "^2.0.0",
|
|
102
105
|
"eslint-plugin-vue": "^9.0.0",
|
|
103
106
|
"eslint-plugin-yml": "^1.0.0",
|
|
104
|
-
"espree": "^10.0.0",
|
|
105
107
|
"events": "^3.3.0",
|
|
106
108
|
"mocha": "^10.0.0",
|
|
107
|
-
"monaco-editor": "^0.
|
|
108
|
-
"nyc": "^
|
|
109
|
+
"monaco-editor": "^0.52.0",
|
|
110
|
+
"nyc": "^17.0.0",
|
|
109
111
|
"pako": "^2.1.0",
|
|
110
112
|
"prettier": "^3.0.3",
|
|
111
113
|
"semver": "^7.3.2",
|
|
@@ -114,13 +116,15 @@
|
|
|
114
116
|
"stylelint-config-standard": "^36.0.0",
|
|
115
117
|
"stylelint-config-standard-vue": "^1.0.0",
|
|
116
118
|
"stylelint-stylus": "^1.0.0",
|
|
117
|
-
"typescript": "~5.
|
|
118
|
-
"
|
|
119
|
+
"typescript": "~5.6.0",
|
|
120
|
+
"typescript-eslint": "^8.0.0",
|
|
121
|
+
"vite-plugin-eslint4b": "^0.4.6",
|
|
119
122
|
"vitepress": "^1.0.0-rc.17",
|
|
120
123
|
"vue-eslint-parser": "^9.0.0",
|
|
121
124
|
"yaml": "^2.1.1"
|
|
122
125
|
},
|
|
123
126
|
"publishConfig": {
|
|
124
127
|
"access": "public"
|
|
125
|
-
}
|
|
128
|
+
},
|
|
129
|
+
"packageManager": "npm@10.9.0"
|
|
126
130
|
}
|