@html-validate/eslint-config 5.20.1 → 5.20.3

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/dist/cli.js CHANGED
@@ -9577,7 +9577,7 @@ var require_utils2 = __commonJS({
9577
9577
  return (Number(max) - Number(min)) / Number(step) >= limit;
9578
9578
  };
9579
9579
  exports2.escapeNode = (block, n = 0, type) => {
9580
- let node = block.nodes[n];
9580
+ const node = block.nodes[n];
9581
9581
  if (!node) return;
9582
9582
  if (type && node.type === type || node.type === "open" || node.type === "close") {
9583
9583
  if (node.escaped !== true) {
@@ -9622,8 +9622,14 @@ var require_utils2 = __commonJS({
9622
9622
  const result = [];
9623
9623
  const flat = (arr) => {
9624
9624
  for (let i = 0; i < arr.length; i++) {
9625
- let ele = arr[i];
9626
- Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
9625
+ const ele = arr[i];
9626
+ if (Array.isArray(ele)) {
9627
+ flat(ele);
9628
+ continue;
9629
+ }
9630
+ if (ele !== void 0) {
9631
+ result.push(ele);
9632
+ }
9627
9633
  }
9628
9634
  return result;
9629
9635
  };
@@ -9639,9 +9645,9 @@ var require_stringify = __commonJS({
9639
9645
  "use strict";
9640
9646
  var utils = require_utils2();
9641
9647
  module2.exports = (ast, options = {}) => {
9642
- let stringify = (node, parent = {}) => {
9643
- let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
9644
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
9648
+ const stringify = (node, parent = {}) => {
9649
+ const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
9650
+ const invalidNode = node.invalid === true && options.escapeInvalid === true;
9645
9651
  let output = "";
9646
9652
  if (node.value) {
9647
9653
  if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
@@ -9653,7 +9659,7 @@ var require_stringify = __commonJS({
9653
9659
  return node.value;
9654
9660
  }
9655
9661
  if (node.nodes) {
9656
- for (let child of node.nodes) {
9662
+ for (const child of node.nodes) {
9657
9663
  output += stringify(child);
9658
9664
  }
9659
9665
  }
@@ -9939,7 +9945,7 @@ var require_fill_range = __commonJS({
9939
9945
  while (input.length < maxLength) input = "0" + input;
9940
9946
  return negative ? "-" + input : input;
9941
9947
  };
9942
- var toSequence = (parts, options) => {
9948
+ var toSequence = (parts, options, maxLen) => {
9943
9949
  parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
9944
9950
  parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
9945
9951
  let prefix = options.capture ? "" : "?:";
@@ -9947,10 +9953,10 @@ var require_fill_range = __commonJS({
9947
9953
  let negatives = "";
9948
9954
  let result;
9949
9955
  if (parts.positives.length) {
9950
- positives = parts.positives.join("|");
9956
+ positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
9951
9957
  }
9952
9958
  if (parts.negatives.length) {
9953
- negatives = `-(${prefix}${parts.negatives.join("|")})`;
9959
+ negatives = `-(${prefix}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
9954
9960
  }
9955
9961
  if (positives && negatives) {
9956
9962
  result = `${positives}|${negatives}`;
@@ -10027,7 +10033,7 @@ var require_fill_range = __commonJS({
10027
10033
  index++;
10028
10034
  }
10029
10035
  if (options.toRegex === true) {
10030
- return step > 1 ? toSequence(parts, options) : toRegex(range, null, { wrap: false, ...options });
10036
+ return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, { wrap: false, ...options });
10031
10037
  }
10032
10038
  return range;
10033
10039
  };
@@ -10092,16 +10098,17 @@ var require_compile = __commonJS({
10092
10098
  var fill = require_fill_range();
10093
10099
  var utils = require_utils2();
10094
10100
  var compile = (ast, options = {}) => {
10095
- let walk = (node, parent = {}) => {
10096
- let invalidBlock = utils.isInvalidBrace(parent);
10097
- let invalidNode = node.invalid === true && options.escapeInvalid === true;
10098
- let invalid = invalidBlock === true || invalidNode === true;
10099
- let prefix = options.escapeInvalid === true ? "\\" : "";
10101
+ const walk = (node, parent = {}) => {
10102
+ const invalidBlock = utils.isInvalidBrace(parent);
10103
+ const invalidNode = node.invalid === true && options.escapeInvalid === true;
10104
+ const invalid = invalidBlock === true || invalidNode === true;
10105
+ const prefix = options.escapeInvalid === true ? "\\" : "";
10100
10106
  let output = "";
10101
10107
  if (node.isOpen === true) {
10102
10108
  return prefix + node.value;
10103
10109
  }
10104
10110
  if (node.isClose === true) {
10111
+ console.log("node.isClose", prefix, node.value);
10105
10112
  return prefix + node.value;
10106
10113
  }
10107
10114
  if (node.type === "open") {
@@ -10117,14 +10124,14 @@ var require_compile = __commonJS({
10117
10124
  return node.value;
10118
10125
  }
10119
10126
  if (node.nodes && node.ranges > 0) {
10120
- let args2 = utils.reduce(node.nodes);
10121
- let range = fill(...args2, { ...options, wrap: false, toRegex: true });
10127
+ const args2 = utils.reduce(node.nodes);
10128
+ const range = fill(...args2, { ...options, wrap: false, toRegex: true, strictZeros: true });
10122
10129
  if (range.length !== 0) {
10123
10130
  return args2.length > 1 && range.length > 1 ? `(${range})` : range;
10124
10131
  }
10125
10132
  }
10126
10133
  if (node.nodes) {
10127
- for (let child of node.nodes) {
10134
+ for (const child of node.nodes) {
10128
10135
  output += walk(child, node);
10129
10136
  }
10130
10137
  }
@@ -10144,16 +10151,16 @@ var require_expand = __commonJS({
10144
10151
  var stringify = require_stringify();
10145
10152
  var utils = require_utils2();
10146
10153
  var append = (queue = "", stash = "", enclose = false) => {
10147
- let result = [];
10154
+ const result = [];
10148
10155
  queue = [].concat(queue);
10149
10156
  stash = [].concat(stash);
10150
10157
  if (!stash.length) return queue;
10151
10158
  if (!queue.length) {
10152
10159
  return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
10153
10160
  }
10154
- for (let item of queue) {
10161
+ for (const item of queue) {
10155
10162
  if (Array.isArray(item)) {
10156
- for (let value of item) {
10163
+ for (const value of item) {
10157
10164
  result.push(append(value, stash, enclose));
10158
10165
  }
10159
10166
  } else {
@@ -10166,8 +10173,8 @@ var require_expand = __commonJS({
10166
10173
  return utils.flatten(result);
10167
10174
  };
10168
10175
  var expand = (ast, options = {}) => {
10169
- let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
10170
- let walk = (node, parent = {}) => {
10176
+ const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
10177
+ const walk = (node, parent = {}) => {
10171
10178
  node.queue = [];
10172
10179
  let p = parent;
10173
10180
  let q = parent.queue;
@@ -10184,7 +10191,7 @@ var require_expand = __commonJS({
10184
10191
  return;
10185
10192
  }
10186
10193
  if (node.nodes && node.ranges > 0) {
10187
- let args2 = utils.reduce(node.nodes);
10194
+ const args2 = utils.reduce(node.nodes);
10188
10195
  if (utils.exceedsLimit(...args2, options.step, rangeLimit)) {
10189
10196
  throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
10190
10197
  }
@@ -10196,7 +10203,7 @@ var require_expand = __commonJS({
10196
10203
  node.nodes = [];
10197
10204
  return;
10198
10205
  }
10199
- let enclose = utils.encloseBrace(node);
10206
+ const enclose = utils.encloseBrace(node);
10200
10207
  let queue = node.queue;
10201
10208
  let block = node;
10202
10209
  while (block.type !== "brace" && block.type !== "root" && block.parent) {
@@ -10204,7 +10211,7 @@ var require_expand = __commonJS({
10204
10211
  queue = block.queue;
10205
10212
  }
10206
10213
  for (let i = 0; i < node.nodes.length; i++) {
10207
- let child = node.nodes[i];
10214
+ const child = node.nodes[i];
10208
10215
  if (child.type === "comma" && node.type === "brace") {
10209
10216
  if (i === 1) queue.push("");
10210
10217
  queue.push("");
@@ -10235,7 +10242,7 @@ var require_constants2 = __commonJS({
10235
10242
  "../../node_modules/braces/lib/constants.js"(exports2, module2) {
10236
10243
  "use strict";
10237
10244
  module2.exports = {
10238
- MAX_LENGTH: 1024 * 64,
10245
+ MAX_LENGTH: 1e4,
10239
10246
  // Digits
10240
10247
  CHAR_0: "0",
10241
10248
  /* 0 */
@@ -10369,21 +10376,20 @@ var require_parse2 = __commonJS({
10369
10376
  if (typeof input !== "string") {
10370
10377
  throw new TypeError("Expected a string");
10371
10378
  }
10372
- let opts = options || {};
10373
- let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
10379
+ const opts = options || {};
10380
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
10374
10381
  if (input.length > max) {
10375
10382
  throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
10376
10383
  }
10377
- let ast = { type: "root", input, nodes: [] };
10378
- let stack = [ast];
10384
+ const ast = { type: "root", input, nodes: [] };
10385
+ const stack = [ast];
10379
10386
  let block = ast;
10380
10387
  let prev = ast;
10381
10388
  let brackets = 0;
10382
- let length = input.length;
10389
+ const length = input.length;
10383
10390
  let index = 0;
10384
10391
  let depth = 0;
10385
10392
  let value;
10386
- let memo = {};
10387
10393
  const advance = () => input[index++];
10388
10394
  const push = (node) => {
10389
10395
  if (node.type === "text" && prev.type === "dot") {
@@ -10416,7 +10422,6 @@ var require_parse2 = __commonJS({
10416
10422
  }
10417
10423
  if (value === CHAR_LEFT_SQUARE_BRACKET) {
10418
10424
  brackets++;
10419
- let closed = true;
10420
10425
  let next;
10421
10426
  while (index < length && (next = advance())) {
10422
10427
  value += next;
@@ -10455,7 +10460,7 @@ var require_parse2 = __commonJS({
10455
10460
  continue;
10456
10461
  }
10457
10462
  if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
10458
- let open = value;
10463
+ const open = value;
10459
10464
  let next;
10460
10465
  if (options.keepQuotes !== true) {
10461
10466
  value = "";
@@ -10476,8 +10481,8 @@ var require_parse2 = __commonJS({
10476
10481
  }
10477
10482
  if (value === CHAR_LEFT_CURLY_BRACE) {
10478
10483
  depth++;
10479
- let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
10480
- let brace = {
10484
+ const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
10485
+ const brace = {
10481
10486
  type: "brace",
10482
10487
  open: true,
10483
10488
  close: false,
@@ -10497,7 +10502,7 @@ var require_parse2 = __commonJS({
10497
10502
  push({ type: "text", value });
10498
10503
  continue;
10499
10504
  }
10500
- let type = "close";
10505
+ const type = "close";
10501
10506
  block = stack.pop();
10502
10507
  block.close = true;
10503
10508
  push({ type, value });
@@ -10508,7 +10513,7 @@ var require_parse2 = __commonJS({
10508
10513
  if (value === CHAR_COMMA && depth > 0) {
10509
10514
  if (block.ranges > 0) {
10510
10515
  block.ranges = 0;
10511
- let open = block.nodes.shift();
10516
+ const open = block.nodes.shift();
10512
10517
  block.nodes = [open, { type: "text", value: stringify(block) }];
10513
10518
  }
10514
10519
  push({ type: "comma", value });
@@ -10516,7 +10521,7 @@ var require_parse2 = __commonJS({
10516
10521
  continue;
10517
10522
  }
10518
10523
  if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
10519
- let siblings = block.nodes;
10524
+ const siblings = block.nodes;
10520
10525
  if (depth === 0 || siblings.length === 0) {
10521
10526
  push({ type: "text", value });
10522
10527
  continue;
@@ -10537,7 +10542,7 @@ var require_parse2 = __commonJS({
10537
10542
  }
10538
10543
  if (prev.type === "range") {
10539
10544
  siblings.pop();
10540
- let before = siblings[siblings.length - 1];
10545
+ const before = siblings[siblings.length - 1];
10541
10546
  before.value += prev.value + value;
10542
10547
  prev = before;
10543
10548
  block.ranges--;
@@ -10559,8 +10564,8 @@ var require_parse2 = __commonJS({
10559
10564
  node.invalid = true;
10560
10565
  }
10561
10566
  });
10562
- let parent = stack[stack.length - 1];
10563
- let index2 = parent.nodes.indexOf(block);
10567
+ const parent = stack[stack.length - 1];
10568
+ const index2 = parent.nodes.indexOf(block);
10564
10569
  parent.nodes.splice(index2, 1, ...block.nodes);
10565
10570
  }
10566
10571
  } while (stack.length > 0);
@@ -10582,8 +10587,8 @@ var require_braces = __commonJS({
10582
10587
  var braces = (input, options = {}) => {
10583
10588
  let output = [];
10584
10589
  if (Array.isArray(input)) {
10585
- for (let pattern of input) {
10586
- let result = braces.create(pattern, options);
10590
+ for (const pattern of input) {
10591
+ const result = braces.create(pattern, options);
10587
10592
  if (Array.isArray(result)) {
10588
10593
  output.push(...result);
10589
10594
  } else {
@@ -13960,7 +13965,7 @@ var require_package = __commonJS({
13960
13965
  "package.json"(exports2, module2) {
13961
13966
  module2.exports = {
13962
13967
  name: "@html-validate/eslint-config",
13963
- version: "5.20.0",
13968
+ version: "5.20.2",
13964
13969
  description: "Eslint sharable config used by the various HTML-validate packages",
13965
13970
  keywords: [
13966
13971
  "eslint"
@@ -13996,7 +14001,7 @@ var require_package = __commonJS({
13996
14001
  prepublishOnly: "release-prepublish --retain-scripts"
13997
14002
  },
13998
14003
  dependencies: {
13999
- "@rushstack/eslint-patch": "1.10.2",
14004
+ "@rushstack/eslint-patch": "1.10.3",
14000
14005
  eslint: "8.57.0",
14001
14006
  "eslint-config-prettier": "9.1.0",
14002
14007
  "eslint-config-sidvind": "1.3.2",
@@ -14006,7 +14011,7 @@ var require_package = __commonJS({
14006
14011
  "eslint-plugin-array-func": "4.0.0",
14007
14012
  "eslint-plugin-eslint-comments": "3.2.0",
14008
14013
  "eslint-plugin-import": "2.29.1",
14009
- "eslint-plugin-n": "17.6.0",
14014
+ "eslint-plugin-n": "17.7.0",
14010
14015
  "eslint-plugin-prettier": "5.1.3",
14011
14016
  "eslint-plugin-security": "3.0.0",
14012
14017
  "eslint-plugin-sonarjs": "0.25.1"
@@ -14014,7 +14019,7 @@ var require_package = __commonJS({
14014
14019
  devDependencies: {
14015
14020
  argparse: "2.0.1",
14016
14021
  "find-up": "7.0.0",
14017
- "internal-prettier": "5.20.0",
14022
+ "internal-prettier": "5.20.2",
14018
14023
  nunjucks: "3.2.4"
14019
14024
  },
14020
14025
  peerDependencies: {