@vue-jsx-vapor/eslint 3.2.11 → 3.2.13

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/index.cjs CHANGED
@@ -1,5 +1,8 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
- //#region rolldown:runtime
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ //#region \0rolldown/runtime.js
3
6
  var __create = Object.create;
4
7
  var __defProp = Object.defineProperty;
5
8
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,16 +10,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
10
  var __getProtoOf = Object.getPrototypeOf;
8
11
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
12
  var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
13
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
14
+ key = keys[i];
15
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: ((k) => from[k]).bind(null, key),
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
20
19
  }
21
20
  return to;
22
21
  };
@@ -24,11 +23,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
23
  value: mod,
25
24
  enumerable: true
26
25
  }) : target, mod));
27
-
28
26
  //#endregion
29
27
  let _prettier_sync = require("@prettier/sync");
30
- _prettier_sync = __toESM(_prettier_sync);
31
-
28
+ _prettier_sync = __toESM(_prettier_sync, 1);
32
29
  //#region src/rules/define-style/index.ts
33
30
  const rule$1 = {
34
31
  defaultOptions: [{ tabWidth: 2 }],
@@ -58,7 +55,7 @@ const rule$1 = {
58
55
  if (arg?.type === "TemplateLiteral") {
59
56
  let index = 0;
60
57
  const cssRaw = context.sourceCode.text.slice(arg.range[0] + 1, arg.range[1] - 1);
61
- let formattedCss = "";
58
+ let formattedCss;
62
59
  try {
63
60
  formattedCss = _prettier_sync.default.format(arg.quasis.map((i) => i.value.raw + (arg.expressions[index] ? `-MACROS_START-${context.sourceCode.text.slice(...arg.expressions[index++].range)}-MACROS_END-` : "")).join(""), {
64
61
  parser,
@@ -90,8 +87,6 @@ const rule$1 = {
90
87
  } };
91
88
  }
92
89
  };
93
- var define_style_default = rule$1;
94
-
95
90
  //#endregion
96
91
  //#region src/rules/jsx-sort-props/index.ts
97
92
  const COMPAT_TAG_REGEX = /^[a-z]/;
@@ -375,159 +370,154 @@ function reportNodeAttribute(nodeAttribute, errorType, node, context, reservedLi
375
370
  fix: generateFixerFunction(node, context, reservedList)
376
371
  });
377
372
  }
378
- const rule = {
379
- defaultOptions: [{
380
- multiline: "ignore",
381
- locale: "auto"
382
- }],
383
- meta: {
384
- type: "layout",
385
- docs: { description: "Enforce props alphabetical sorting" },
386
- fixable: "code",
387
- messages,
388
- schema: [{
389
- type: "object",
390
- properties: {
391
- callbacksLast: { type: "boolean" },
392
- shorthandFirst: { type: "boolean" },
393
- shorthandLast: { type: "boolean" },
394
- multiline: {
395
- type: "string",
396
- enum: [
397
- "ignore",
398
- "first",
399
- "last"
400
- ],
401
- default: "ignore"
402
- },
403
- ignoreCase: { type: "boolean" },
404
- noSortAlphabetically: { type: "boolean" },
405
- reservedFirst: { type: ["array", "boolean"] },
406
- reservedLast: { type: "array" },
407
- locale: {
408
- type: "string",
409
- default: "auto"
410
- }
411
- },
412
- additionalProperties: false
413
- }]
414
- },
415
- create(context) {
416
- const configuration = context.options[0] || {};
417
- const ignoreCase = configuration.ignoreCase || false;
418
- const callbacksLast = configuration.callbacksLast || false;
419
- const shorthandFirst = configuration.shorthandFirst || false;
420
- const shorthandLast = configuration.shorthandLast || false;
421
- const multiline = configuration.multiline || "ignore";
422
- const noSortAlphabetically = configuration.noSortAlphabetically || false;
423
- const reservedFirst = configuration.reservedFirst || false;
424
- const reservedFirstError = validateReservedFirstConfig(context, reservedFirst);
425
- const reservedList = Array.isArray(reservedFirst) ? reservedFirst : RESERVED_PROPS_LIST;
426
- const reservedLastList = configuration.reservedLast || [];
427
- const locale = configuration.locale || "auto";
428
- return {
429
- Program() {
430
- attributeMap = /* @__PURE__ */ new WeakMap();
431
- },
432
- JSXOpeningElement(node) {
433
- const nodeReservedList = reservedFirst && !isDOMComponent(node) ? reservedList.filter((prop) => prop !== "dangerouslySetInnerHTML") : reservedList;
434
- node.attributes.reduce((memo, decl, idx, attrs) => {
435
- if (decl.type === "JSXSpreadAttribute") return attrs[idx + 1];
436
- let previousPropName = getPropName(memo);
437
- let currentPropName = getPropName(decl);
438
- const previousReservedNamespace = previousPropName.split(":")[0];
439
- const currentReservedNamespace = currentPropName.split(":")[0];
440
- const previousValue = memo.value;
441
- const currentValue = decl.value;
442
- const previousIsCallback = isCallbackPropName(previousPropName);
443
- const currentIsCallback = isCallbackPropName(currentPropName);
444
- if (ignoreCase) {
445
- previousPropName = previousPropName.toLowerCase();
446
- currentPropName = currentPropName.toLowerCase();
373
+ //#endregion
374
+ //#region src/rules/index.ts
375
+ const ruleOptions = {
376
+ "jsx-sort-props": {
377
+ defaultOptions: [{
378
+ multiline: "ignore",
379
+ locale: "auto"
380
+ }],
381
+ meta: {
382
+ type: "layout",
383
+ docs: { description: "Enforce props alphabetical sorting" },
384
+ fixable: "code",
385
+ messages,
386
+ schema: [{
387
+ type: "object",
388
+ properties: {
389
+ callbacksLast: { type: "boolean" },
390
+ shorthandFirst: { type: "boolean" },
391
+ shorthandLast: { type: "boolean" },
392
+ multiline: {
393
+ type: "string",
394
+ enum: [
395
+ "ignore",
396
+ "first",
397
+ "last"
398
+ ],
399
+ default: "ignore"
400
+ },
401
+ ignoreCase: { type: "boolean" },
402
+ noSortAlphabetically: { type: "boolean" },
403
+ reservedFirst: { type: ["array", "boolean"] },
404
+ reservedLast: { type: "array" },
405
+ locale: {
406
+ type: "string",
407
+ default: "auto"
447
408
  }
448
- if (reservedFirst) {
449
- if (reservedFirstError) {
450
- reservedFirstError(decl);
451
- return memo;
409
+ },
410
+ additionalProperties: false
411
+ }]
412
+ },
413
+ create(context) {
414
+ const configuration = context.options[0] || {};
415
+ const ignoreCase = configuration.ignoreCase || false;
416
+ const callbacksLast = configuration.callbacksLast || false;
417
+ const shorthandFirst = configuration.shorthandFirst || false;
418
+ const shorthandLast = configuration.shorthandLast || false;
419
+ const multiline = configuration.multiline || "ignore";
420
+ const noSortAlphabetically = configuration.noSortAlphabetically || false;
421
+ const reservedFirst = configuration.reservedFirst || false;
422
+ const reservedFirstError = validateReservedFirstConfig(context, reservedFirst);
423
+ const reservedList = Array.isArray(reservedFirst) ? reservedFirst : RESERVED_PROPS_LIST;
424
+ const reservedLastList = configuration.reservedLast || [];
425
+ const locale = configuration.locale || "auto";
426
+ return {
427
+ Program() {
428
+ attributeMap = /* @__PURE__ */ new WeakMap();
429
+ },
430
+ JSXOpeningElement(node) {
431
+ const nodeReservedList = reservedFirst && !isDOMComponent(node) ? reservedList.filter((prop) => prop !== "dangerouslySetInnerHTML") : reservedList;
432
+ node.attributes.reduce((memo, decl, idx, attrs) => {
433
+ if (decl.type === "JSXSpreadAttribute") return attrs[idx + 1];
434
+ let previousPropName = getPropName(memo);
435
+ let currentPropName = getPropName(decl);
436
+ const previousReservedNamespace = previousPropName.split(":")[0];
437
+ const currentReservedNamespace = currentPropName.split(":")[0];
438
+ const previousValue = memo.value;
439
+ const currentValue = decl.value;
440
+ const previousIsCallback = isCallbackPropName(previousPropName);
441
+ const currentIsCallback = isCallbackPropName(currentPropName);
442
+ if (ignoreCase) {
443
+ previousPropName = previousPropName.toLowerCase();
444
+ currentPropName = currentPropName.toLowerCase();
452
445
  }
453
- const previousReservedIndex = getReservedPropIndex(previousPropName, nodeReservedList);
454
- const currentReservedIndex = getReservedPropIndex(currentPropName, nodeReservedList);
455
- if (previousReservedIndex > -1 && currentReservedIndex === -1) return decl;
456
- if (reservedFirst !== true && previousReservedIndex > currentReservedIndex || previousReservedIndex === -1 && currentReservedIndex > -1) {
457
- reportNodeAttribute(decl, "listReservedPropsFirst", node, context, nodeReservedList);
458
- return memo;
446
+ if (reservedFirst) {
447
+ if (reservedFirstError) {
448
+ reservedFirstError(decl);
449
+ return memo;
450
+ }
451
+ const previousReservedIndex = getReservedPropIndex(previousPropName, nodeReservedList);
452
+ const currentReservedIndex = getReservedPropIndex(currentPropName, nodeReservedList);
453
+ if (previousReservedIndex > -1 && currentReservedIndex === -1) return decl;
454
+ if (reservedFirst !== true && previousReservedIndex > currentReservedIndex || previousReservedIndex === -1 && currentReservedIndex > -1) {
455
+ reportNodeAttribute(decl, "listReservedPropsFirst", node, context, nodeReservedList);
456
+ return memo;
457
+ }
458
+ if (previousReservedIndex > -1 && currentReservedIndex > -1 && currentReservedIndex > previousReservedIndex && previousReservedNamespace !== currentReservedNamespace) return decl;
459
459
  }
460
- if (previousReservedIndex > -1 && currentReservedIndex > -1 && currentReservedIndex > previousReservedIndex && previousReservedNamespace !== currentReservedNamespace) return decl;
461
- }
462
- if (reservedLastList.length > 0) {
463
- const previousReservedIndex = getReservedPropIndex(previousPropName, reservedLastList);
464
- const currentReservedIndex = getReservedPropIndex(currentPropName, reservedLastList);
465
- if (previousReservedIndex === -1 && currentReservedIndex > -1) return decl;
466
- if (previousReservedIndex < currentReservedIndex || previousReservedIndex > -1 && currentReservedIndex === -1) {
467
- reportNodeAttribute(decl, "listReservedPropsLast", node, context, nodeReservedList);
468
- return memo;
460
+ if (reservedLastList.length > 0) {
461
+ const previousReservedIndex = getReservedPropIndex(previousPropName, reservedLastList);
462
+ const currentReservedIndex = getReservedPropIndex(currentPropName, reservedLastList);
463
+ if (previousReservedIndex === -1 && currentReservedIndex > -1) return decl;
464
+ if (previousReservedIndex < currentReservedIndex || previousReservedIndex > -1 && currentReservedIndex === -1) {
465
+ reportNodeAttribute(decl, "listReservedPropsLast", node, context, nodeReservedList);
466
+ return memo;
467
+ }
468
+ if (previousReservedIndex > -1 && currentReservedIndex > -1 && currentReservedIndex > previousReservedIndex && previousReservedNamespace !== currentReservedNamespace) return decl;
469
469
  }
470
- if (previousReservedIndex > -1 && currentReservedIndex > -1 && currentReservedIndex > previousReservedIndex && previousReservedNamespace !== currentReservedNamespace) return decl;
471
- }
472
- if (callbacksLast) {
473
- if (!previousIsCallback && currentIsCallback) return decl;
474
- if (previousIsCallback && !currentIsCallback) {
475
- reportNodeAttribute(memo, "listCallbacksLast", node, context, nodeReservedList);
476
- return memo;
470
+ if (callbacksLast) {
471
+ if (!previousIsCallback && currentIsCallback) return decl;
472
+ if (previousIsCallback && !currentIsCallback) {
473
+ reportNodeAttribute(memo, "listCallbacksLast", node, context, nodeReservedList);
474
+ return memo;
475
+ }
477
476
  }
478
- }
479
- if (shorthandFirst) {
480
- if (currentValue && !previousValue) return decl;
481
- if (!currentValue && previousValue) {
482
- reportNodeAttribute(decl, "listShorthandFirst", node, context, nodeReservedList);
483
- return memo;
477
+ if (shorthandFirst) {
478
+ if (currentValue && !previousValue) return decl;
479
+ if (!currentValue && previousValue) {
480
+ reportNodeAttribute(decl, "listShorthandFirst", node, context, nodeReservedList);
481
+ return memo;
482
+ }
484
483
  }
485
- }
486
- if (shorthandLast) {
487
- if (!currentValue && previousValue) return decl;
488
- if (currentValue && !previousValue) {
489
- reportNodeAttribute(memo, "listShorthandLast", node, context, nodeReservedList);
490
- return memo;
484
+ if (shorthandLast) {
485
+ if (!currentValue && previousValue) return decl;
486
+ if (currentValue && !previousValue) {
487
+ reportNodeAttribute(memo, "listShorthandLast", node, context, nodeReservedList);
488
+ return memo;
489
+ }
491
490
  }
492
- }
493
- const previousIsMultiline = isMultilineProp(memo);
494
- const currentIsMultiline = isMultilineProp(decl);
495
- if (multiline === "first") {
496
- if (previousIsMultiline && !currentIsMultiline) return decl;
497
- if (!previousIsMultiline && currentIsMultiline) {
498
- reportNodeAttribute(decl, "listMultilineFirst", node, context, nodeReservedList);
499
- return memo;
491
+ const previousIsMultiline = isMultilineProp(memo);
492
+ const currentIsMultiline = isMultilineProp(decl);
493
+ if (multiline === "first") {
494
+ if (previousIsMultiline && !currentIsMultiline) return decl;
495
+ if (!previousIsMultiline && currentIsMultiline) {
496
+ reportNodeAttribute(decl, "listMultilineFirst", node, context, nodeReservedList);
497
+ return memo;
498
+ }
499
+ } else if (multiline === "last") {
500
+ if (!previousIsMultiline && currentIsMultiline) return decl;
501
+ if (previousIsMultiline && !currentIsMultiline) {
502
+ reportNodeAttribute(memo, "listMultilineLast", node, context, nodeReservedList);
503
+ return memo;
504
+ }
500
505
  }
501
- } else if (multiline === "last") {
502
- if (!previousIsMultiline && currentIsMultiline) return decl;
503
- if (previousIsMultiline && !currentIsMultiline) {
504
- reportNodeAttribute(memo, "listMultilineLast", node, context, nodeReservedList);
506
+ if (!noSortAlphabetically && (ignoreCase || locale !== "auto" ? previousPropName.localeCompare(currentPropName, locale === "auto" ? void 0 : locale) > 0 : previousPropName > currentPropName)) {
507
+ reportNodeAttribute(decl, "sortPropsByAlpha", node, context, nodeReservedList);
505
508
  return memo;
506
509
  }
507
- }
508
- if (!noSortAlphabetically && (ignoreCase || locale !== "auto" ? previousPropName.localeCompare(currentPropName, locale === "auto" ? void 0 : locale) > 0 : previousPropName > currentPropName)) {
509
- reportNodeAttribute(decl, "sortPropsByAlpha", node, context, nodeReservedList);
510
- return memo;
511
- }
512
- return decl;
513
- }, node.attributes[0]);
514
- }
515
- };
516
- }
517
- };
518
- var jsx_sort_props_default = rule;
519
-
520
- //#endregion
521
- //#region src/rules/index.ts
522
- const ruleOptions = {
523
- "jsx-sort-props": jsx_sort_props_default,
524
- "define-style": define_style_default
510
+ return decl;
511
+ }, node.attributes[0]);
512
+ }
513
+ };
514
+ }
515
+ },
516
+ "define-style": rule$1
525
517
  };
526
- var rules_default = ruleOptions;
527
-
528
518
  //#endregion
529
519
  //#region src/index.ts
530
- const plugins = { "vue-jsx-vapor": { rules: rules_default } };
520
+ const plugins = { "vue-jsx-vapor": { rules: ruleOptions } };
531
521
  const config = ({ rules = {}, ...options } = {}) => ({
532
522
  name: "vue-jsx-vapor",
533
523
  plugins,
@@ -557,9 +547,7 @@ const config = ({ rules = {}, ...options } = {}) => ({
557
547
  },
558
548
  ...options
559
549
  });
560
- var src_default = config;
561
-
562
550
  //#endregion
563
- exports.default = src_default;
551
+ exports.default = config;
564
552
  exports.plugins = plugins;
565
- exports.rules = rules_default;
553
+ exports.rules = ruleOptions;