@pandacss/eslint-plugin 0.1.9 → 0.1.10

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.js CHANGED
@@ -7957,7 +7957,7 @@ init_cjs_shims();
7957
7957
 
7958
7958
  // package.json
7959
7959
  var name = "@pandacss/eslint-plugin";
7960
- var version = "0.1.9";
7960
+ var version = "0.1.10";
7961
7961
 
7962
7962
  // src/configs/all.ts
7963
7963
  init_cjs_shims();
@@ -8231,6 +8231,31 @@ var getTaggedTemplateCaller = (node) => {
8231
8231
  return node.tag.callee.name;
8232
8232
  }
8233
8233
  };
8234
+ function isRecipeVariant(node, context) {
8235
+ const caller = isInPandaFunction(node, context);
8236
+ if (!caller)
8237
+ return;
8238
+ const recipe = getImports(context).find((imp) => ["cva", "sva"].includes(imp.name) && imp.alias === caller);
8239
+ if (!recipe)
8240
+ return;
8241
+ let currentNode = node;
8242
+ let length = 0;
8243
+ let styleObjectParent = null;
8244
+ while (currentNode) {
8245
+ const keyName = currentNode?.key?.name;
8246
+ if (keyName && ["base", "variants"].includes(keyName)) {
8247
+ styleObjectParent = keyName;
8248
+ }
8249
+ currentNode = currentNode.parent;
8250
+ if (!styleObjectParent)
8251
+ length++;
8252
+ }
8253
+ const isCvaCaller = caller === "cva";
8254
+ const requiredLength = isCvaCaller ? 2 : 4;
8255
+ const extraLength = styleObjectParent === "base" ? 0 : 4;
8256
+ if (length < requiredLength + extraLength)
8257
+ return true;
8258
+ }
8234
8259
 
8235
8260
  // src/rules/file-not-included.ts
8236
8261
  var RULE_NAME = "file-not-included";
@@ -8384,6 +8409,8 @@ var rule3 = createRule({
8384
8409
  return;
8385
8410
  if (!isPandaAttribute(node, context))
8386
8411
  return;
8412
+ if (isRecipeVariant(node, context))
8413
+ return;
8387
8414
  context.report({
8388
8415
  node: node.key,
8389
8416
  messageId: "debug",
@@ -8533,6 +8560,8 @@ var rule5 = createRule({
8533
8560
  return;
8534
8561
  if (!isPandaAttribute(node, context))
8535
8562
  return;
8563
+ if (isRecipeVariant(node, context))
8564
+ return;
8536
8565
  handleLiteral(node.value);
8537
8566
  handleTemplateLiteral(node.value);
8538
8567
  }
@@ -8620,6 +8649,8 @@ var rule6 = createRule({
8620
8649
  return;
8621
8650
  if (!isPandaAttribute(node, context))
8622
8651
  return;
8652
+ if (isRecipeVariant(node, context))
8653
+ return;
8623
8654
  if (!isColorAttribute(node.key.name, context))
8624
8655
  return;
8625
8656
  if (isTokenFn(node.value.value?.toString()))
@@ -8729,6 +8760,8 @@ var rule7 = createRule({
8729
8760
  return;
8730
8761
  if (!isPandaAttribute(node, context))
8731
8762
  return;
8763
+ if (isRecipeVariant(node, context))
8764
+ return;
8732
8765
  handleLiteral(node.value);
8733
8766
  handleTemplateLiteral(node.value);
8734
8767
  }
@@ -8761,10 +8794,13 @@ var rule8 = createRule({
8761
8794
  const caller = isInPandaFunction(node, context);
8762
8795
  if (!caller && !isInJSXProp(node, context))
8763
8796
  return;
8797
+ if (isRecipeVariant(node, context))
8798
+ return;
8764
8799
  if (isStyledProperty(node, context))
8765
8800
  return;
8766
- const invalidNesting = isInvalidNesting(node, context, caller);
8767
- if (!invalidNesting)
8801
+ const invalidLiteral = isLiteral(node.key) && typeof node.key.value === "string" && !node.key.value.includes("&");
8802
+ const invalidTemplateLiteral = isTemplateLiteral(node.key) && !node.key.quasis[0].value.raw.includes("&");
8803
+ if (!(invalidLiteral || invalidTemplateLiteral))
8768
8804
  return;
8769
8805
  context.report({
8770
8806
  node: node.key,
@@ -8775,33 +8811,6 @@ var rule8 = createRule({
8775
8811
  }
8776
8812
  });
8777
8813
  var no_invalid_nesting_default = rule8;
8778
- function isInvalidNesting(node, context, caller) {
8779
- const recipe = getImports(context).find((imp) => ["cva", "sva"].includes(imp.name) && imp.alias === caller);
8780
- if (!recipe)
8781
- return checkNode(node);
8782
- let currentNode = node;
8783
- let length = 0;
8784
- let styleObjectParent = null;
8785
- while (currentNode) {
8786
- if (currentNode.key && ["base", "variants"].includes(currentNode.key.name)) {
8787
- styleObjectParent = currentNode.key.name;
8788
- }
8789
- currentNode = currentNode.parent;
8790
- if (!styleObjectParent)
8791
- length++;
8792
- }
8793
- const requiredLength = caller === "cva" ? 2 : 4;
8794
- const extraLength = styleObjectParent === "base" ? 0 : 4;
8795
- if (length >= requiredLength + extraLength) {
8796
- return checkNode(node);
8797
- }
8798
- return false;
8799
- }
8800
- function checkNode(node) {
8801
- const invalidLiteral = isLiteral(node.key) && typeof node.key.value === "string" && !node.key.value.includes("&");
8802
- const invalidTemplateLiteral = isTemplateLiteral(node.key) && !node.key.quasis[0].value.raw.includes("&");
8803
- return invalidLiteral || invalidTemplateLiteral;
8804
- }
8805
8814
 
8806
8815
  // src/rules/no-invalid-token-paths.ts
8807
8816
  init_cjs_shims();
@@ -8868,6 +8877,8 @@ var rule9 = createRule({
8868
8877
  return;
8869
8878
  if (!isPandaAttribute(node, context))
8870
8879
  return;
8880
+ if (isRecipeVariant(node, context))
8881
+ return;
8871
8882
  handleLiteral(node.value);
8872
8883
  handleTemplateLiteral(node.value);
8873
8884
  },
@@ -8942,6 +8953,8 @@ var rule10 = createRule({
8942
8953
  return;
8943
8954
  if (!isPandaAttribute(node, context))
8944
8955
  return;
8956
+ if (isRecipeVariant(node, context))
8957
+ return;
8945
8958
  sendReport(node.key);
8946
8959
  }
8947
8960
  };
@@ -9047,6 +9060,8 @@ var rule11 = createRule({
9047
9060
  return;
9048
9061
  if (!isPandaAttribute(node, context))
9049
9062
  return;
9063
+ if (isRecipeVariant(node, context))
9064
+ return;
9050
9065
  sendReport(node.key);
9051
9066
  }
9052
9067
  };
@@ -9108,6 +9123,8 @@ var rule12 = createRule({
9108
9123
  return;
9109
9124
  if (!isPandaAttribute(node, context))
9110
9125
  return;
9126
+ if (isRecipeVariant(node, context))
9127
+ return;
9111
9128
  const attr = node.key.name.toString();
9112
9129
  const value = node.value;
9113
9130
  handleReport(node, value, attr);
@@ -9214,6 +9231,8 @@ var rule13 = createRule({
9214
9231
  return;
9215
9232
  if (!isPandaAttribute(node, context))
9216
9233
  return;
9234
+ if (isRecipeVariant(node, context))
9235
+ return;
9217
9236
  handleRuntimeFm(node.value);
9218
9237
  handleLiteral(node.value);
9219
9238
  handleTemplateLiteral(node.value);
@@ -9278,6 +9297,8 @@ var rule14 = createRule({
9278
9297
  return;
9279
9298
  if (!isPandaAttribute(node, context))
9280
9299
  return;
9300
+ if (isRecipeVariant(node, context))
9301
+ return;
9281
9302
  sendReport(node.key);
9282
9303
  }
9283
9304
  };
@@ -9344,6 +9365,8 @@ var rule15 = createRule({
9344
9365
  return;
9345
9366
  if (!isPandaAttribute(node, context))
9346
9367
  return;
9368
+ if (isRecipeVariant(node, context))
9369
+ return;
9347
9370
  sendReport(node.key);
9348
9371
  }
9349
9372
  };
@@ -9518,6 +9541,8 @@ var rule16 = createRule({
9518
9541
  return;
9519
9542
  if (!isPandaAttribute(node, context))
9520
9543
  return;
9544
+ if (isRecipeVariant(node, context))
9545
+ return;
9521
9546
  sendReport(node.key);
9522
9547
  }
9523
9548
  };
@@ -9574,6 +9599,8 @@ var rule17 = createRule({
9574
9599
  return;
9575
9600
  if (!isPandaAttribute(node, context))
9576
9601
  return;
9602
+ if (isRecipeVariant(node, context))
9603
+ return;
9577
9604
  sendReport(node.key);
9578
9605
  }
9579
9606
  };
@@ -9641,6 +9668,8 @@ var rule18 = createRule({
9641
9668
  return;
9642
9669
  if (!isPandaAttribute(node, context))
9643
9670
  return;
9671
+ if (isRecipeVariant(node, context))
9672
+ return;
9644
9673
  const cmp = resolveCompositeProperty(node.key.name);
9645
9674
  if (!cmp)
9646
9675
  return;
package/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ var name, version;
10
10
  var init_package = __esm({
11
11
  "package.json"() {
12
12
  name = "@pandacss/eslint-plugin";
13
- version = "0.1.9";
13
+ version = "0.1.10";
14
14
  }
15
15
  });
16
16
 
@@ -7982,6 +7982,31 @@ var init_nodes = __esm({
7982
7982
  });
7983
7983
 
7984
7984
  // src/utils/helpers.ts
7985
+ function isRecipeVariant(node, context) {
7986
+ const caller = isInPandaFunction(node, context);
7987
+ if (!caller)
7988
+ return;
7989
+ const recipe = getImports(context).find((imp) => ["cva", "sva"].includes(imp.name) && imp.alias === caller);
7990
+ if (!recipe)
7991
+ return;
7992
+ let currentNode = node;
7993
+ let length = 0;
7994
+ let styleObjectParent = null;
7995
+ while (currentNode) {
7996
+ const keyName = currentNode?.key?.name;
7997
+ if (keyName && ["base", "variants"].includes(keyName)) {
7998
+ styleObjectParent = keyName;
7999
+ }
8000
+ currentNode = currentNode.parent;
8001
+ if (!styleObjectParent)
8002
+ length++;
8003
+ }
8004
+ const isCvaCaller = caller === "cva";
8005
+ const requiredLength = isCvaCaller ? 2 : 4;
8006
+ const extraLength = styleObjectParent === "base" ? 0 : 4;
8007
+ if (length < requiredLength + extraLength)
8008
+ return true;
8009
+ }
7985
8010
  var import_scope_manager, getAncestor, getSyncOpts, getImportSpecifiers, hasPkgImport, isPandaConfigFunction, _getImports, getImports, isValidStyledProp, isPandaIsh, findDeclaration, isLocalStyledFactory, isValidFile, isValidProperty, isPandaImport, isPandaProp, isStyledProperty, isInPandaFunction, isInJSXProp, isPandaAttribute, resolveLonghand, resolveShorthands, isColorAttribute, isColorToken, extractTokens, getInvalidTokens, getTokenImport, getTaggedTemplateCaller;
7986
8011
  var init_helpers = __esm({
7987
8012
  "src/utils/helpers.ts"() {
@@ -8387,6 +8412,8 @@ var init_no_debug = __esm({
8387
8412
  return;
8388
8413
  if (!isPandaAttribute(node, context))
8389
8414
  return;
8415
+ if (isRecipeVariant(node, context))
8416
+ return;
8390
8417
  context.report({
8391
8418
  node: node.key,
8392
8419
  messageId: "debug",
@@ -8554,6 +8581,8 @@ var init_no_escape_hatch = __esm({
8554
8581
  return;
8555
8582
  if (!isPandaAttribute(node, context))
8556
8583
  return;
8584
+ if (isRecipeVariant(node, context))
8585
+ return;
8557
8586
  handleLiteral(node.value);
8558
8587
  handleTemplateLiteral(node.value);
8559
8588
  }
@@ -8650,6 +8679,8 @@ var init_no_hardcoded_color = __esm({
8650
8679
  return;
8651
8680
  if (!isPandaAttribute(node, context))
8652
8681
  return;
8682
+ if (isRecipeVariant(node, context))
8683
+ return;
8653
8684
  if (!isColorAttribute(node.key.name, context))
8654
8685
  return;
8655
8686
  if (isTokenFn(node.value.value?.toString()))
@@ -8768,6 +8799,8 @@ var init_no_important = __esm({
8768
8799
  return;
8769
8800
  if (!isPandaAttribute(node, context))
8770
8801
  return;
8802
+ if (isRecipeVariant(node, context))
8803
+ return;
8771
8804
  handleLiteral(node.value);
8772
8805
  handleTemplateLiteral(node.value);
8773
8806
  }
@@ -8779,33 +8812,6 @@ var init_no_important = __esm({
8779
8812
  });
8780
8813
 
8781
8814
  // src/rules/no-invalid-nesting.ts
8782
- function isInvalidNesting(node, context, caller) {
8783
- const recipe = getImports(context).find((imp) => ["cva", "sva"].includes(imp.name) && imp.alias === caller);
8784
- if (!recipe)
8785
- return checkNode(node);
8786
- let currentNode = node;
8787
- let length = 0;
8788
- let styleObjectParent = null;
8789
- while (currentNode) {
8790
- if (currentNode.key && ["base", "variants"].includes(currentNode.key.name)) {
8791
- styleObjectParent = currentNode.key.name;
8792
- }
8793
- currentNode = currentNode.parent;
8794
- if (!styleObjectParent)
8795
- length++;
8796
- }
8797
- const requiredLength = caller === "cva" ? 2 : 4;
8798
- const extraLength = styleObjectParent === "base" ? 0 : 4;
8799
- if (length >= requiredLength + extraLength) {
8800
- return checkNode(node);
8801
- }
8802
- return false;
8803
- }
8804
- function checkNode(node) {
8805
- const invalidLiteral = isLiteral(node.key) && typeof node.key.value === "string" && !node.key.value.includes("&");
8806
- const invalidTemplateLiteral = isTemplateLiteral(node.key) && !node.key.quasis[0].value.raw.includes("&");
8807
- return invalidLiteral || invalidTemplateLiteral;
8808
- }
8809
8815
  var RULE_NAME8, rule8, no_invalid_nesting_default;
8810
8816
  var init_no_invalid_nesting = __esm({
8811
8817
  "src/rules/no-invalid-nesting.ts"() {
@@ -8836,10 +8842,13 @@ var init_no_invalid_nesting = __esm({
8836
8842
  const caller = isInPandaFunction(node, context);
8837
8843
  if (!caller && !isInJSXProp(node, context))
8838
8844
  return;
8845
+ if (isRecipeVariant(node, context))
8846
+ return;
8839
8847
  if (isStyledProperty(node, context))
8840
8848
  return;
8841
- const invalidNesting = isInvalidNesting(node, context, caller);
8842
- if (!invalidNesting)
8849
+ const invalidLiteral = isLiteral(node.key) && typeof node.key.value === "string" && !node.key.value.includes("&");
8850
+ const invalidTemplateLiteral = isTemplateLiteral(node.key) && !node.key.quasis[0].value.raw.includes("&");
8851
+ if (!(invalidLiteral || invalidTemplateLiteral))
8843
8852
  return;
8844
8853
  context.report({
8845
8854
  node: node.key,
@@ -8925,6 +8934,8 @@ var init_no_invalid_token_paths = __esm({
8925
8934
  return;
8926
8935
  if (!isPandaAttribute(node, context))
8927
8936
  return;
8937
+ if (isRecipeVariant(node, context))
8938
+ return;
8928
8939
  handleLiteral(node.value);
8929
8940
  handleTemplateLiteral(node.value);
8930
8941
  },
@@ -9008,6 +9019,8 @@ var init_no_margin_properties = __esm({
9008
9019
  return;
9009
9020
  if (!isPandaAttribute(node, context))
9010
9021
  return;
9022
+ if (isRecipeVariant(node, context))
9023
+ return;
9011
9024
  sendReport(node.key);
9012
9025
  }
9013
9026
  };
@@ -9127,6 +9140,8 @@ var init_no_physical_properties = __esm({
9127
9140
  return;
9128
9141
  if (!isPandaAttribute(node, context))
9129
9142
  return;
9143
+ if (isRecipeVariant(node, context))
9144
+ return;
9130
9145
  sendReport(node.key);
9131
9146
  }
9132
9147
  };
@@ -9197,6 +9212,8 @@ var init_no_property_renaming = __esm({
9197
9212
  return;
9198
9213
  if (!isPandaAttribute(node, context))
9199
9214
  return;
9215
+ if (isRecipeVariant(node, context))
9216
+ return;
9200
9217
  const attr = node.key.name.toString();
9201
9218
  const value = node.value;
9202
9219
  handleReport(node, value, attr);
@@ -9312,6 +9329,8 @@ var init_no_unsafe_token_fn_usage = __esm({
9312
9329
  return;
9313
9330
  if (!isPandaAttribute(node, context))
9314
9331
  return;
9332
+ if (isRecipeVariant(node, context))
9333
+ return;
9315
9334
  handleRuntimeFm(node.value);
9316
9335
  handleLiteral(node.value);
9317
9336
  handleTemplateLiteral(node.value);
@@ -9385,6 +9404,8 @@ var init_prefer_longhand_properties = __esm({
9385
9404
  return;
9386
9405
  if (!isPandaAttribute(node, context))
9387
9406
  return;
9407
+ if (isRecipeVariant(node, context))
9408
+ return;
9388
9409
  sendReport(node.key);
9389
9410
  }
9390
9411
  };
@@ -9460,6 +9481,8 @@ var init_prefer_shorthand_properties = __esm({
9460
9481
  return;
9461
9482
  if (!isPandaAttribute(node, context))
9462
9483
  return;
9484
+ if (isRecipeVariant(node, context))
9485
+ return;
9463
9486
  sendReport(node.key);
9464
9487
  }
9465
9488
  };
@@ -9648,6 +9671,8 @@ var init_prefer_atomic_properties = __esm({
9648
9671
  return;
9649
9672
  if (!isPandaAttribute(node, context))
9650
9673
  return;
9674
+ if (isRecipeVariant(node, context))
9675
+ return;
9651
9676
  sendReport(node.key);
9652
9677
  }
9653
9678
  };
@@ -9714,6 +9739,8 @@ var init_prefer_composite_properties = __esm({
9714
9739
  return;
9715
9740
  if (!isPandaAttribute(node, context))
9716
9741
  return;
9742
+ if (isRecipeVariant(node, context))
9743
+ return;
9717
9744
  sendReport(node.key);
9718
9745
  }
9719
9746
  };
@@ -9791,6 +9818,8 @@ var init_prefer_unified_property_style = __esm({
9791
9818
  return;
9792
9819
  if (!isPandaAttribute(node, context))
9793
9820
  return;
9821
+ if (isRecipeVariant(node, context))
9822
+ return;
9794
9823
  const cmp = resolveCompositeProperty(node.key.name);
9795
9824
  if (!cmp)
9796
9825
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/eslint-plugin",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Eslint plugin for Panda CSS",
5
5
  "author": "Abraham Aremu <anubra266@gmail.com>",
6
6
  "main": "dist/index.js",