eslint-plugin-yml 0.8.0 → 0.10.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
@@ -26,6 +26,19 @@ This ESLint plugin provides linting rules for [YAML].
26
26
 
27
27
  You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-yml/playground/).
28
28
 
29
+ ## :question: How is it different from other YAML plugins?
30
+
31
+ ### Plugins that do not use AST
32
+
33
+ e.g. [eslint-plugin-yaml](https://www.npmjs.com/package/eslint-plugin-yaml)
34
+
35
+ These plugins use the processor to parse and return the results independently, without providing the ESLint engine with AST and source code text.
36
+
37
+ Plugins don't provide AST, so you can't use directive comments (e.g. `# eslint-disable`).
38
+ Plugins don't provide source code text, so you can't use it with plugins and rules that use text (e.g. [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier), [eol-last](https://eslint.org/docs/rules/eol-last)).
39
+
40
+ **eslint-plugin-yml** works by providing AST and source code text to ESLint.
41
+
29
42
  <!--DOCS_IGNORE_START-->
30
43
 
31
44
  ## :book: Documentation
@@ -75,9 +88,33 @@ This plugin provides configs:
75
88
  - `plugin:yml/base` ... Configuration to enable correct YAML parsing.
76
89
  - `plugin:yml/recommended` ... Above, plus rules to prevent errors or unintended behavior.
77
90
  - `plugin:yml/standard` ... Above, plus rules to enforce the common stylistic conventions.
91
+ - `plugin:yml/prettier` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
78
92
 
79
93
  See [the rule list](https://ota-meshi.github.io/eslint-plugin-yml/rules/) to get the `rules` that this plugin provides.
80
94
 
95
+ #### Parser Configuration
96
+
97
+ If you have specified a parser, you need to configure a parser for `.yaml`.
98
+
99
+ For example, if you are using the `"@babel/eslint-parser"`, configure it as follows:
100
+
101
+ ```js
102
+ module.exports = {
103
+ // ...
104
+ extends: ["plugin:yml/standard"],
105
+ // ...
106
+ parser: "@babel/eslint-parser",
107
+ // Add an `overrides` section to add a parser configuration for YAML.
108
+ overrides: [
109
+ {
110
+ files: ["*.yaml", "*.yml"],
111
+ parser: "yaml-eslint-parser",
112
+ },
113
+ ],
114
+ // ...
115
+ };
116
+ ```
117
+
81
118
  ### Running ESLint from the command line
82
119
 
83
120
  If you want to run `eslint` from the command line, make sure you include the `.yaml` extension using [the `--ext` option](https://eslint.org/docs/user-guide/configuring#specifying-file-extensions-to-lint) or a glob pattern, because ESLint targets only `.js` files by default.
@@ -157,8 +194,22 @@ The rules with the following star :star: are included in the config.
157
194
  <!--RULES_TABLE_END-->
158
195
  <!--RULES_SECTION_END-->
159
196
 
197
+ ## :rocket: To Do More Verification
198
+
199
+ ### Verify using JSON Schema
200
+
201
+ You can verify using JSON Schema by checking and installing [eslint-plugin-json-schema-validator].
202
+
203
+ ### Verify the [Vue I18n] message resource files
204
+
205
+ You can verify the message files by checking and installing [@intlify/eslint-plugin-vue-i18n].
206
+
160
207
  <!--DOCS_IGNORE_START-->
161
208
 
209
+ <!-- ## :traffic_light: Semantic Versioning Policy
210
+
211
+ **eslint-plugin-jsonc** follows [Semantic Versioning](http://semver.org/) and [ESLint's Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy). -->
212
+
162
213
  ## :beers: Contributing
163
214
 
164
215
  Welcome contributing!
@@ -190,3 +241,6 @@ This plugin uses [yaml-eslint-parser](https://github.com/ota-meshi/yaml-eslint-p
190
241
  See the [LICENSE](LICENSE) file for license rights and limitations (MIT).
191
242
 
192
243
  [YAML]: https://yaml.org/
244
+ [eslint-plugin-json-schema-validator]: https://github.com/ota-meshi/eslint-plugin-json-schema-validator
245
+ [@intlify/eslint-plugin-vue-i18n]: https://github.com/intlify/eslint-plugin-vue-i18n
246
+ [Vue I18n]: https://github.com/intlify/vue-i18n-next
@@ -0,0 +1,15 @@
1
+ declare const _default: {
2
+ extends: string[];
3
+ rules: {
4
+ "yml/block-mapping-question-indicator-newline": string;
5
+ "yml/block-sequence-hyphen-indicator-newline": string;
6
+ "yml/flow-mapping-curly-newline": string;
7
+ "yml/flow-mapping-curly-spacing": string;
8
+ "yml/flow-sequence-bracket-newline": string;
9
+ "yml/flow-sequence-bracket-spacing": string;
10
+ "yml/indent": string;
11
+ "yml/key-spacing": string;
12
+ "yml/quotes": string;
13
+ };
14
+ };
15
+ export = _default;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const path_1 = __importDefault(require("path"));
6
+ const base = require.resolve("./base");
7
+ const baseExtend = path_1.default.extname(`${base}`) === ".ts" ? "plugin:yml/base" : base;
8
+ module.exports = {
9
+ extends: [baseExtend],
10
+ rules: {
11
+ "yml/block-mapping-question-indicator-newline": "off",
12
+ "yml/block-sequence-hyphen-indicator-newline": "off",
13
+ "yml/flow-mapping-curly-newline": "off",
14
+ "yml/flow-mapping-curly-spacing": "off",
15
+ "yml/flow-sequence-bracket-newline": "off",
16
+ "yml/flow-sequence-bracket-spacing": "off",
17
+ "yml/indent": "off",
18
+ "yml/key-spacing": "off",
19
+ "yml/quotes": "off",
20
+ },
21
+ };
package/lib/index.d.ts CHANGED
@@ -49,6 +49,20 @@ declare const _default: {
49
49
  "yml/vue-custom-block/no-parsing-error": string;
50
50
  };
51
51
  };
52
+ prettier: {
53
+ extends: string[];
54
+ rules: {
55
+ "yml/block-mapping-question-indicator-newline": string;
56
+ "yml/block-sequence-hyphen-indicator-newline": string;
57
+ "yml/flow-mapping-curly-newline": string;
58
+ "yml/flow-mapping-curly-spacing": string;
59
+ "yml/flow-sequence-bracket-newline": string;
60
+ "yml/flow-sequence-bracket-spacing": string;
61
+ "yml/indent": string;
62
+ "yml/key-spacing": string;
63
+ "yml/quotes": string;
64
+ };
65
+ };
52
66
  };
53
67
  rules: {
54
68
  [key: string]: RuleModule;
package/lib/index.js CHANGED
@@ -6,10 +6,12 @@ const rules_1 = require("./utils/rules");
6
6
  const base_1 = __importDefault(require("./configs/base"));
7
7
  const recommended_1 = __importDefault(require("./configs/recommended"));
8
8
  const standard_1 = __importDefault(require("./configs/standard"));
9
+ const prettier_1 = __importDefault(require("./configs/prettier"));
9
10
  const configs = {
10
11
  base: base_1.default,
11
12
  recommended: recommended_1.default,
12
13
  standard: standard_1.default,
14
+ prettier: prettier_1.default,
13
15
  };
14
16
  const rules = rules_1.rules.reduce((obj, r) => {
15
17
  obj[r.meta.docs.ruleName] = r;
@@ -2,12 +2,13 @@
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
- exports.default = utils_1.createRule("block-mapping-question-indicator-newline", {
5
+ exports.default = (0, utils_1.createRule)("block-mapping-question-indicator-newline", {
6
6
  meta: {
7
7
  docs: {
8
8
  description: "enforce consistent line breaks after `?` indicator",
9
9
  categories: ["standard"],
10
10
  extensionRule: false,
11
+ layout: true,
11
12
  },
12
13
  fixable: "whitespace",
13
14
  schema: [
@@ -38,7 +39,7 @@ exports.default = utils_1.createRule("block-mapping-question-indicator-newline",
38
39
  continue;
39
40
  }
40
41
  const question = sourceCode.getFirstToken(pair);
41
- if (!question || !ast_utils_1.isQuestion(question)) {
42
+ if (!question || !(0, ast_utils_1.isQuestion)(question)) {
42
43
  continue;
43
44
  }
44
45
  const hasNewline = question.loc.end.line < key.loc.start.line;
@@ -25,12 +25,13 @@ function parseOptions(option) {
25
25
  }
26
26
  return opt;
27
27
  }
28
- exports.default = utils_1.createRule("block-mapping", {
28
+ exports.default = (0, utils_1.createRule)("block-mapping", {
29
29
  meta: {
30
30
  docs: {
31
31
  description: "require or disallow block style mappings.",
32
32
  categories: ["standard"],
33
33
  extensionRule: false,
34
+ layout: false,
34
35
  },
35
36
  fixable: "code",
36
37
  schema: [
@@ -129,11 +130,11 @@ exports.default = utils_1.createRule("block-mapping", {
129
130
  if (optionType === "never") {
130
131
  return;
131
132
  }
132
- if (yaml_1.isKeyNode(node)) {
133
+ if ((0, yaml_1.isKeyNode)(node)) {
133
134
  return;
134
135
  }
135
136
  const canFix = canFixToBlock(mappingInfo, node) &&
136
- !yaml_1.hasTabIndent(context);
137
+ !(0, yaml_1.hasTabIndent)(context);
137
138
  context.report({
138
139
  loc: node.loc,
139
140
  messageId: "required",
@@ -146,7 +147,7 @@ exports.default = utils_1.createRule("block-mapping", {
146
147
  return;
147
148
  }
148
149
  const canFix = canFixToFlow(mappingInfo, node) &&
149
- !yaml_1.hasTabIndent(context);
150
+ !(0, yaml_1.hasTabIndent)(context);
150
151
  context.report({
151
152
  loc: node.loc,
152
153
  messageId: "disallow",
@@ -181,8 +182,8 @@ function canFixToFlow(mappingInfo, node) {
181
182
  return false;
182
183
  }
183
184
  for (const pair of node.pairs) {
184
- const value = yaml_1.unwrapMeta(pair.value);
185
- const key = yaml_1.unwrapMeta(pair.key);
185
+ const value = (0, yaml_1.unwrapMeta)(pair.value);
186
+ const key = (0, yaml_1.unwrapMeta)(pair.key);
186
187
  if (value && value.type === "YAMLScalar" && value.style === "plain") {
187
188
  if (value.loc.start.line < value.loc.end.line) {
188
189
  return false;
@@ -213,7 +214,7 @@ function buildFixFlowToBlock(node, context) {
213
214
  if ((open === null || open === void 0 ? void 0 : open.value) !== "{" || (close === null || close === void 0 ? void 0 : close.value) !== "}") {
214
215
  return;
215
216
  }
216
- const expectIndent = yaml_1.calcExpectIndentForPairs(node, context);
217
+ const expectIndent = (0, yaml_1.calcExpectIndentForPairs)(node, context);
217
218
  if (expectIndent == null) {
218
219
  return;
219
220
  }
@@ -233,7 +234,7 @@ function buildFixFlowToBlock(node, context) {
233
234
  for (const pair of node.pairs) {
234
235
  const prevToken = sourceCode.getTokenBefore(pair, {
235
236
  includeComments: true,
236
- filter: (token) => !ast_utils_1.isComma(token),
237
+ filter: (token) => !(0, ast_utils_1.isComma)(token),
237
238
  });
238
239
  yield* removeComma(prev, prevToken);
239
240
  yield fixer.replaceTextRange([prevToken.range[1], pair.range[0]], `\n${expectIndent}`);
@@ -244,7 +245,7 @@ function buildFixFlowToBlock(node, context) {
244
245
  }).range[0]) {
245
246
  yield fixer.insertTextAfter(colonToken, " ");
246
247
  }
247
- yield* yaml_1.processIndentFix(fixer, expectIndent, pair.value, context);
248
+ yield* (0, yaml_1.processIndentFix)(fixer, expectIndent, pair.value, context);
248
249
  prev = pair;
249
250
  }
250
251
  yield* removeComma(prev, close);
@@ -253,7 +254,7 @@ function buildFixFlowToBlock(node, context) {
253
254
  for (const token of sourceCode.getTokensBetween(a, b, {
254
255
  includeComments: true,
255
256
  })) {
256
- if (ast_utils_1.isComma(token)) {
257
+ if ((0, ast_utils_1.isComma)(token)) {
257
258
  yield fixer.remove(token);
258
259
  }
259
260
  }
@@ -2,12 +2,13 @@
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
- exports.default = utils_1.createRule("block-sequence-hyphen-indicator-newline", {
5
+ exports.default = (0, utils_1.createRule)("block-sequence-hyphen-indicator-newline", {
6
6
  meta: {
7
7
  docs: {
8
8
  description: "enforce consistent line breaks after `-` indicator",
9
9
  categories: ["standard"],
10
10
  extensionRule: false,
11
+ layout: true,
11
12
  },
12
13
  fixable: "whitespace",
13
14
  schema: [
@@ -36,7 +37,7 @@ exports.default = utils_1.createRule("block-sequence-hyphen-indicator-newline",
36
37
  const nestedHyphenStyle = ((_a = context.options[1]) === null || _a === void 0 ? void 0 : _a.nestedHyphen) || "always";
37
38
  function getStyleOption(hyphen) {
38
39
  const next = sourceCode.getTokenAfter(hyphen);
39
- if (next && ast_utils_1.isHyphen(next)) {
40
+ if (next && (0, ast_utils_1.isHyphen)(next)) {
40
41
  return nestedHyphenStyle;
41
42
  }
42
43
  return style;
@@ -25,12 +25,13 @@ function parseOptions(option) {
25
25
  }
26
26
  return opt;
27
27
  }
28
- exports.default = utils_1.createRule("block-sequence", {
28
+ exports.default = (0, utils_1.createRule)("block-sequence", {
29
29
  meta: {
30
30
  docs: {
31
31
  description: "require or disallow block style sequences.",
32
32
  categories: ["standard"],
33
33
  extensionRule: false,
34
+ layout: false,
34
35
  },
35
36
  fixable: "code",
36
37
  schema: [
@@ -129,10 +130,10 @@ exports.default = utils_1.createRule("block-sequence", {
129
130
  if (optionType === "never") {
130
131
  return;
131
132
  }
132
- if (yaml_1.isKeyNode(node)) {
133
+ if ((0, yaml_1.isKeyNode)(node)) {
133
134
  return;
134
135
  }
135
- const canFix = canFixToBlock(sequenceInfo, node, context.getSourceCode()) && !yaml_1.hasTabIndent(context);
136
+ const canFix = canFixToBlock(sequenceInfo, node, context.getSourceCode()) && !(0, yaml_1.hasTabIndent)(context);
136
137
  context.report({
137
138
  loc: node.loc,
138
139
  messageId: "required",
@@ -145,7 +146,7 @@ exports.default = utils_1.createRule("block-sequence", {
145
146
  return;
146
147
  }
147
148
  const canFix = canFixToFlow(sequenceInfo, node, context) &&
148
- !yaml_1.hasTabIndent(context);
149
+ !(0, yaml_1.hasTabIndent)(context);
149
150
  context.report({
150
151
  loc: node.loc,
151
152
  messageId: "disallow",
@@ -196,17 +197,17 @@ function canFixToFlow(sequenceInfo, node, context) {
196
197
  return false;
197
198
  }
198
199
  if (node.parent.type === "YAMLWithMeta") {
199
- const metaIndent = yaml_1.getActualIndent(node.parent, context);
200
+ const metaIndent = (0, yaml_1.getActualIndent)(node.parent, context);
200
201
  if (metaIndent != null) {
201
202
  for (let line = node.loc.start.line; line <= node.loc.end.line; line++) {
202
- if (yaml_1.compareIndent(metaIndent, yaml_1.getActualIndentFromLine(line, context)) > 0) {
203
+ if ((0, yaml_1.compareIndent)(metaIndent, (0, yaml_1.getActualIndentFromLine)(line, context)) > 0) {
203
204
  return false;
204
205
  }
205
206
  }
206
207
  }
207
208
  }
208
209
  for (const entry of node.entries) {
209
- const value = yaml_1.unwrapMeta(entry);
210
+ const value = (0, yaml_1.unwrapMeta)(entry);
210
211
  if (value && value.type === "YAMLScalar" && value.style === "plain") {
211
212
  if (value.strValue.includes(",")) {
212
213
  return false;
@@ -223,7 +224,7 @@ function buildFixFlowToBlock(node, context) {
223
224
  if ((open === null || open === void 0 ? void 0 : open.value) !== "[" || (close === null || close === void 0 ? void 0 : close.value) !== "]") {
224
225
  return;
225
226
  }
226
- const expectIndent = yaml_1.calcExpectIndentForEntries(node, context);
227
+ const expectIndent = (0, yaml_1.calcExpectIndentForEntries)(node, context);
227
228
  if (expectIndent == null) {
228
229
  return;
229
230
  }
@@ -243,7 +244,7 @@ function buildFixFlowToBlock(node, context) {
243
244
  for (const entry of node.entries) {
244
245
  const prevToken = sourceCode.getTokenBefore(entry, {
245
246
  includeComments: true,
246
- filter: (token) => !ast_utils_1.isComma(token),
247
+ filter: (token) => !(0, ast_utils_1.isComma)(token),
247
248
  });
248
249
  yield* removeComma(prev, prevToken);
249
250
  yield fixer.replaceTextRange([prevToken.range[1], entry.range[0]], `\n${expectIndent}- `);
@@ -256,33 +257,33 @@ function buildFixFlowToBlock(node, context) {
256
257
  for (const token of sourceCode.getTokensBetween(a, b, {
257
258
  includeComments: true,
258
259
  })) {
259
- if (ast_utils_1.isComma(token)) {
260
+ if ((0, ast_utils_1.isComma)(token)) {
260
261
  yield fixer.remove(token);
261
262
  }
262
263
  }
263
264
  }
264
265
  function* processEntryIndent(baseIndent, entry) {
265
266
  if (entry.type === "YAMLWithMeta" && entry.value) {
266
- yield* yaml_1.processIndentFix(fixer, baseIndent, entry.value, context);
267
+ yield* (0, yaml_1.processIndentFix)(fixer, baseIndent, entry.value, context);
267
268
  }
268
269
  else if (entry.type === "YAMLMapping") {
269
270
  for (const p of entry.pairs) {
270
271
  if (p.range[0] === entry.range[0]) {
271
272
  if (p.value) {
272
- yield* yaml_1.processIndentFix(fixer, baseIndent, p.value, context);
273
+ yield* (0, yaml_1.processIndentFix)(fixer, baseIndent, p.value, context);
273
274
  }
274
275
  }
275
276
  else {
276
- yield* yaml_1.processIndentFix(fixer, baseIndent, p, context);
277
+ yield* (0, yaml_1.processIndentFix)(fixer, baseIndent, p, context);
277
278
  }
278
279
  }
279
280
  if (entry.style === "flow") {
280
281
  const close = sourceCode.getLastToken(entry);
281
282
  if (close.value === "}") {
282
- const actualIndent = yaml_1.getActualIndent(close, context);
283
+ const actualIndent = (0, yaml_1.getActualIndent)(close, context);
283
284
  if (actualIndent != null &&
284
- yaml_1.compareIndent(actualIndent, baseIndent) < 0) {
285
- yield yaml_1.fixIndent(fixer, sourceCode, baseIndent, close);
285
+ (0, yaml_1.compareIndent)(actualIndent, baseIndent) < 0) {
286
+ yield (0, yaml_1.fixIndent)(fixer, sourceCode, baseIndent, close);
286
287
  }
287
288
  }
288
289
  }
@@ -292,7 +293,7 @@ function buildFixFlowToBlock(node, context) {
292
293
  if (!e) {
293
294
  continue;
294
295
  }
295
- yield* yaml_1.processIndentFix(fixer, baseIndent, e, context);
296
+ yield* (0, yaml_1.processIndentFix)(fixer, baseIndent, e, context);
296
297
  }
297
298
  }
298
299
  }
@@ -56,12 +56,13 @@ function areLineBreaksRequired(node, options, first, last) {
56
56
  objectProperties.length > 0 &&
57
57
  first.loc.start.line !== last.loc.end.line));
58
58
  }
59
- exports.default = utils_1.createRule("flow-mapping-curly-newline", {
59
+ exports.default = (0, utils_1.createRule)("flow-mapping-curly-newline", {
60
60
  meta: {
61
61
  docs: {
62
62
  description: "enforce consistent line breaks inside braces",
63
63
  categories: ["standard"],
64
64
  extensionRule: "object-curly-newline",
65
+ layout: true,
65
66
  },
66
67
  fixable: "whitespace",
67
68
  schema: [OPTION_VALUE],
@@ -80,7 +81,7 @@ exports.default = utils_1.createRule("flow-mapping-curly-newline", {
80
81
  const sourceCode = context.getSourceCode();
81
82
  const options = normalizeOptionValue(context.options[0]);
82
83
  function check(node) {
83
- if (yaml_1.isKeyNode(node)) {
84
+ if ((0, yaml_1.isKeyNode)(node)) {
84
85
  return;
85
86
  }
86
87
  const openBrace = sourceCode.getFirstToken(node, (token) => token.value === "{");
@@ -92,37 +93,37 @@ exports.default = utils_1.createRule("flow-mapping-curly-newline", {
92
93
  includeComments: true,
93
94
  });
94
95
  const needsLineBreaks = areLineBreaksRequired(node, options, first, last);
95
- const hasCommentsFirstToken = ast_utils_1.isCommentToken(first);
96
- const hasCommentsLastToken = ast_utils_1.isCommentToken(last);
97
- const hasQuestionsLastToken = ast_utils_1.isQuestion(last);
96
+ const hasCommentsFirstToken = (0, ast_utils_1.isCommentToken)(first);
97
+ const hasCommentsLastToken = (0, ast_utils_1.isCommentToken)(last);
98
+ const hasQuestionsLastToken = (0, ast_utils_1.isQuestion)(last);
98
99
  first = sourceCode.getTokenAfter(openBrace);
99
100
  last = sourceCode.getTokenBefore(closeBrace);
100
101
  if (needsLineBreaks) {
101
- if (ast_utils_1.isTokenOnSameLine(openBrace, first)) {
102
+ if ((0, ast_utils_1.isTokenOnSameLine)(openBrace, first)) {
102
103
  context.report({
103
104
  messageId: "expectedLinebreakAfterOpeningBrace",
104
105
  node,
105
106
  loc: openBrace.loc,
106
107
  fix(fixer) {
107
108
  if (hasCommentsFirstToken ||
108
- yaml_1.hasTabIndent(context)) {
109
+ (0, yaml_1.hasTabIndent)(context)) {
109
110
  return null;
110
111
  }
111
- const indent = yaml_1.incIndent(yaml_1.getActualIndentFromLine(openBrace.loc.start.line, context), context);
112
+ const indent = (0, yaml_1.incIndent)((0, yaml_1.getActualIndentFromLine)(openBrace.loc.start.line, context), context);
112
113
  return fixer.insertTextAfter(openBrace, `\n${indent}`);
113
114
  },
114
115
  });
115
116
  }
116
- if (ast_utils_1.isTokenOnSameLine(last, closeBrace)) {
117
+ if ((0, ast_utils_1.isTokenOnSameLine)(last, closeBrace)) {
117
118
  context.report({
118
119
  messageId: "expectedLinebreakBeforeClosingBrace",
119
120
  node,
120
121
  loc: closeBrace.loc,
121
122
  fix(fixer) {
122
- if (hasCommentsLastToken || yaml_1.hasTabIndent(context)) {
123
+ if (hasCommentsLastToken || (0, yaml_1.hasTabIndent)(context)) {
123
124
  return null;
124
125
  }
125
- const indent = yaml_1.getActualIndentFromLine(closeBrace.loc.start.line, context);
126
+ const indent = (0, yaml_1.getActualIndentFromLine)(closeBrace.loc.start.line, context);
126
127
  return fixer.insertTextBefore(closeBrace, `\n${indent}`);
127
128
  },
128
129
  });
@@ -130,8 +131,8 @@ exports.default = utils_1.createRule("flow-mapping-curly-newline", {
130
131
  }
131
132
  else {
132
133
  const consistent = options.consistent;
133
- const hasLineBreakBetweenOpenBraceAndFirst = !ast_utils_1.isTokenOnSameLine(openBrace, first);
134
- const hasLineBreakBetweenCloseBraceAndLast = !ast_utils_1.isTokenOnSameLine(last, closeBrace);
134
+ const hasLineBreakBetweenOpenBraceAndFirst = !(0, ast_utils_1.isTokenOnSameLine)(openBrace, first);
135
+ const hasLineBreakBetweenCloseBraceAndLast = !(0, ast_utils_1.isTokenOnSameLine)(last, closeBrace);
135
136
  if ((!consistent && hasLineBreakBetweenOpenBraceAndFirst) ||
136
137
  (consistent &&
137
138
  hasLineBreakBetweenOpenBraceAndFirst &&
@@ -142,7 +143,7 @@ exports.default = utils_1.createRule("flow-mapping-curly-newline", {
142
143
  loc: openBrace.loc,
143
144
  fix(fixer) {
144
145
  if (hasCommentsFirstToken ||
145
- yaml_1.hasTabIndent(context)) {
146
+ (0, yaml_1.hasTabIndent)(context)) {
146
147
  return null;
147
148
  }
148
149
  return fixer.removeRange([
@@ -164,7 +165,7 @@ exports.default = utils_1.createRule("flow-mapping-curly-newline", {
164
165
  node,
165
166
  loc: closeBrace.loc,
166
167
  fix(fixer) {
167
- if (hasCommentsLastToken || yaml_1.hasTabIndent(context)) {
168
+ if (hasCommentsLastToken || (0, yaml_1.hasTabIndent)(context)) {
168
169
  return null;
169
170
  }
170
171
  return fixer.removeRange([
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../utils");
4
- const coreRule = utils_1.getCoreRule("object-curly-spacing");
5
- exports.default = utils_1.createRule("flow-mapping-curly-spacing", {
4
+ const coreRule = (0, utils_1.getCoreRule)("object-curly-spacing");
5
+ exports.default = (0, utils_1.createRule)("flow-mapping-curly-spacing", {
6
6
  meta: {
7
7
  docs: {
8
8
  description: "enforce consistent spacing inside braces",
9
9
  categories: ["standard"],
10
10
  extensionRule: "object-curly-spacing",
11
+ layout: true,
11
12
  },
12
13
  fixable: coreRule.meta.fixable,
14
+ hasSuggestions: coreRule.meta.hasSuggestions,
13
15
  schema: coreRule.meta.schema,
14
16
  messages: coreRule.meta.messages,
15
17
  type: coreRule.meta.type,
@@ -18,13 +20,13 @@ exports.default = utils_1.createRule("flow-mapping-curly-spacing", {
18
20
  if (!context.parserServices.isYAML) {
19
21
  return {};
20
22
  }
21
- return utils_1.defineWrapperListener(coreRule, context, {
23
+ return (0, utils_1.defineWrapperListener)(coreRule, context, {
22
24
  options: context.options,
23
25
  createListenerProxy(listener) {
24
26
  return {
25
27
  YAMLMapping(node) {
26
28
  if (node.style === "flow") {
27
- listener.ObjectExpression(utils_1.getProxyNode(node, {
29
+ listener.ObjectExpression((0, utils_1.getProxyNode)(node, {
28
30
  type: "ObjectExpression",
29
31
  get properties() {
30
32
  return node.pairs;
@@ -3,12 +3,13 @@ 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
- exports.default = utils_1.createRule("flow-sequence-bracket-newline", {
6
+ exports.default = (0, utils_1.createRule)("flow-sequence-bracket-newline", {
7
7
  meta: {
8
8
  docs: {
9
9
  description: "enforce linebreaks after opening and before closing flow sequence brackets",
10
10
  categories: ["standard"],
11
11
  extensionRule: "array-bracket-newline",
12
+ layout: true,
12
13
  },
13
14
  fixable: "whitespace",
14
15
  schema: [
@@ -80,13 +81,13 @@ exports.default = utils_1.createRule("flow-sequence-bracket-newline", {
80
81
  loc: token.loc,
81
82
  messageId: "unexpectedOpeningLinebreak",
82
83
  fix(fixer) {
83
- if (yaml_1.hasTabIndent(context)) {
84
+ if ((0, yaml_1.hasTabIndent)(context)) {
84
85
  return null;
85
86
  }
86
87
  const nextToken = sourceCode.getTokenAfter(token, {
87
88
  includeComments: true,
88
89
  });
89
- if (ast_utils_1.isCommentToken(nextToken)) {
90
+ if ((0, ast_utils_1.isCommentToken)(nextToken)) {
90
91
  return null;
91
92
  }
92
93
  return fixer.removeRange([
@@ -102,13 +103,13 @@ exports.default = utils_1.createRule("flow-sequence-bracket-newline", {
102
103
  loc: token.loc,
103
104
  messageId: "unexpectedClosingLinebreak",
104
105
  fix(fixer) {
105
- if (yaml_1.hasTabIndent(context)) {
106
+ if ((0, yaml_1.hasTabIndent)(context)) {
106
107
  return null;
107
108
  }
108
109
  const previousToken = sourceCode.getTokenBefore(token, {
109
110
  includeComments: true,
110
111
  });
111
- if (ast_utils_1.isCommentToken(previousToken)) {
112
+ if ((0, ast_utils_1.isCommentToken)(previousToken)) {
112
113
  return null;
113
114
  }
114
115
  return fixer.removeRange([
@@ -124,10 +125,10 @@ exports.default = utils_1.createRule("flow-sequence-bracket-newline", {
124
125
  loc: token.loc,
125
126
  messageId: "missingOpeningLinebreak",
126
127
  fix(fixer) {
127
- if (yaml_1.hasTabIndent(context)) {
128
+ if ((0, yaml_1.hasTabIndent)(context)) {
128
129
  return null;
129
130
  }
130
- const indent = yaml_1.incIndent(yaml_1.getActualIndentFromLine(token.loc.start.line, context), context);
131
+ const indent = (0, yaml_1.incIndent)((0, yaml_1.getActualIndentFromLine)(token.loc.start.line, context), context);
131
132
  return fixer.insertTextAfter(token, `\n${indent}`);
132
133
  },
133
134
  });
@@ -138,16 +139,16 @@ exports.default = utils_1.createRule("flow-sequence-bracket-newline", {
138
139
  loc: token.loc,
139
140
  messageId: "missingClosingLinebreak",
140
141
  fix(fixer) {
141
- if (yaml_1.hasTabIndent(context)) {
142
+ if ((0, yaml_1.hasTabIndent)(context)) {
142
143
  return null;
143
144
  }
144
- const indent = yaml_1.getActualIndentFromLine(token.loc.start.line, context);
145
+ const indent = (0, yaml_1.getActualIndentFromLine)(token.loc.start.line, context);
145
146
  return fixer.insertTextBefore(token, `\n${indent}`);
146
147
  },
147
148
  });
148
149
  }
149
150
  function check(node) {
150
- if (yaml_1.isKeyNode(node)) {
151
+ if ((0, yaml_1.isKeyNode)(node)) {
151
152
  return;
152
153
  }
153
154
  const elements = node.entries;
@@ -175,18 +176,18 @@ exports.default = utils_1.createRule("flow-sequence-bracket-newline", {
175
176
  (options.consistent &&
176
177
  openBracket.loc.end.line !== first.loc.start.line);
177
178
  if (needsLinebreaks) {
178
- if (ast_utils_1.isTokenOnSameLine(openBracket, first)) {
179
+ if ((0, ast_utils_1.isTokenOnSameLine)(openBracket, first)) {
179
180
  reportRequiredBeginningLinebreak(node, openBracket);
180
181
  }
181
- if (ast_utils_1.isTokenOnSameLine(last, closeBracket)) {
182
+ if ((0, ast_utils_1.isTokenOnSameLine)(last, closeBracket)) {
182
183
  reportRequiredEndingLinebreak(node, closeBracket);
183
184
  }
184
185
  }
185
186
  else {
186
- if (!ast_utils_1.isTokenOnSameLine(openBracket, first)) {
187
+ if (!(0, ast_utils_1.isTokenOnSameLine)(openBracket, first)) {
187
188
  reportNoBeginningLinebreak(node, openBracket);
188
189
  }
189
- if (!ast_utils_1.isTokenOnSameLine(last, closeBracket)) {
190
+ if (!(0, ast_utils_1.isTokenOnSameLine)(last, closeBracket)) {
190
191
  reportNoEndingLinebreak(node, closeBracket);
191
192
  }
192
193
  }