eslint-plugin-yml 3.3.1 → 3.3.2
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/lib/chunk-CfYAbeIz.mjs +13 -0
- package/lib/index.d.mts +2 -2
- package/lib/index.mjs +129 -176
- package/package.json +7 -9
- package/lib/chunk-DQk6qfdC.mjs +0 -18
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|
package/lib/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AST } from "yaml-eslint-parser";
|
|
2
2
|
import { IDirective, TextSourceCodeBase, TraversalStep } from "@eslint/plugin-kit";
|
|
3
3
|
import { CursorWithCountOptionsWithComment, CursorWithCountOptionsWithFilter, CursorWithCountOptionsWithoutFilter, CursorWithSkipOptionsWithComment, CursorWithSkipOptionsWithFilter, CursorWithSkipOptionsWithoutFilter } from "@ota-meshi/ast-token-store";
|
|
4
|
-
import * as _eslint_core0 from "@eslint/core";
|
|
4
|
+
import * as _$_eslint_core0 from "@eslint/core";
|
|
5
5
|
import { File, FileProblem, Language, OkParseResult, ParseResult, RuleDefinition, RulesConfig } from "@eslint/core";
|
|
6
6
|
import { Linter, Scope } from "eslint";
|
|
7
7
|
|
|
@@ -360,7 +360,7 @@ declare const _default: {
|
|
|
360
360
|
"flat/standard": Linter.Config[];
|
|
361
361
|
"flat/prettier": Linter.Config[];
|
|
362
362
|
};
|
|
363
|
-
rules: Record<string, RuleDefinition<_eslint_core0.RuleDefinitionTypeOptions>>;
|
|
363
|
+
rules: Record<string, RuleDefinition<_$_eslint_core0.RuleDefinitionTypeOptions>>;
|
|
364
364
|
languages: {
|
|
365
365
|
yaml: YAMLLanguage;
|
|
366
366
|
};
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __exportAll } from "./chunk-
|
|
1
|
+
import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
|
|
2
2
|
import * as yamlESLintParser from "yaml-eslint-parser";
|
|
3
3
|
import { VisitorKeys, getStaticYAMLValue, parseForESLint, parseYAML, traverseNodes } from "yaml-eslint-parser";
|
|
4
4
|
import path from "node:path";
|
|
@@ -7,7 +7,6 @@ import diffModule from "diff-sequences";
|
|
|
7
7
|
import escapeStringRegexp from "escape-string-regexp";
|
|
8
8
|
import { CallMethodStep, ConfigCommentParser, Directive, TextSourceCodeBase, VisitNodeStep } from "@eslint/plugin-kit";
|
|
9
9
|
import { TokenStore } from "@ota-meshi/ast-token-store";
|
|
10
|
-
|
|
11
10
|
//#region src/utils/index.ts
|
|
12
11
|
/**
|
|
13
12
|
* Define the rule.
|
|
@@ -37,7 +36,6 @@ function createRule(ruleName, rule) {
|
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
|
-
|
|
41
39
|
//#endregion
|
|
42
40
|
//#region src/utils/ast-utils.ts
|
|
43
41
|
/**
|
|
@@ -122,7 +120,6 @@ function isOpeningBraceToken(token) {
|
|
|
122
120
|
function isClosingBraceToken(token) {
|
|
123
121
|
return token != null && token.value === "}" && token.type === "Punctuator";
|
|
124
122
|
}
|
|
125
|
-
|
|
126
123
|
//#endregion
|
|
127
124
|
//#region src/rules/block-mapping-colon-indicator-newline.ts
|
|
128
125
|
var block_mapping_colon_indicator_newline_default = createRule("block-mapping-colon-indicator-newline", {
|
|
@@ -199,7 +196,6 @@ var block_mapping_colon_indicator_newline_default = createRule("block-mapping-co
|
|
|
199
196
|
} };
|
|
200
197
|
}
|
|
201
198
|
});
|
|
202
|
-
|
|
203
199
|
//#endregion
|
|
204
200
|
//#region src/rules/block-mapping-question-indicator-newline.ts
|
|
205
201
|
var block_mapping_question_indicator_newline_default = createRule("block-mapping-question-indicator-newline", {
|
|
@@ -252,7 +248,6 @@ var block_mapping_question_indicator_newline_default = createRule("block-mapping
|
|
|
252
248
|
} };
|
|
253
249
|
}
|
|
254
250
|
});
|
|
255
|
-
|
|
256
251
|
//#endregion
|
|
257
252
|
//#region src/utils/yaml.ts
|
|
258
253
|
/**
|
|
@@ -467,7 +462,6 @@ function fixIndent(fixer, sourceCode, indent, node) {
|
|
|
467
462
|
const prevToken = sourceCode.getTokenBefore(node, { includeComments: true });
|
|
468
463
|
return fixer.replaceTextRange([prevToken.range[1], node.range[0]], `\n${indent}`);
|
|
469
464
|
}
|
|
470
|
-
|
|
471
465
|
//#endregion
|
|
472
466
|
//#region src/rules/block-mapping.ts
|
|
473
467
|
const OPTIONS_ENUM$1 = [
|
|
@@ -669,7 +663,6 @@ function buildFixBlockToFlow$1(node, _context) {
|
|
|
669
663
|
yield fixer.insertTextAfter(lastPair || node, "}");
|
|
670
664
|
};
|
|
671
665
|
}
|
|
672
|
-
|
|
673
666
|
//#endregion
|
|
674
667
|
//#region src/rules/block-sequence-hyphen-indicator-newline.ts
|
|
675
668
|
var block_sequence_hyphen_indicator_newline_default = createRule("block-sequence-hyphen-indicator-newline", {
|
|
@@ -739,7 +732,6 @@ var block_sequence_hyphen_indicator_newline_default = createRule("block-sequence
|
|
|
739
732
|
} };
|
|
740
733
|
}
|
|
741
734
|
});
|
|
742
|
-
|
|
743
735
|
//#endregion
|
|
744
736
|
//#region src/rules/block-sequence.ts
|
|
745
737
|
const OPTIONS_ENUM = [
|
|
@@ -982,7 +974,6 @@ function buildFixBlockToFlow(node, context) {
|
|
|
982
974
|
yield fixer.insertTextAfter(lastEntry || firstEntry || node, "]");
|
|
983
975
|
};
|
|
984
976
|
}
|
|
985
|
-
|
|
986
977
|
//#endregion
|
|
987
978
|
//#region src/rules/file-extension.ts
|
|
988
979
|
var file_extension_default = createRule("file-extension", {
|
|
@@ -1024,7 +1015,6 @@ var file_extension_default = createRule("file-extension", {
|
|
|
1024
1015
|
} };
|
|
1025
1016
|
}
|
|
1026
1017
|
});
|
|
1027
|
-
|
|
1028
1018
|
//#endregion
|
|
1029
1019
|
//#region src/rules/flow-mapping-curly-newline.ts
|
|
1030
1020
|
const OPTION_VALUE = { oneOf: [{ enum: ["always", "never"] }, {
|
|
@@ -1166,7 +1156,6 @@ var flow_mapping_curly_newline_default = createRule("flow-mapping-curly-newline"
|
|
|
1166
1156
|
} };
|
|
1167
1157
|
}
|
|
1168
1158
|
});
|
|
1169
|
-
|
|
1170
1159
|
//#endregion
|
|
1171
1160
|
//#region src/rules/flow-mapping-curly-spacing.ts
|
|
1172
1161
|
/**
|
|
@@ -1429,7 +1418,6 @@ var flow_mapping_curly_spacing_default = createRule("flow-mapping-curly-spacing"
|
|
|
1429
1418
|
} };
|
|
1430
1419
|
}
|
|
1431
1420
|
});
|
|
1432
|
-
|
|
1433
1421
|
//#endregion
|
|
1434
1422
|
//#region src/rules/flow-sequence-bracket-newline.ts
|
|
1435
1423
|
var flow_sequence_bracket_newline_default = createRule("flow-sequence-bracket-newline", {
|
|
@@ -1598,7 +1586,6 @@ var flow_sequence_bracket_newline_default = createRule("flow-sequence-bracket-ne
|
|
|
1598
1586
|
} };
|
|
1599
1587
|
}
|
|
1600
1588
|
});
|
|
1601
|
-
|
|
1602
1589
|
//#endregion
|
|
1603
1590
|
//#region src/rules/flow-sequence-bracket-spacing.ts
|
|
1604
1591
|
var flow_sequence_bracket_spacing_default = createRule("flow-sequence-bracket-spacing", {
|
|
@@ -1774,7 +1761,6 @@ var flow_sequence_bracket_spacing_default = createRule("flow-sequence-bracket-sp
|
|
|
1774
1761
|
} };
|
|
1775
1762
|
}
|
|
1776
1763
|
});
|
|
1777
|
-
|
|
1778
1764
|
//#endregion
|
|
1779
1765
|
//#region src/rules/indent.ts
|
|
1780
1766
|
const ITERATION_OPTS = Object.freeze({ includeComments: true });
|
|
@@ -2382,7 +2368,6 @@ var indent_default = createRule("indent", {
|
|
|
2382
2368
|
}
|
|
2383
2369
|
}
|
|
2384
2370
|
});
|
|
2385
|
-
|
|
2386
2371
|
//#endregion
|
|
2387
2372
|
//#region src/utils/casing.ts
|
|
2388
2373
|
const allowedCaseOptions = [
|
|
@@ -2467,7 +2452,6 @@ const checkersMap = {
|
|
|
2467
2452
|
function getChecker(name) {
|
|
2468
2453
|
return checkersMap[name] || isPascalCase;
|
|
2469
2454
|
}
|
|
2470
|
-
|
|
2471
2455
|
//#endregion
|
|
2472
2456
|
//#region src/rules/key-name-casing.ts
|
|
2473
2457
|
var key_name_casing_default = createRule("key-name-casing", {
|
|
@@ -2541,7 +2525,6 @@ var key_name_casing_default = createRule("key-name-casing", {
|
|
|
2541
2525
|
} };
|
|
2542
2526
|
}
|
|
2543
2527
|
});
|
|
2544
|
-
|
|
2545
2528
|
//#endregion
|
|
2546
2529
|
//#region src/rules/key-spacing.ts
|
|
2547
2530
|
/**
|
|
@@ -3001,7 +2984,6 @@ function create(context) {
|
|
|
3001
2984
|
} };
|
|
3002
2985
|
}
|
|
3003
2986
|
}
|
|
3004
|
-
|
|
3005
2987
|
//#endregion
|
|
3006
2988
|
//#region src/rules/no-empty-document.ts
|
|
3007
2989
|
var no_empty_document_default = createRule("no-empty-document", {
|
|
@@ -3034,7 +3016,6 @@ var no_empty_document_default = createRule("no-empty-document", {
|
|
|
3034
3016
|
} };
|
|
3035
3017
|
}
|
|
3036
3018
|
});
|
|
3037
|
-
|
|
3038
3019
|
//#endregion
|
|
3039
3020
|
//#region src/rules/no-empty-key.ts
|
|
3040
3021
|
var no_empty_key_default = createRule("no-empty-key", {
|
|
@@ -3067,7 +3048,6 @@ var no_empty_key_default = createRule("no-empty-key", {
|
|
|
3067
3048
|
} };
|
|
3068
3049
|
}
|
|
3069
3050
|
});
|
|
3070
|
-
|
|
3071
3051
|
//#endregion
|
|
3072
3052
|
//#region src/rules/no-empty-mapping-value.ts
|
|
3073
3053
|
var no_empty_mapping_value_default = createRule("no-empty-mapping-value", {
|
|
@@ -3100,7 +3080,6 @@ var no_empty_mapping_value_default = createRule("no-empty-mapping-value", {
|
|
|
3100
3080
|
} };
|
|
3101
3081
|
}
|
|
3102
3082
|
});
|
|
3103
|
-
|
|
3104
3083
|
//#endregion
|
|
3105
3084
|
//#region src/rules/no-empty-sequence-entry.ts
|
|
3106
3085
|
var no_empty_sequence_entry_default = createRule("no-empty-sequence-entry", {
|
|
@@ -3157,7 +3136,6 @@ var no_empty_sequence_entry_default = createRule("no-empty-sequence-entry", {
|
|
|
3157
3136
|
}
|
|
3158
3137
|
}
|
|
3159
3138
|
});
|
|
3160
|
-
|
|
3161
3139
|
//#endregion
|
|
3162
3140
|
//#region src/rules/no-irregular-whitespace.ts
|
|
3163
3141
|
const ALL_IRREGULARS = /[\v\f\u0085\u00a0\u1680\u180e\u2000-\u200b\u2028\u2029\u202f\u205f\u3000\ufeff]/u;
|
|
@@ -3248,7 +3226,6 @@ var no_irregular_whitespace_default = createRule("no-irregular-whitespace", {
|
|
|
3248
3226
|
};
|
|
3249
3227
|
}
|
|
3250
3228
|
});
|
|
3251
|
-
|
|
3252
3229
|
//#endregion
|
|
3253
3230
|
//#region src/rules/no-multiple-empty-lines.ts
|
|
3254
3231
|
var no_multiple_empty_lines_default = createRule("no-multiple-empty-lines", {
|
|
@@ -3359,7 +3336,6 @@ var no_multiple_empty_lines_default = createRule("no-multiple-empty-lines", {
|
|
|
3359
3336
|
};
|
|
3360
3337
|
}
|
|
3361
3338
|
});
|
|
3362
|
-
|
|
3363
3339
|
//#endregion
|
|
3364
3340
|
//#region src/rules/no-tab-indent.ts
|
|
3365
3341
|
var no_tab_indent_default = createRule("no-tab-indent", {
|
|
@@ -3399,7 +3375,6 @@ var no_tab_indent_default = createRule("no-tab-indent", {
|
|
|
3399
3375
|
} };
|
|
3400
3376
|
}
|
|
3401
3377
|
});
|
|
3402
|
-
|
|
3403
3378
|
//#endregion
|
|
3404
3379
|
//#region src/rules/no-trailing-zeros.ts
|
|
3405
3380
|
var no_trailing_zeros_default = createRule("no-trailing-zeros", {
|
|
@@ -3468,7 +3443,6 @@ function parseFloatingPoint(str) {
|
|
|
3468
3443
|
expPart
|
|
3469
3444
|
};
|
|
3470
3445
|
}
|
|
3471
|
-
|
|
3472
3446
|
//#endregion
|
|
3473
3447
|
//#region src/rules/plain-scalar.ts
|
|
3474
3448
|
const SYMBOLS = new Set([
|
|
@@ -3639,7 +3613,6 @@ var plain_scalar_default = createRule("plain-scalar", {
|
|
|
3639
3613
|
};
|
|
3640
3614
|
}
|
|
3641
3615
|
});
|
|
3642
|
-
|
|
3643
3616
|
//#endregion
|
|
3644
3617
|
//#region src/rules/quotes.ts
|
|
3645
3618
|
var quotes_default = createRule("quotes", {
|
|
@@ -3700,7 +3673,6 @@ var quotes_default = createRule("quotes", {
|
|
|
3700
3673
|
} };
|
|
3701
3674
|
}
|
|
3702
3675
|
});
|
|
3703
|
-
|
|
3704
3676
|
//#endregion
|
|
3705
3677
|
//#region src/rules/require-string-key.ts
|
|
3706
3678
|
var require_string_key_default = createRule("require-string-key", {
|
|
@@ -3768,7 +3740,6 @@ var require_string_key_default = createRule("require-string-key", {
|
|
|
3768
3740
|
};
|
|
3769
3741
|
}
|
|
3770
3742
|
});
|
|
3771
|
-
|
|
3772
3743
|
//#endregion
|
|
3773
3744
|
//#region src/utils/calc-shortest-edit-script.ts
|
|
3774
3745
|
const diff = typeof diffModule === "function" ? diffModule : diffModule.default;
|
|
@@ -3818,7 +3789,6 @@ function calcShortestEditScript(a, b) {
|
|
|
3818
3789
|
});
|
|
3819
3790
|
}
|
|
3820
3791
|
}
|
|
3821
|
-
|
|
3822
3792
|
//#endregion
|
|
3823
3793
|
//#region src/rules/sort-keys.ts
|
|
3824
3794
|
/**
|
|
@@ -4489,7 +4459,6 @@ var sort_keys_default = createRule("sort-keys", {
|
|
|
4489
4459
|
}
|
|
4490
4460
|
}
|
|
4491
4461
|
});
|
|
4492
|
-
|
|
4493
4462
|
//#endregion
|
|
4494
4463
|
//#region src/rules/sort-sequence-values.ts
|
|
4495
4464
|
var YAMLEntryData = class {
|
|
@@ -4522,9 +4491,10 @@ var YAMLEntryData = class {
|
|
|
4522
4491
|
after: sourceCode.getTokenAfter(this.node)
|
|
4523
4492
|
};
|
|
4524
4493
|
const before = this.index > 0 ? this.sequence.entries[this.index - 1].aroundTokens.after : sourceCode.getFirstToken(this.sequence.node);
|
|
4494
|
+
const after = sourceCode.getTokenAfter(before);
|
|
4525
4495
|
return this.cachedAroundTokens = {
|
|
4526
4496
|
before,
|
|
4527
|
-
after
|
|
4497
|
+
after
|
|
4528
4498
|
};
|
|
4529
4499
|
}
|
|
4530
4500
|
constructor(sequence, node, index, anchorAlias) {
|
|
@@ -5018,7 +4988,6 @@ var sort_sequence_values_default = createRule("sort-sequence-values", {
|
|
|
5018
4988
|
}
|
|
5019
4989
|
}
|
|
5020
4990
|
});
|
|
5021
|
-
|
|
5022
4991
|
//#endregion
|
|
5023
4992
|
//#region src/rules/spaced-comment.ts
|
|
5024
4993
|
/**
|
|
@@ -5096,134 +5065,6 @@ function createNeverStylePattern(markers) {
|
|
|
5096
5065
|
const pattern = `^(${markers.map(escapeText).join("|")})?[ \t]+`;
|
|
5097
5066
|
return new RegExp(pattern, "u");
|
|
5098
5067
|
}
|
|
5099
|
-
var spaced_comment_default = createRule("spaced-comment", {
|
|
5100
|
-
meta: {
|
|
5101
|
-
docs: {
|
|
5102
|
-
description: "enforce consistent spacing after the `#` in a comment",
|
|
5103
|
-
categories: ["standard"],
|
|
5104
|
-
extensionRule: "spaced-comment",
|
|
5105
|
-
layout: false
|
|
5106
|
-
},
|
|
5107
|
-
fixable: "whitespace",
|
|
5108
|
-
schema: [{ enum: ["always", "never"] }, {
|
|
5109
|
-
type: "object",
|
|
5110
|
-
properties: {
|
|
5111
|
-
exceptions: {
|
|
5112
|
-
type: "array",
|
|
5113
|
-
items: { type: "string" }
|
|
5114
|
-
},
|
|
5115
|
-
markers: {
|
|
5116
|
-
type: "array",
|
|
5117
|
-
items: { type: "string" }
|
|
5118
|
-
}
|
|
5119
|
-
},
|
|
5120
|
-
additionalProperties: false
|
|
5121
|
-
}],
|
|
5122
|
-
messages: {
|
|
5123
|
-
unexpectedSpaceAfterMarker: "Unexpected space after marker ({{refChar}}) in comment.",
|
|
5124
|
-
expectedExceptionAfter: "Expected exception block, space after '{{refChar}}' in comment.",
|
|
5125
|
-
unexpectedSpaceAfter: "Unexpected space after '{{refChar}}' in comment.",
|
|
5126
|
-
expectedSpaceAfter: "Expected space after '{{refChar}}' in comment."
|
|
5127
|
-
},
|
|
5128
|
-
type: "suggestion"
|
|
5129
|
-
},
|
|
5130
|
-
create(context) {
|
|
5131
|
-
const sourceCode = context.sourceCode;
|
|
5132
|
-
if (!sourceCode.parserServices?.isYAML) return {};
|
|
5133
|
-
const requireSpace = context.options[0] !== "never";
|
|
5134
|
-
const config = context.options[1] || {};
|
|
5135
|
-
const markers = config.markers || [];
|
|
5136
|
-
const exceptions = config.exceptions || [];
|
|
5137
|
-
const styleRules = {
|
|
5138
|
-
beginRegex: requireSpace ? createAlwaysStylePattern(markers, exceptions) : createNeverStylePattern(markers),
|
|
5139
|
-
hasExceptions: exceptions.length > 0,
|
|
5140
|
-
captureMarker: new RegExp(`^(${markers.map(escapeText).join("|")})`, "u"),
|
|
5141
|
-
markers: new Set(markers)
|
|
5142
|
-
};
|
|
5143
|
-
/**
|
|
5144
|
-
* Reports a beginning spacing error with an appropriate message.
|
|
5145
|
-
* @param {ASTNode} node A comment node to check.
|
|
5146
|
-
* @param {string} messageId An error message to report.
|
|
5147
|
-
* @param {Array} match An array of match results for markers.
|
|
5148
|
-
* @param {string} refChar Character used for reference in the error message.
|
|
5149
|
-
* @returns {void}
|
|
5150
|
-
*/
|
|
5151
|
-
function reportBegin(node, messageId, match, refChar) {
|
|
5152
|
-
context.report({
|
|
5153
|
-
node,
|
|
5154
|
-
fix(fixer) {
|
|
5155
|
-
const start = node.range[0];
|
|
5156
|
-
let end = start + 1;
|
|
5157
|
-
if (requireSpace) {
|
|
5158
|
-
if (match) end += match[0].length;
|
|
5159
|
-
return fixer.insertTextAfterRange([start, end], " ");
|
|
5160
|
-
}
|
|
5161
|
-
end += match[0].length;
|
|
5162
|
-
return fixer.replaceTextRange([start, end], `#${match?.[1] ? match[1] : ""}`);
|
|
5163
|
-
},
|
|
5164
|
-
messageId,
|
|
5165
|
-
data: { refChar }
|
|
5166
|
-
});
|
|
5167
|
-
}
|
|
5168
|
-
/**
|
|
5169
|
-
* Reports a given comment if it's invalid.
|
|
5170
|
-
* @param {ASTNode} node a comment node to check.
|
|
5171
|
-
* @returns {void}
|
|
5172
|
-
*/
|
|
5173
|
-
function checkCommentForSpace(node) {
|
|
5174
|
-
if (node.value.length === 0 || styleRules.markers.has(node.value)) return;
|
|
5175
|
-
const beginMatch = styleRules.beginRegex.exec(node.value);
|
|
5176
|
-
if (requireSpace) {
|
|
5177
|
-
if (!beginMatch) {
|
|
5178
|
-
const hasMarker = styleRules.captureMarker.exec(node.value);
|
|
5179
|
-
const marker = hasMarker ? `#${hasMarker[0]}` : "#";
|
|
5180
|
-
if (styleRules.hasExceptions) reportBegin(node, "expectedExceptionAfter", hasMarker, marker);
|
|
5181
|
-
else reportBegin(node, "expectedSpaceAfter", hasMarker, marker);
|
|
5182
|
-
}
|
|
5183
|
-
} else if (beginMatch) if (!beginMatch[1]) reportBegin(node, "unexpectedSpaceAfter", beginMatch, "#");
|
|
5184
|
-
else reportBegin(node, "unexpectedSpaceAfterMarker", beginMatch, beginMatch[1]);
|
|
5185
|
-
}
|
|
5186
|
-
return { Program() {
|
|
5187
|
-
sourceCode.getAllComments().forEach(checkCommentForSpace);
|
|
5188
|
-
} };
|
|
5189
|
-
}
|
|
5190
|
-
});
|
|
5191
|
-
|
|
5192
|
-
//#endregion
|
|
5193
|
-
//#region src/rules/vue-custom-block/no-parsing-error.ts
|
|
5194
|
-
var no_parsing_error_default = createRule("vue-custom-block/no-parsing-error", {
|
|
5195
|
-
meta: {
|
|
5196
|
-
docs: {
|
|
5197
|
-
description: "disallow parsing errors in Vue custom blocks",
|
|
5198
|
-
categories: ["recommended", "standard"],
|
|
5199
|
-
extensionRule: false,
|
|
5200
|
-
layout: false
|
|
5201
|
-
},
|
|
5202
|
-
schema: [],
|
|
5203
|
-
messages: {},
|
|
5204
|
-
type: "problem"
|
|
5205
|
-
},
|
|
5206
|
-
create(context, { customBlock }) {
|
|
5207
|
-
if (!customBlock) return {};
|
|
5208
|
-
const parseError = context.sourceCode.parserServices.parseError;
|
|
5209
|
-
if (parseError && typeof parseError === "object") {
|
|
5210
|
-
let loc = void 0;
|
|
5211
|
-
if ("column" in parseError && "lineNumber" in parseError) loc = {
|
|
5212
|
-
line: parseError.lineNumber,
|
|
5213
|
-
column: parseError.column
|
|
5214
|
-
};
|
|
5215
|
-
return { Program(node) {
|
|
5216
|
-
context.report({
|
|
5217
|
-
node,
|
|
5218
|
-
loc,
|
|
5219
|
-
message: parseError.message
|
|
5220
|
-
});
|
|
5221
|
-
} };
|
|
5222
|
-
}
|
|
5223
|
-
return {};
|
|
5224
|
-
}
|
|
5225
|
-
});
|
|
5226
|
-
|
|
5227
5068
|
//#endregion
|
|
5228
5069
|
//#region src/utils/rules.ts
|
|
5229
5070
|
const rules$1 = [
|
|
@@ -5253,10 +5094,131 @@ const rules$1 = [
|
|
|
5253
5094
|
require_string_key_default,
|
|
5254
5095
|
sort_keys_default,
|
|
5255
5096
|
sort_sequence_values_default,
|
|
5256
|
-
|
|
5257
|
-
|
|
5097
|
+
createRule("spaced-comment", {
|
|
5098
|
+
meta: {
|
|
5099
|
+
docs: {
|
|
5100
|
+
description: "enforce consistent spacing after the `#` in a comment",
|
|
5101
|
+
categories: ["standard"],
|
|
5102
|
+
extensionRule: "spaced-comment",
|
|
5103
|
+
layout: false
|
|
5104
|
+
},
|
|
5105
|
+
fixable: "whitespace",
|
|
5106
|
+
schema: [{ enum: ["always", "never"] }, {
|
|
5107
|
+
type: "object",
|
|
5108
|
+
properties: {
|
|
5109
|
+
exceptions: {
|
|
5110
|
+
type: "array",
|
|
5111
|
+
items: { type: "string" }
|
|
5112
|
+
},
|
|
5113
|
+
markers: {
|
|
5114
|
+
type: "array",
|
|
5115
|
+
items: { type: "string" }
|
|
5116
|
+
}
|
|
5117
|
+
},
|
|
5118
|
+
additionalProperties: false
|
|
5119
|
+
}],
|
|
5120
|
+
messages: {
|
|
5121
|
+
unexpectedSpaceAfterMarker: "Unexpected space after marker ({{refChar}}) in comment.",
|
|
5122
|
+
expectedExceptionAfter: "Expected exception block, space after '{{refChar}}' in comment.",
|
|
5123
|
+
unexpectedSpaceAfter: "Unexpected space after '{{refChar}}' in comment.",
|
|
5124
|
+
expectedSpaceAfter: "Expected space after '{{refChar}}' in comment."
|
|
5125
|
+
},
|
|
5126
|
+
type: "suggestion"
|
|
5127
|
+
},
|
|
5128
|
+
create(context) {
|
|
5129
|
+
const sourceCode = context.sourceCode;
|
|
5130
|
+
if (!sourceCode.parserServices?.isYAML) return {};
|
|
5131
|
+
const requireSpace = context.options[0] !== "never";
|
|
5132
|
+
const config = context.options[1] || {};
|
|
5133
|
+
const markers = config.markers || [];
|
|
5134
|
+
const exceptions = config.exceptions || [];
|
|
5135
|
+
const styleRules = {
|
|
5136
|
+
beginRegex: requireSpace ? createAlwaysStylePattern(markers, exceptions) : createNeverStylePattern(markers),
|
|
5137
|
+
hasExceptions: exceptions.length > 0,
|
|
5138
|
+
captureMarker: new RegExp(`^(${markers.map(escapeText).join("|")})`, "u"),
|
|
5139
|
+
markers: new Set(markers)
|
|
5140
|
+
};
|
|
5141
|
+
/**
|
|
5142
|
+
* Reports a beginning spacing error with an appropriate message.
|
|
5143
|
+
* @param {ASTNode} node A comment node to check.
|
|
5144
|
+
* @param {string} messageId An error message to report.
|
|
5145
|
+
* @param {Array} match An array of match results for markers.
|
|
5146
|
+
* @param {string} refChar Character used for reference in the error message.
|
|
5147
|
+
* @returns {void}
|
|
5148
|
+
*/
|
|
5149
|
+
function reportBegin(node, messageId, match, refChar) {
|
|
5150
|
+
context.report({
|
|
5151
|
+
node,
|
|
5152
|
+
fix(fixer) {
|
|
5153
|
+
const start = node.range[0];
|
|
5154
|
+
let end = start + 1;
|
|
5155
|
+
if (requireSpace) {
|
|
5156
|
+
if (match) end += match[0].length;
|
|
5157
|
+
return fixer.insertTextAfterRange([start, end], " ");
|
|
5158
|
+
}
|
|
5159
|
+
end += match[0].length;
|
|
5160
|
+
return fixer.replaceTextRange([start, end], `#${match?.[1] ? match[1] : ""}`);
|
|
5161
|
+
},
|
|
5162
|
+
messageId,
|
|
5163
|
+
data: { refChar }
|
|
5164
|
+
});
|
|
5165
|
+
}
|
|
5166
|
+
/**
|
|
5167
|
+
* Reports a given comment if it's invalid.
|
|
5168
|
+
* @param {ASTNode} node a comment node to check.
|
|
5169
|
+
* @returns {void}
|
|
5170
|
+
*/
|
|
5171
|
+
function checkCommentForSpace(node) {
|
|
5172
|
+
if (node.value.length === 0 || styleRules.markers.has(node.value)) return;
|
|
5173
|
+
const beginMatch = styleRules.beginRegex.exec(node.value);
|
|
5174
|
+
if (requireSpace) {
|
|
5175
|
+
if (!beginMatch) {
|
|
5176
|
+
const hasMarker = styleRules.captureMarker.exec(node.value);
|
|
5177
|
+
const marker = hasMarker ? `#${hasMarker[0]}` : "#";
|
|
5178
|
+
if (styleRules.hasExceptions) reportBegin(node, "expectedExceptionAfter", hasMarker, marker);
|
|
5179
|
+
else reportBegin(node, "expectedSpaceAfter", hasMarker, marker);
|
|
5180
|
+
}
|
|
5181
|
+
} else if (beginMatch) if (!beginMatch[1]) reportBegin(node, "unexpectedSpaceAfter", beginMatch, "#");
|
|
5182
|
+
else reportBegin(node, "unexpectedSpaceAfterMarker", beginMatch, beginMatch[1]);
|
|
5183
|
+
}
|
|
5184
|
+
return { Program() {
|
|
5185
|
+
sourceCode.getAllComments().forEach(checkCommentForSpace);
|
|
5186
|
+
} };
|
|
5187
|
+
}
|
|
5188
|
+
}),
|
|
5189
|
+
createRule("vue-custom-block/no-parsing-error", {
|
|
5190
|
+
meta: {
|
|
5191
|
+
docs: {
|
|
5192
|
+
description: "disallow parsing errors in Vue custom blocks",
|
|
5193
|
+
categories: ["recommended", "standard"],
|
|
5194
|
+
extensionRule: false,
|
|
5195
|
+
layout: false
|
|
5196
|
+
},
|
|
5197
|
+
schema: [],
|
|
5198
|
+
messages: {},
|
|
5199
|
+
type: "problem"
|
|
5200
|
+
},
|
|
5201
|
+
create(context, { customBlock }) {
|
|
5202
|
+
if (!customBlock) return {};
|
|
5203
|
+
const parseError = context.sourceCode.parserServices.parseError;
|
|
5204
|
+
if (parseError && typeof parseError === "object") {
|
|
5205
|
+
let loc = void 0;
|
|
5206
|
+
if ("column" in parseError && "lineNumber" in parseError) loc = {
|
|
5207
|
+
line: parseError.lineNumber,
|
|
5208
|
+
column: parseError.column
|
|
5209
|
+
};
|
|
5210
|
+
return { Program(node) {
|
|
5211
|
+
context.report({
|
|
5212
|
+
node,
|
|
5213
|
+
loc,
|
|
5214
|
+
message: parseError.message
|
|
5215
|
+
});
|
|
5216
|
+
} };
|
|
5217
|
+
}
|
|
5218
|
+
return {};
|
|
5219
|
+
}
|
|
5220
|
+
})
|
|
5258
5221
|
];
|
|
5259
|
-
|
|
5260
5222
|
//#endregion
|
|
5261
5223
|
//#region src/configs/flat/base.ts
|
|
5262
5224
|
var base_default = [{ plugins: { get yml() {
|
|
@@ -5275,7 +5237,6 @@ var base_default = [{ plugins: { get yml() {
|
|
|
5275
5237
|
"spaced-comment": "off"
|
|
5276
5238
|
}
|
|
5277
5239
|
}];
|
|
5278
|
-
|
|
5279
5240
|
//#endregion
|
|
5280
5241
|
//#region src/configs/flat/recommended.ts
|
|
5281
5242
|
var recommended_default = [...base_default, { rules: {
|
|
@@ -5287,7 +5248,6 @@ var recommended_default = [...base_default, { rules: {
|
|
|
5287
5248
|
"yml/no-tab-indent": "error",
|
|
5288
5249
|
"yml/vue-custom-block/no-parsing-error": "error"
|
|
5289
5250
|
} }];
|
|
5290
|
-
|
|
5291
5251
|
//#endregion
|
|
5292
5252
|
//#region src/configs/flat/standard.ts
|
|
5293
5253
|
var standard_default = [...base_default, { rules: {
|
|
@@ -5315,7 +5275,6 @@ var standard_default = [...base_default, { rules: {
|
|
|
5315
5275
|
"yml/spaced-comment": "error",
|
|
5316
5276
|
"yml/vue-custom-block/no-parsing-error": "error"
|
|
5317
5277
|
} }];
|
|
5318
|
-
|
|
5319
5278
|
//#endregion
|
|
5320
5279
|
//#region src/configs/flat/prettier.ts
|
|
5321
5280
|
var prettier_default = [...base_default, { rules: {
|
|
@@ -5332,12 +5291,10 @@ var prettier_default = [...base_default, { rules: {
|
|
|
5332
5291
|
"yml/no-trailing-zeros": "off",
|
|
5333
5292
|
"yml/quotes": "off"
|
|
5334
5293
|
} }];
|
|
5335
|
-
|
|
5336
5294
|
//#endregion
|
|
5337
5295
|
//#region package.json
|
|
5338
5296
|
var name$1 = "eslint-plugin-yml";
|
|
5339
|
-
var version$1 = "3.3.
|
|
5340
|
-
|
|
5297
|
+
var version$1 = "3.3.2";
|
|
5341
5298
|
//#endregion
|
|
5342
5299
|
//#region src/meta.ts
|
|
5343
5300
|
var meta_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -5346,7 +5303,6 @@ var meta_exports = /* @__PURE__ */ __exportAll({
|
|
|
5346
5303
|
});
|
|
5347
5304
|
const name = name$1;
|
|
5348
5305
|
const version = version$1;
|
|
5349
|
-
|
|
5350
5306
|
//#endregion
|
|
5351
5307
|
//#region src/language/yaml-source-code.ts
|
|
5352
5308
|
/**
|
|
@@ -5655,7 +5611,6 @@ function createFakeGlobalScope(node) {
|
|
|
5655
5611
|
fakeGlobalScope.variableScope = fakeGlobalScope;
|
|
5656
5612
|
return fakeGlobalScope;
|
|
5657
5613
|
}
|
|
5658
|
-
|
|
5659
5614
|
//#endregion
|
|
5660
5615
|
//#region src/language/yaml-language.ts
|
|
5661
5616
|
/**
|
|
@@ -5728,7 +5683,6 @@ var YAMLLanguage = class {
|
|
|
5728
5683
|
});
|
|
5729
5684
|
}
|
|
5730
5685
|
};
|
|
5731
|
-
|
|
5732
5686
|
//#endregion
|
|
5733
5687
|
//#region src/index.ts
|
|
5734
5688
|
const configs = {
|
|
@@ -5749,6 +5703,5 @@ var src_default = {
|
|
|
5749
5703
|
rules,
|
|
5750
5704
|
languages
|
|
5751
5705
|
};
|
|
5752
|
-
|
|
5753
5706
|
//#endregion
|
|
5754
|
-
export { configs, src_default as default, languages, meta_exports as meta, rules };
|
|
5707
|
+
export { configs, src_default as default, languages, meta_exports as meta, rules };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-yml",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "This ESLint plugin provides linting rules for YAML.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.mjs",
|
|
@@ -65,9 +65,8 @@
|
|
|
65
65
|
"homepage": "https://ota-meshi.github.io/eslint-plugin-yml/",
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@eslint/core": "^1.0.1",
|
|
68
|
-
"@eslint/plugin-kit": "^0.
|
|
68
|
+
"@eslint/plugin-kit": "^0.7.0",
|
|
69
69
|
"@ota-meshi/ast-token-store": "^0.3.0",
|
|
70
|
-
"debug": "^4.3.2",
|
|
71
70
|
"diff-sequences": "^29.0.0",
|
|
72
71
|
"escape-string-regexp": "5.0.0",
|
|
73
72
|
"natural-compare": "^1.4.0",
|
|
@@ -86,13 +85,12 @@
|
|
|
86
85
|
"@ota-meshi/eslint-plugin": "^0.20.0",
|
|
87
86
|
"@ota-meshi/site-kit-eslint-editor-vue": "^0.2.0",
|
|
88
87
|
"@stylistic/eslint-plugin": "^5.7.0",
|
|
89
|
-
"@types/debug": "^4.1.5",
|
|
90
88
|
"@types/mocha": "^10.0.0",
|
|
91
89
|
"@types/natural-compare": "^1.4.0",
|
|
92
90
|
"@types/node": "^24.0.0",
|
|
93
91
|
"@types/semver": "^7.3.1",
|
|
94
|
-
"@typescript-eslint/eslint-plugin": "~8.
|
|
95
|
-
"@typescript-eslint/parser": "~8.
|
|
92
|
+
"@typescript-eslint/eslint-plugin": "~8.59.0",
|
|
93
|
+
"@typescript-eslint/parser": "~8.59.0",
|
|
96
94
|
"cross-env": "^10.0.0",
|
|
97
95
|
"env-cmd": "^11.0.0",
|
|
98
96
|
"eslint": "^10.0.0",
|
|
@@ -121,11 +119,11 @@
|
|
|
121
119
|
"stylelint-config-standard": "^40.0.0",
|
|
122
120
|
"stylelint-config-standard-vue": "^1.0.0",
|
|
123
121
|
"stylelint-stylus": "^1.0.0",
|
|
124
|
-
"tsdown": "^0.
|
|
122
|
+
"tsdown": "^0.21.0",
|
|
125
123
|
"tsx": "^4.21.0",
|
|
126
|
-
"typescript": "~
|
|
124
|
+
"typescript": "~6.0.0",
|
|
127
125
|
"typescript-eslint": "^8.0.0",
|
|
128
|
-
"vite-plugin-eslint4b": "^0.
|
|
126
|
+
"vite-plugin-eslint4b": "^0.8.0",
|
|
129
127
|
"vitepress": "^1.0.0-rc.17",
|
|
130
128
|
"vue-eslint-parser": "^10.0.0",
|
|
131
129
|
"yaml": "^2.1.1"
|
package/lib/chunk-DQk6qfdC.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all, no_symbols) => {
|
|
4
|
-
let target = {};
|
|
5
|
-
for (var name in all) {
|
|
6
|
-
__defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
if (!no_symbols) {
|
|
12
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
-
}
|
|
14
|
-
return target;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
//#endregion
|
|
18
|
-
export { __exportAll as t };
|