eslint-plugin-yml 1.12.2 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -65,7 +65,39 @@ npm install --save-dev eslint eslint-plugin-yml
65
65
 
66
66
  ### Configuration
67
67
 
68
- Use `.eslintrc.*` file to configure rules. See also: [https://eslint.org/docs/user-guide/configuring](https://eslint.org/docs/user-guide/configuring).
68
+ #### New (ESLint>=v9) Config (Flat Config)
69
+
70
+ Use `eslint.config.js` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/configuration-files-new>.
71
+
72
+ Example **eslint.config.js**:
73
+
74
+ ```mjs
75
+ import eslintPluginYml from 'eslint-plugin-yml';
76
+ export default [
77
+ // add more generic rule sets here, such as:
78
+ // js.configs.recommended,
79
+ ...eslintPluginYml.configs['flat/recommended'],
80
+ {
81
+ rules: {
82
+ // override/add rules settings here, such as:
83
+ // 'yml/rule-name': 'error'
84
+ }
85
+ }
86
+ ];
87
+ ```
88
+
89
+ This plugin provides configs:
90
+
91
+ - `*.configs['flat/base']` ... Configuration to enable correct YAML parsing.
92
+ - `*.configs['flat/recommended']` ... Above, plus rules to prevent errors or unintended behavior.
93
+ - `*.configs['flat/standard']` ... Above, plus rules to enforce the common stylistic conventions.
94
+ - `*.configs['flat/prettier']` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
95
+
96
+ See [the rule list](https://ota-meshi.github.io/eslint-plugin-yml/rules/) to get the `rules` that this plugin provides.
97
+
98
+ #### Legacy Config (ESLint<v9)
99
+
100
+ Use `.eslintrc.*` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/>.
69
101
 
70
102
  Example **.eslintrc.js**:
71
103
 
@@ -0,0 +1,22 @@
1
+ import type { ESLint } from "eslint";
2
+ import * as parser from "yaml-eslint-parser";
3
+ declare const _default: ({
4
+ plugins: {
5
+ readonly yml: ESLint.Plugin;
6
+ };
7
+ files?: undefined;
8
+ languageOptions?: undefined;
9
+ rules?: undefined;
10
+ } | {
11
+ files: string[];
12
+ languageOptions: {
13
+ parser: typeof parser;
14
+ };
15
+ rules: {
16
+ "no-irregular-whitespace": string;
17
+ "no-unused-vars": string;
18
+ "spaced-comment": string;
19
+ };
20
+ plugins?: undefined;
21
+ })[];
22
+ export default _default;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const parser = __importStar(require("yaml-eslint-parser"));
27
+ exports.default = [
28
+ {
29
+ plugins: {
30
+ get yml() {
31
+ return require("../../index");
32
+ },
33
+ },
34
+ },
35
+ {
36
+ files: ["*.yaml", "**/*.yaml", "*.yml", "**/*.yml"],
37
+ languageOptions: {
38
+ parser,
39
+ },
40
+ rules: {
41
+ "no-irregular-whitespace": "off",
42
+ "no-unused-vars": "off",
43
+ "spaced-comment": "off",
44
+ },
45
+ },
46
+ ];
@@ -0,0 +1,35 @@
1
+ declare const _default: ({
2
+ plugins: {
3
+ readonly yml: import("eslint").ESLint.Plugin;
4
+ };
5
+ files?: undefined;
6
+ languageOptions?: undefined;
7
+ rules?: undefined;
8
+ } | {
9
+ files: string[];
10
+ languageOptions: {
11
+ parser: typeof import("yaml-eslint-parser");
12
+ };
13
+ rules: {
14
+ "no-irregular-whitespace": string;
15
+ "no-unused-vars": string;
16
+ "spaced-comment": string;
17
+ };
18
+ plugins?: undefined;
19
+ } | {
20
+ rules: {
21
+ "yml/block-mapping-colon-indicator-newline": string;
22
+ "yml/block-mapping-question-indicator-newline": string;
23
+ "yml/block-sequence-hyphen-indicator-newline": string;
24
+ "yml/flow-mapping-curly-newline": string;
25
+ "yml/flow-mapping-curly-spacing": string;
26
+ "yml/flow-sequence-bracket-newline": string;
27
+ "yml/flow-sequence-bracket-spacing": string;
28
+ "yml/indent": string;
29
+ "yml/key-spacing": string;
30
+ "yml/no-multiple-empty-lines": string;
31
+ "yml/no-trailing-zeros": string;
32
+ "yml/quotes": string;
33
+ };
34
+ })[];
35
+ export default _default;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const base_1 = __importDefault(require("./base"));
7
+ exports.default = [
8
+ ...base_1.default,
9
+ {
10
+ rules: {
11
+ "yml/block-mapping-colon-indicator-newline": "off",
12
+ "yml/block-mapping-question-indicator-newline": "off",
13
+ "yml/block-sequence-hyphen-indicator-newline": "off",
14
+ "yml/flow-mapping-curly-newline": "off",
15
+ "yml/flow-mapping-curly-spacing": "off",
16
+ "yml/flow-sequence-bracket-newline": "off",
17
+ "yml/flow-sequence-bracket-spacing": "off",
18
+ "yml/indent": "off",
19
+ "yml/key-spacing": "off",
20
+ "yml/no-multiple-empty-lines": "off",
21
+ "yml/no-trailing-zeros": "off",
22
+ "yml/quotes": "off",
23
+ },
24
+ },
25
+ ];
@@ -0,0 +1,30 @@
1
+ declare const _default: ({
2
+ plugins: {
3
+ readonly yml: import("eslint").ESLint.Plugin;
4
+ };
5
+ files?: undefined;
6
+ languageOptions?: undefined;
7
+ rules?: undefined;
8
+ } | {
9
+ files: string[];
10
+ languageOptions: {
11
+ parser: typeof import("yaml-eslint-parser");
12
+ };
13
+ rules: {
14
+ "no-irregular-whitespace": string;
15
+ "no-unused-vars": string;
16
+ "spaced-comment": string;
17
+ };
18
+ plugins?: undefined;
19
+ } | {
20
+ rules: {
21
+ "yml/no-empty-document": string;
22
+ "yml/no-empty-key": string;
23
+ "yml/no-empty-mapping-value": string;
24
+ "yml/no-empty-sequence-entry": string;
25
+ "yml/no-irregular-whitespace": string;
26
+ "yml/no-tab-indent": string;
27
+ "yml/vue-custom-block/no-parsing-error": string;
28
+ };
29
+ })[];
30
+ export default _default;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const base_1 = __importDefault(require("./base"));
7
+ exports.default = [
8
+ ...base_1.default,
9
+ {
10
+ rules: {
11
+ "yml/no-empty-document": "error",
12
+ "yml/no-empty-key": "error",
13
+ "yml/no-empty-mapping-value": "error",
14
+ "yml/no-empty-sequence-entry": "error",
15
+ "yml/no-irregular-whitespace": "error",
16
+ "yml/no-tab-indent": "error",
17
+ "yml/vue-custom-block/no-parsing-error": "error",
18
+ },
19
+ },
20
+ ];
@@ -0,0 +1,43 @@
1
+ declare const _default: ({
2
+ plugins: {
3
+ readonly yml: import("eslint").ESLint.Plugin;
4
+ };
5
+ files?: undefined;
6
+ languageOptions?: undefined;
7
+ rules?: undefined;
8
+ } | {
9
+ files: string[];
10
+ languageOptions: {
11
+ parser: typeof import("yaml-eslint-parser");
12
+ };
13
+ rules: {
14
+ "no-irregular-whitespace": string;
15
+ "no-unused-vars": string;
16
+ "spaced-comment": string;
17
+ };
18
+ plugins?: undefined;
19
+ } | {
20
+ rules: {
21
+ "yml/block-mapping-question-indicator-newline": string;
22
+ "yml/block-mapping": string;
23
+ "yml/block-sequence-hyphen-indicator-newline": string;
24
+ "yml/block-sequence": string;
25
+ "yml/flow-mapping-curly-newline": string;
26
+ "yml/flow-mapping-curly-spacing": string;
27
+ "yml/flow-sequence-bracket-newline": string;
28
+ "yml/flow-sequence-bracket-spacing": string;
29
+ "yml/indent": string;
30
+ "yml/key-spacing": string;
31
+ "yml/no-empty-document": string;
32
+ "yml/no-empty-key": string;
33
+ "yml/no-empty-mapping-value": string;
34
+ "yml/no-empty-sequence-entry": string;
35
+ "yml/no-irregular-whitespace": string;
36
+ "yml/no-tab-indent": string;
37
+ "yml/plain-scalar": string;
38
+ "yml/quotes": string;
39
+ "yml/spaced-comment": string;
40
+ "yml/vue-custom-block/no-parsing-error": string;
41
+ };
42
+ })[];
43
+ export default _default;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const base_1 = __importDefault(require("./base"));
7
+ exports.default = [
8
+ ...base_1.default,
9
+ {
10
+ rules: {
11
+ "yml/block-mapping-question-indicator-newline": "error",
12
+ "yml/block-mapping": "error",
13
+ "yml/block-sequence-hyphen-indicator-newline": "error",
14
+ "yml/block-sequence": "error",
15
+ "yml/flow-mapping-curly-newline": "error",
16
+ "yml/flow-mapping-curly-spacing": "error",
17
+ "yml/flow-sequence-bracket-newline": "error",
18
+ "yml/flow-sequence-bracket-spacing": "error",
19
+ "yml/indent": "error",
20
+ "yml/key-spacing": "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/plain-scalar": "error",
28
+ "yml/quotes": "error",
29
+ "yml/spaced-comment": "error",
30
+ "yml/vue-custom-block/no-parsing-error": "error",
31
+ },
32
+ },
33
+ ];
package/lib/index.d.ts CHANGED
@@ -69,6 +69,130 @@ declare const _default: {
69
69
  "yml/quotes": string;
70
70
  };
71
71
  };
72
+ "flat/base": ({
73
+ plugins: {
74
+ readonly yml: import("eslint").ESLint.Plugin;
75
+ };
76
+ files?: undefined;
77
+ languageOptions?: undefined;
78
+ rules?: undefined;
79
+ } | {
80
+ files: string[];
81
+ languageOptions: {
82
+ parser: typeof import("yaml-eslint-parser");
83
+ };
84
+ rules: {
85
+ "no-irregular-whitespace": string;
86
+ "no-unused-vars": string;
87
+ "spaced-comment": string;
88
+ };
89
+ plugins?: undefined;
90
+ })[];
91
+ "flat/recommended": ({
92
+ plugins: {
93
+ readonly yml: import("eslint").ESLint.Plugin;
94
+ };
95
+ files?: undefined;
96
+ languageOptions?: undefined;
97
+ rules?: undefined;
98
+ } | {
99
+ files: string[];
100
+ languageOptions: {
101
+ parser: typeof import("yaml-eslint-parser");
102
+ };
103
+ rules: {
104
+ "no-irregular-whitespace": string;
105
+ "no-unused-vars": string;
106
+ "spaced-comment": string;
107
+ };
108
+ plugins?: undefined;
109
+ } | {
110
+ rules: {
111
+ "yml/no-empty-document": string;
112
+ "yml/no-empty-key": string;
113
+ "yml/no-empty-mapping-value": string;
114
+ "yml/no-empty-sequence-entry": string;
115
+ "yml/no-irregular-whitespace": string;
116
+ "yml/no-tab-indent": string;
117
+ "yml/vue-custom-block/no-parsing-error": string;
118
+ };
119
+ })[];
120
+ "flat/standard": ({
121
+ plugins: {
122
+ readonly yml: import("eslint").ESLint.Plugin;
123
+ };
124
+ files?: undefined;
125
+ languageOptions?: undefined;
126
+ rules?: undefined;
127
+ } | {
128
+ files: string[];
129
+ languageOptions: {
130
+ parser: typeof import("yaml-eslint-parser");
131
+ };
132
+ rules: {
133
+ "no-irregular-whitespace": string;
134
+ "no-unused-vars": string;
135
+ "spaced-comment": string;
136
+ };
137
+ plugins?: undefined;
138
+ } | {
139
+ rules: {
140
+ "yml/block-mapping-question-indicator-newline": string;
141
+ "yml/block-mapping": string;
142
+ "yml/block-sequence-hyphen-indicator-newline": string;
143
+ "yml/block-sequence": string;
144
+ "yml/flow-mapping-curly-newline": string;
145
+ "yml/flow-mapping-curly-spacing": string;
146
+ "yml/flow-sequence-bracket-newline": string;
147
+ "yml/flow-sequence-bracket-spacing": string;
148
+ "yml/indent": string;
149
+ "yml/key-spacing": string;
150
+ "yml/no-empty-document": string;
151
+ "yml/no-empty-key": string;
152
+ "yml/no-empty-mapping-value": string;
153
+ "yml/no-empty-sequence-entry": string;
154
+ "yml/no-irregular-whitespace": string;
155
+ "yml/no-tab-indent": string;
156
+ "yml/plain-scalar": string;
157
+ "yml/quotes": string;
158
+ "yml/spaced-comment": string;
159
+ "yml/vue-custom-block/no-parsing-error": string;
160
+ };
161
+ })[];
162
+ "flat/prettier": ({
163
+ plugins: {
164
+ readonly yml: import("eslint").ESLint.Plugin;
165
+ };
166
+ files?: undefined;
167
+ languageOptions?: undefined;
168
+ rules?: undefined;
169
+ } | {
170
+ files: string[];
171
+ languageOptions: {
172
+ parser: typeof import("yaml-eslint-parser");
173
+ };
174
+ rules: {
175
+ "no-irregular-whitespace": string;
176
+ "no-unused-vars": string;
177
+ "spaced-comment": string;
178
+ };
179
+ plugins?: undefined;
180
+ } | {
181
+ rules: {
182
+ "yml/block-mapping-colon-indicator-newline": string;
183
+ "yml/block-mapping-question-indicator-newline": string;
184
+ "yml/block-sequence-hyphen-indicator-newline": string;
185
+ "yml/flow-mapping-curly-newline": string;
186
+ "yml/flow-mapping-curly-spacing": string;
187
+ "yml/flow-sequence-bracket-newline": string;
188
+ "yml/flow-sequence-bracket-spacing": string;
189
+ "yml/indent": string;
190
+ "yml/key-spacing": string;
191
+ "yml/no-multiple-empty-lines": string;
192
+ "yml/no-trailing-zeros": string;
193
+ "yml/quotes": string;
194
+ };
195
+ })[];
72
196
  };
73
197
  rules: {
74
198
  [key: string]: RuleModule;
package/lib/index.js CHANGED
@@ -30,12 +30,20 @@ const base_1 = __importDefault(require("./configs/base"));
30
30
  const recommended_1 = __importDefault(require("./configs/recommended"));
31
31
  const standard_1 = __importDefault(require("./configs/standard"));
32
32
  const prettier_1 = __importDefault(require("./configs/prettier"));
33
+ const base_2 = __importDefault(require("./configs/flat/base"));
34
+ const recommended_2 = __importDefault(require("./configs/flat/recommended"));
35
+ const standard_2 = __importDefault(require("./configs/flat/standard"));
36
+ const prettier_2 = __importDefault(require("./configs/flat/prettier"));
33
37
  const meta = __importStar(require("./meta"));
34
38
  const configs = {
35
39
  base: base_1.default,
36
40
  recommended: recommended_1.default,
37
41
  standard: standard_1.default,
38
42
  prettier: prettier_1.default,
43
+ "flat/base": base_2.default,
44
+ "flat/recommended": recommended_2.default,
45
+ "flat/standard": standard_2.default,
46
+ "flat/prettier": prettier_2.default,
39
47
  };
40
48
  const rules = rules_1.rules.reduce((obj, r) => {
41
49
  obj[r.meta.docs.ruleName] = r;
package/lib/meta.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const name: "eslint-plugin-yml";
2
- export declare const version: "1.12.2";
1
+ export declare const name = "eslint-plugin-yml";
2
+ export declare const version = "1.13.1";
package/lib/meta.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = "eslint-plugin-yml";
5
- exports.version = "1.12.2";
5
+ exports.version = "1.13.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-yml",
3
- "version": "1.12.2",
3
+ "version": "1.13.1",
4
4
  "description": "This ESLint plugin provides linting rules for YAML.",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -57,7 +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.4.0",
60
+ "eslint-compat-utils": "^0.5.0",
61
61
  "lodash": "^4.17.21",
62
62
  "natural-compare": "^1.4.0",
63
63
  "yaml-eslint-parser": "^1.2.1"
@@ -80,16 +80,17 @@
80
80
  "@types/natural-compare": "^1.4.0",
81
81
  "@types/node": "^20.0.0",
82
82
  "@types/semver": "^7.3.1",
83
- "@typescript-eslint/eslint-plugin": "^6.19.0",
84
- "@typescript-eslint/parser": "^6.19.0",
83
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
84
+ "@typescript-eslint/parser": "^7.0.0",
85
85
  "cross-env": "^7.0.2",
86
86
  "env-cmd": "^10.1.0",
87
- "esbuild": "^0.19.3",
87
+ "esbuild": "^0.20.0",
88
88
  "esbuild-register": "^3.2.0",
89
89
  "eslint": "^8.0.0",
90
90
  "eslint-config-prettier": "^9.0.0",
91
91
  "eslint-plugin-eslint-comments": "^3.2.0",
92
92
  "eslint-plugin-eslint-plugin": "^5.0.0",
93
+ "eslint-plugin-eslint-rule-tester": "^0.5.1",
93
94
  "eslint-plugin-json-schema-validator": "^4.7.4",
94
95
  "eslint-plugin-jsonc": "^2.0.0",
95
96
  "eslint-plugin-markdown": "^3.0.0",
@@ -99,10 +100,10 @@
99
100
  "eslint-plugin-regexp": "^2.0.0",
100
101
  "eslint-plugin-vue": "^9.0.0",
101
102
  "eslint-plugin-yml": "^1.0.0",
102
- "espree": "^9.0.0",
103
+ "espree": "^10.0.0",
103
104
  "events": "^3.3.0",
104
105
  "mocha": "^10.0.0",
105
- "monaco-editor": "^0.45.0",
106
+ "monaco-editor": "^0.47.0",
106
107
  "nyc": "^15.1.0",
107
108
  "pako": "^2.1.0",
108
109
  "prettier": "^3.0.3",
@@ -112,7 +113,7 @@
112
113
  "stylelint-config-standard": "^36.0.0",
113
114
  "stylelint-config-standard-vue": "^1.0.0",
114
115
  "stylelint-stylus": "^1.0.0",
115
- "typescript": "~5.3.0",
116
+ "typescript": "~5.4.0",
116
117
  "vite-plugin-eslint4b": "^0.2.3",
117
118
  "vitepress": "^1.0.0-rc.17",
118
119
  "vue-eslint-parser": "^9.0.0",