@pandacss/eslint-plugin 0.0.0-dev-20240209020540 → 0.0.0-dev-20240209200922

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.
Files changed (3) hide show
  1. package/dist/index.js +237 -140
  2. package/dist/index.mjs +260 -153
  3. package/package.json +1 -1
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.0.0-dev-20240209020540";
7960
+ var version = "0.0.0-dev-20240209200922";
7961
7961
 
7962
7962
  // src/configs/all.ts
7963
7963
  init_cjs_shims();
@@ -8581,13 +8581,109 @@ var rule6 = createRule({
8581
8581
  });
8582
8582
  var no_hardcoded_color_default = rule6;
8583
8583
 
8584
- // src/rules/no-invalid-token-paths.ts
8584
+ // src/rules/no-important.ts
8585
8585
  init_cjs_shims();
8586
- var import_utils10 = require("@typescript-eslint/utils");
8587
- var import_ast_utils2 = require("@typescript-eslint/utils/ast-utils");
8588
- var RULE_NAME7 = "no-invalid-token-paths";
8586
+ var exclamationRegex = /\s*!$/;
8587
+ var importantRegex = /\s*!important\s*$/;
8588
+ var RULE_NAME7 = "no-important";
8589
8589
  var rule7 = createRule({
8590
8590
  name: RULE_NAME7,
8591
+ meta: {
8592
+ docs: {
8593
+ description: "Disallow usage of important keyword. Prioroitize specificity for a maintainable and predictable styling structure."
8594
+ },
8595
+ messages: {
8596
+ important: "Avoid using the !important keyword. Refactor your code to prioritize specificity for predictable styling.",
8597
+ remove: "Remove the `{{keyword}}` keyword."
8598
+ },
8599
+ type: "suggestion",
8600
+ hasSuggestions: true,
8601
+ schema: []
8602
+ },
8603
+ defaultOptions: [],
8604
+ create(context) {
8605
+ const removeQuotes = ([start, end]) => [start + 1, end - 1];
8606
+ const hasImportantKeyword = (value) => {
8607
+ if (!value)
8608
+ return false;
8609
+ return exclamationRegex.test(value) || importantRegex.test(value);
8610
+ };
8611
+ const removeImportantKeyword = (input) => {
8612
+ if (exclamationRegex.test(input)) {
8613
+ return { fixed: input.replace(exclamationRegex, ""), keyword: "!" };
8614
+ } else if (importantRegex.test(input)) {
8615
+ return { fixed: input.replace(importantRegex, ""), keyword: "!important" };
8616
+ } else {
8617
+ return { fixed: input, keyword: null };
8618
+ }
8619
+ };
8620
+ const handleLiteral = (node) => {
8621
+ if (!isLiteral(node))
8622
+ return;
8623
+ if (!hasImportantKeyword(node.value?.toString()))
8624
+ return;
8625
+ sendReport(node);
8626
+ };
8627
+ const handleTemplateLiteral = (node) => {
8628
+ if (!isTemplateLiteral(node))
8629
+ return;
8630
+ if (node.expressions.length > 0)
8631
+ return;
8632
+ if (!hasImportantKeyword(node.quasis[0].value.raw))
8633
+ return;
8634
+ sendReport(node.quasis[0], node.quasis[0].value.raw);
8635
+ };
8636
+ const sendReport = (node, _value) => {
8637
+ const value = _value ?? node.value?.toString();
8638
+ const { keyword, fixed } = removeImportantKeyword(value);
8639
+ return context.report({
8640
+ node,
8641
+ messageId: "important",
8642
+ suggest: [
8643
+ {
8644
+ messageId: "remove",
8645
+ data: { keyword },
8646
+ fix: (fixer) => {
8647
+ return fixer.replaceTextRange(removeQuotes(node.range), fixed);
8648
+ }
8649
+ }
8650
+ ]
8651
+ });
8652
+ };
8653
+ return {
8654
+ JSXAttribute(node) {
8655
+ if (!node.value)
8656
+ return;
8657
+ if (!isPandaProp(node, context))
8658
+ return;
8659
+ handleLiteral(node.value);
8660
+ if (!isJSXExpressionContainer(node.value))
8661
+ return;
8662
+ handleLiteral(node.value.expression);
8663
+ handleTemplateLiteral(node.value.expression);
8664
+ },
8665
+ Property(node) {
8666
+ if (!isIdentifier(node.key))
8667
+ return;
8668
+ if (!isLiteral(node.value) && !isTemplateLiteral(node.value))
8669
+ return;
8670
+ if (!isPandaAttribute(node, context))
8671
+ return;
8672
+ handleLiteral(node.value);
8673
+ handleTemplateLiteral(node.value);
8674
+ }
8675
+ };
8676
+ }
8677
+ });
8678
+ var no_important_default = rule7;
8679
+
8680
+ // src/rules/no-invalid-token-paths.ts
8681
+ init_cjs_shims();
8682
+ var import_utils11 = require("@typescript-eslint/utils");
8683
+ var import_ast_utils2 = require("@typescript-eslint/utils/ast-utils");
8684
+ var RULE_NAME8 = "no-invalid-token-paths";
8685
+ var rule8 = createRule({
8686
+ name: RULE_NAME8,
8591
8687
  meta: {
8592
8688
  docs: {
8593
8689
  description: "Disallow the use of invalid token paths within token function syntax."
@@ -8640,7 +8736,7 @@ var rule7 = createRule({
8640
8736
  Property(node) {
8641
8737
  if (!isIdentifier(node.key))
8642
8738
  return;
8643
- if (!(0, import_ast_utils2.isNodeOfTypes)([import_utils10.AST_NODE_TYPES.Literal, import_utils10.AST_NODE_TYPES.TemplateLiteral])(node.value))
8739
+ if (!(0, import_ast_utils2.isNodeOfTypes)([import_utils11.AST_NODE_TYPES.Literal, import_utils11.AST_NODE_TYPES.TemplateLiteral])(node.value))
8644
8740
  return;
8645
8741
  if (!isPandaAttribute(node, context))
8646
8742
  return;
@@ -8687,13 +8783,13 @@ var rule7 = createRule({
8687
8783
  };
8688
8784
  }
8689
8785
  });
8690
- var no_invalid_token_paths_default = rule7;
8786
+ var no_invalid_token_paths_default = rule8;
8691
8787
 
8692
8788
  // src/rules/no-property-renaming.ts
8693
8789
  init_cjs_shims();
8694
- var RULE_NAME8 = "no-property-renaming";
8695
- var rule8 = createRule({
8696
- name: RULE_NAME8,
8790
+ var RULE_NAME9 = "no-property-renaming";
8791
+ var rule9 = createRule({
8792
+ name: RULE_NAME9,
8697
8793
  meta: {
8698
8794
  docs: {
8699
8795
  description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
@@ -8752,20 +8848,21 @@ var rule8 = createRule({
8752
8848
  };
8753
8849
  }
8754
8850
  });
8755
- var no_property_renaming_default = rule8;
8851
+ var no_property_renaming_default = rule9;
8756
8852
 
8757
- // src/rules/prefer-longhand-properties.ts
8853
+ // src/rules/no-unsafe-token-fn-usage.ts
8758
8854
  init_cjs_shims();
8759
- var RULE_NAME9 = "prefer-longhand-properties";
8760
- var rule9 = createRule({
8761
- name: RULE_NAME9,
8855
+ var import_utils14 = require("@typescript-eslint/utils");
8856
+ var RULE_NAME10 = "no-unsafe-token-fn-usage";
8857
+ var rule10 = createRule({
8858
+ name: RULE_NAME10,
8762
8859
  meta: {
8763
8860
  docs: {
8764
- description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
8861
+ description: "Prevent users from using the token function in situations where they could simply use the raw design token."
8765
8862
  },
8766
8863
  messages: {
8767
- longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
8768
- replace: "Replace `{{shorthand}}` with `{{longhand}}`"
8864
+ noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
8865
+ replace: "Replace token function with `{{safe}}`"
8769
8866
  },
8770
8867
  type: "suggestion",
8771
8868
  hasSuggestions: true,
@@ -8773,22 +8870,57 @@ var rule9 = createRule({
8773
8870
  },
8774
8871
  defaultOptions: [],
8775
8872
  create(context) {
8776
- const sendReport = (node, name2) => {
8777
- const longhand = resolveLonghand(name2, context);
8778
- const data = {
8779
- shorthand: name2,
8780
- longhand
8781
- };
8873
+ const isUnsafeCallExpression = (node) => {
8874
+ const tkImport = getTokenImport(context);
8875
+ return isIdentifier(node.callee) && node.callee.name === tkImport?.alias;
8876
+ };
8877
+ const tokenWrap = (value) => value ? `token(${value})` : "";
8878
+ const handleRuntimeFm = (node) => {
8879
+ if (!isCallExpression(node))
8880
+ return;
8881
+ if (!isUnsafeCallExpression(node))
8882
+ return;
8883
+ const value = node.arguments[0];
8884
+ if (isLiteral(value)) {
8885
+ sendReport(node, tokenWrap(value.value?.toString()));
8886
+ }
8887
+ if (isTemplateLiteral(value)) {
8888
+ sendReport(node, tokenWrap(value.quasis[0].value.raw));
8889
+ }
8890
+ };
8891
+ const isCompositeValue = (input) => {
8892
+ if (!input)
8893
+ return;
8894
+ const tokenRegex = /^(?:token\([^)]*\)|\{[^}]*\})$/;
8895
+ return !tokenRegex.test(input);
8896
+ };
8897
+ const handleLiteral = (node) => {
8898
+ if (!isLiteral(node))
8899
+ return;
8900
+ if (isCompositeValue(node.value?.toString()))
8901
+ return;
8902
+ sendReport(node);
8903
+ };
8904
+ const handleTemplateLiteral = (node) => {
8905
+ if (!isTemplateLiteral(node))
8906
+ return;
8907
+ if (node.expressions.length > 0)
8908
+ return;
8909
+ sendReport(node, node.quasis[0].value.raw);
8910
+ };
8911
+ const sendReport = (node, _value) => {
8912
+ const value = _value ?? node.value?.toString();
8913
+ const tkImports = extractTokens(value);
8914
+ const token = tkImports[0].replace(/^[^.]*\./, "");
8782
8915
  return context.report({
8783
8916
  node,
8784
- messageId: "longhand",
8785
- data,
8917
+ messageId: "noUnsafeTokenFnUsage",
8786
8918
  suggest: [
8787
8919
  {
8788
8920
  messageId: "replace",
8789
- data,
8921
+ data: { safe: token },
8790
8922
  fix: (fixer) => {
8791
- return fixer.replaceTextRange(node.range, longhand);
8923
+ return fixer.replaceTextRange(node.range, `'${token}'`);
8792
8924
  }
8793
8925
  }
8794
8926
  ]
@@ -8796,42 +8928,43 @@ var rule9 = createRule({
8796
8928
  };
8797
8929
  return {
8798
8930
  JSXAttribute(node) {
8799
- if (!isJSXIdentifier(node.name))
8931
+ if (!node.value)
8800
8932
  return;
8801
8933
  if (!isPandaProp(node, context))
8802
8934
  return;
8803
- const longhand = resolveLonghand(node.name.name, context);
8804
- if (!longhand)
8935
+ handleLiteral(node.value);
8936
+ if (!isJSXExpressionContainer(node.value))
8805
8937
  return;
8806
- sendReport(node.name, node.name.name);
8938
+ handleLiteral(node.value.expression);
8939
+ handleTemplateLiteral(node.value.expression);
8940
+ handleRuntimeFm(node.value.expression);
8807
8941
  },
8808
8942
  Property(node) {
8809
- if (!isIdentifier(node.key))
8943
+ if (!isCallExpression(node.value) && !isLiteral(node.value) && !isTemplateLiteral(node.value))
8810
8944
  return;
8811
8945
  if (!isPandaAttribute(node, context))
8812
8946
  return;
8813
- const longhand = resolveLonghand(node.key.name, context);
8814
- if (!longhand)
8815
- return;
8816
- sendReport(node.key, node.key.name);
8947
+ handleRuntimeFm(node.value);
8948
+ handleLiteral(node.value);
8949
+ handleTemplateLiteral(node.value);
8817
8950
  }
8818
8951
  };
8819
8952
  }
8820
8953
  });
8821
- var prefer_longhand_properties_default = rule9;
8954
+ var no_unsafe_token_fn_usage_default = rule10;
8822
8955
 
8823
- // src/rules/prefer-shorthand-properties.ts
8956
+ // src/rules/prefer-longhand-properties.ts
8824
8957
  init_cjs_shims();
8825
- var RULE_NAME10 = "prefer-shorthand-properties";
8826
- var rule10 = createRule({
8827
- name: RULE_NAME10,
8958
+ var RULE_NAME11 = "prefer-longhand-properties";
8959
+ var rule11 = createRule({
8960
+ name: RULE_NAME11,
8828
8961
  meta: {
8829
8962
  docs: {
8830
- description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
8963
+ description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
8831
8964
  },
8832
8965
  messages: {
8833
- shorthand: "Use shorthand property of `{{longhand}}` instead. Prefer {{shorthand}}",
8834
- replace: "Replace `{{longhand}}` with `{{shorthand}}`"
8966
+ longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
8967
+ replace: "Replace `{{shorthand}}` with `{{longhand}}`"
8835
8968
  },
8836
8969
  type: "suggestion",
8837
8970
  hasSuggestions: true,
@@ -8840,24 +8973,21 @@ var rule10 = createRule({
8840
8973
  defaultOptions: [],
8841
8974
  create(context) {
8842
8975
  const sendReport = (node, name2) => {
8843
- const shorthands = resolveShorthands(name2, context);
8844
- if (!shorthands)
8845
- return;
8846
- const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
8976
+ const longhand = resolveLonghand(name2, context);
8847
8977
  const data = {
8848
- longhand: name2,
8849
- shorthand
8978
+ shorthand: name2,
8979
+ longhand
8850
8980
  };
8851
8981
  return context.report({
8852
8982
  node,
8853
- messageId: "shorthand",
8983
+ messageId: "longhand",
8854
8984
  data,
8855
8985
  suggest: [
8856
8986
  {
8857
8987
  messageId: "replace",
8858
8988
  data,
8859
8989
  fix: (fixer) => {
8860
- return fixer.replaceTextRange(node.range, shorthands[0]);
8990
+ return fixer.replaceTextRange(node.range, longhand);
8861
8991
  }
8862
8992
  }
8863
8993
  ]
@@ -8870,7 +9000,7 @@ var rule10 = createRule({
8870
9000
  if (!isPandaProp(node, context))
8871
9001
  return;
8872
9002
  const longhand = resolveLonghand(node.name.name, context);
8873
- if (longhand)
9003
+ if (!longhand)
8874
9004
  return;
8875
9005
  sendReport(node.name, node.name.name);
8876
9006
  },
@@ -8880,28 +9010,27 @@ var rule10 = createRule({
8880
9010
  if (!isPandaAttribute(node, context))
8881
9011
  return;
8882
9012
  const longhand = resolveLonghand(node.key.name, context);
8883
- if (longhand)
9013
+ if (!longhand)
8884
9014
  return;
8885
9015
  sendReport(node.key, node.key.name);
8886
9016
  }
8887
9017
  };
8888
9018
  }
8889
9019
  });
8890
- var prefer_shorthand_properties_default = rule10;
9020
+ var prefer_longhand_properties_default = rule11;
8891
9021
 
8892
- // src/rules/no-unsafe-token-fn-usage.ts
9022
+ // src/rules/prefer-shorthand-properties.ts
8893
9023
  init_cjs_shims();
8894
- var import_utils15 = require("@typescript-eslint/utils");
8895
- var RULE_NAME11 = "no-unsafe-token-fn-usage";
8896
- var rule11 = createRule({
8897
- name: RULE_NAME11,
9024
+ var RULE_NAME12 = "prefer-shorthand-properties";
9025
+ var rule12 = createRule({
9026
+ name: RULE_NAME12,
8898
9027
  meta: {
8899
9028
  docs: {
8900
- description: "Prevent users from using the token function in situations where they could simply use the raw design token."
9029
+ description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
8901
9030
  },
8902
9031
  messages: {
8903
- noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
8904
- replace: "Replace token function with `{{safe}}`"
9032
+ shorthand: "Use shorthand property of `{{longhand}}` instead. Prefer {{shorthand}}",
9033
+ replace: "Replace `{{longhand}}` with `{{shorthand}}`"
8905
9034
  },
8906
9035
  type: "suggestion",
8907
9036
  hasSuggestions: true,
@@ -8909,57 +9038,25 @@ var rule11 = createRule({
8909
9038
  },
8910
9039
  defaultOptions: [],
8911
9040
  create(context) {
8912
- const isUnsafeCallExpression = (node) => {
8913
- const tkImport = getTokenImport(context);
8914
- return isIdentifier(node.callee) && node.callee.name === tkImport?.alias;
8915
- };
8916
- const tokenWrap = (value) => value ? `token(${value})` : "";
8917
- const handleRuntimeFm = (node) => {
8918
- if (!isCallExpression(node))
8919
- return;
8920
- if (!isUnsafeCallExpression(node))
8921
- return;
8922
- const value = node.arguments[0];
8923
- if (isLiteral(value)) {
8924
- sendReport(node, tokenWrap(value.value?.toString()));
8925
- }
8926
- if (isTemplateLiteral(value)) {
8927
- sendReport(node, tokenWrap(value.quasis[0].value.raw));
8928
- }
8929
- };
8930
- const isCompositeValue = (input) => {
8931
- if (!input)
8932
- return;
8933
- const tokenRegex = /^(?:token\([^)]*\)|\{[^}]*\})$/;
8934
- return !tokenRegex.test(input);
8935
- };
8936
- const handleLiteral = (node) => {
8937
- if (!isLiteral(node))
8938
- return;
8939
- if (isCompositeValue(node.value?.toString()))
8940
- return;
8941
- sendReport(node);
8942
- };
8943
- const handleTemplateLiteral = (node) => {
8944
- if (!isTemplateLiteral(node))
8945
- return;
8946
- if (node.expressions.length > 0)
9041
+ const sendReport = (node, name2) => {
9042
+ const shorthands = resolveShorthands(name2, context);
9043
+ if (!shorthands)
8947
9044
  return;
8948
- sendReport(node, node.quasis[0].value.raw);
8949
- };
8950
- const sendReport = (node, _value) => {
8951
- const value = _value ?? node.value?.toString();
8952
- const tkImports = extractTokens(value);
8953
- const token = tkImports[0].replace(/^[^.]*\./, "");
9045
+ const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
9046
+ const data = {
9047
+ longhand: name2,
9048
+ shorthand
9049
+ };
8954
9050
  return context.report({
8955
9051
  node,
8956
- messageId: "noUnsafeTokenFnUsage",
9052
+ messageId: "shorthand",
9053
+ data,
8957
9054
  suggest: [
8958
9055
  {
8959
9056
  messageId: "replace",
8960
- data: { safe: token },
9057
+ data,
8961
9058
  fix: (fixer) => {
8962
- return fixer.replaceTextRange(node.range, `'${token}'`);
9059
+ return fixer.replaceTextRange(node.range, shorthands[0]);
8963
9060
  }
8964
9061
  }
8965
9062
  ]
@@ -8967,30 +9064,29 @@ var rule11 = createRule({
8967
9064
  };
8968
9065
  return {
8969
9066
  JSXAttribute(node) {
8970
- if (!node.value)
9067
+ if (!isJSXIdentifier(node.name))
8971
9068
  return;
8972
9069
  if (!isPandaProp(node, context))
8973
9070
  return;
8974
- handleLiteral(node.value);
8975
- if (!isJSXExpressionContainer(node.value))
9071
+ const longhand = resolveLonghand(node.name.name, context);
9072
+ if (longhand)
8976
9073
  return;
8977
- handleLiteral(node.value.expression);
8978
- handleTemplateLiteral(node.value.expression);
8979
- handleRuntimeFm(node.value.expression);
9074
+ sendReport(node.name, node.name.name);
8980
9075
  },
8981
9076
  Property(node) {
8982
- if (!isCallExpression(node.value) && !isLiteral(node.value) && !isTemplateLiteral(node.value))
9077
+ if (!isIdentifier(node.key))
8983
9078
  return;
8984
9079
  if (!isPandaAttribute(node, context))
8985
9080
  return;
8986
- handleRuntimeFm(node.value);
8987
- handleLiteral(node.value);
8988
- handleTemplateLiteral(node.value);
9081
+ const longhand = resolveLonghand(node.key.name, context);
9082
+ if (longhand)
9083
+ return;
9084
+ sendReport(node.key, node.key.name);
8989
9085
  }
8990
9086
  };
8991
9087
  }
8992
9088
  });
8993
- var no_unsafe_token_fn_usage_default = rule11;
9089
+ var prefer_shorthand_properties_default = rule12;
8994
9090
 
8995
9091
  // src/rules/prefer-atomic-properties.ts
8996
9092
  init_cjs_shims();
@@ -9110,9 +9206,9 @@ var compositeProperties = {
9110
9206
  };
9111
9207
 
9112
9208
  // src/rules/prefer-atomic-properties.ts
9113
- var RULE_NAME12 = "prefer-atomic-properties";
9114
- var rule12 = createRule({
9115
- name: RULE_NAME12,
9209
+ var RULE_NAME13 = "prefer-atomic-properties";
9210
+ var rule13 = createRule({
9211
+ name: RULE_NAME13,
9116
9212
  meta: {
9117
9213
  docs: {
9118
9214
  description: "Encourage the use of atomic properties instead of composite properties in the codebase."
@@ -9168,13 +9264,13 @@ var rule12 = createRule({
9168
9264
  };
9169
9265
  }
9170
9266
  });
9171
- var prefer_atomic_properties_default = rule12;
9267
+ var prefer_atomic_properties_default = rule13;
9172
9268
 
9173
9269
  // src/rules/prefer-composite-properties.ts
9174
9270
  init_cjs_shims();
9175
- var RULE_NAME13 = "prefer-composite-properties";
9176
- var rule13 = createRule({
9177
- name: RULE_NAME13,
9271
+ var RULE_NAME14 = "prefer-composite-properties";
9272
+ var rule14 = createRule({
9273
+ name: RULE_NAME14,
9178
9274
  meta: {
9179
9275
  docs: {
9180
9276
  description: "Encourage the use of composite properties instead of atomic properties in the codebase."
@@ -9228,13 +9324,13 @@ var rule13 = createRule({
9228
9324
  };
9229
9325
  }
9230
9326
  });
9231
- var prefer_composite_properties_default = rule13;
9327
+ var prefer_composite_properties_default = rule14;
9232
9328
 
9233
9329
  // src/rules/prefer-unified-property-style.ts
9234
9330
  init_cjs_shims();
9235
- var RULE_NAME14 = "prefer-unified-property-style";
9236
- var rule14 = createRule({
9237
- name: RULE_NAME14,
9331
+ var RULE_NAME15 = "prefer-unified-property-style";
9332
+ var rule15 = createRule({
9333
+ name: RULE_NAME15,
9238
9334
  meta: {
9239
9335
  docs: {
9240
9336
  description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
@@ -9301,7 +9397,7 @@ var rule14 = createRule({
9301
9397
  };
9302
9398
  }
9303
9399
  });
9304
- var prefer_unified_property_style_default = rule14;
9400
+ var prefer_unified_property_style_default = rule15;
9305
9401
 
9306
9402
  // src/rules/index.ts
9307
9403
  var rules = {
@@ -9311,18 +9407,19 @@ var rules = {
9311
9407
  [RULE_NAME4]: no_dynamic_styling_default,
9312
9408
  [RULE_NAME5]: no_escape_hatch_default,
9313
9409
  [RULE_NAME6]: no_hardcoded_color_default,
9314
- [RULE_NAME7]: no_invalid_token_paths_default,
9315
- [RULE_NAME8]: no_property_renaming_default,
9316
- [RULE_NAME9]: prefer_longhand_properties_default,
9317
- [RULE_NAME10]: prefer_shorthand_properties_default,
9318
- [RULE_NAME11]: no_unsafe_token_fn_usage_default,
9319
- [RULE_NAME12]: prefer_atomic_properties_default,
9320
- [RULE_NAME13]: prefer_composite_properties_default,
9321
- [RULE_NAME14]: prefer_unified_property_style_default
9410
+ [RULE_NAME7]: no_important_default,
9411
+ [RULE_NAME8]: no_invalid_token_paths_default,
9412
+ [RULE_NAME9]: no_property_renaming_default,
9413
+ [RULE_NAME10]: no_unsafe_token_fn_usage_default,
9414
+ [RULE_NAME11]: prefer_longhand_properties_default,
9415
+ [RULE_NAME12]: prefer_shorthand_properties_default,
9416
+ [RULE_NAME13]: prefer_atomic_properties_default,
9417
+ [RULE_NAME14]: prefer_composite_properties_default,
9418
+ [RULE_NAME15]: prefer_unified_property_style_default
9322
9419
  };
9323
9420
 
9324
9421
  // src/configs/all.ts
9325
- var errorRules = [RULE_NAME, RULE_NAME2, RULE_NAME7];
9422
+ var errorRules = [RULE_NAME, RULE_NAME2, RULE_NAME8];
9326
9423
  var allRules = Object.fromEntries(
9327
9424
  Object.entries(rules).map(([name2]) => {
9328
9425
  return [`@pandacss/${name2}`, errorRules.includes(name2) ? "error" : "warn"];
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.0.0-dev-20240209020540";
13
+ version = "0.0.0-dev-20240209200922";
14
14
  }
15
15
  });
16
16
 
@@ -8613,10 +8613,115 @@ var init_no_hardcoded_color = __esm({
8613
8613
  }
8614
8614
  });
8615
8615
 
8616
+ // src/rules/no-important.ts
8617
+ var exclamationRegex, importantRegex, RULE_NAME7, rule7, no_important_default;
8618
+ var init_no_important = __esm({
8619
+ "src/rules/no-important.ts"() {
8620
+ "use strict";
8621
+ init_esm_shims();
8622
+ init_helpers();
8623
+ init_utils();
8624
+ init_nodes();
8625
+ exclamationRegex = /\s*!$/;
8626
+ importantRegex = /\s*!important\s*$/;
8627
+ RULE_NAME7 = "no-important";
8628
+ rule7 = createRule({
8629
+ name: RULE_NAME7,
8630
+ meta: {
8631
+ docs: {
8632
+ description: "Disallow usage of important keyword. Prioroitize specificity for a maintainable and predictable styling structure."
8633
+ },
8634
+ messages: {
8635
+ important: "Avoid using the !important keyword. Refactor your code to prioritize specificity for predictable styling.",
8636
+ remove: "Remove the `{{keyword}}` keyword."
8637
+ },
8638
+ type: "suggestion",
8639
+ hasSuggestions: true,
8640
+ schema: []
8641
+ },
8642
+ defaultOptions: [],
8643
+ create(context) {
8644
+ const removeQuotes = ([start, end]) => [start + 1, end - 1];
8645
+ const hasImportantKeyword = (value) => {
8646
+ if (!value)
8647
+ return false;
8648
+ return exclamationRegex.test(value) || importantRegex.test(value);
8649
+ };
8650
+ const removeImportantKeyword = (input) => {
8651
+ if (exclamationRegex.test(input)) {
8652
+ return { fixed: input.replace(exclamationRegex, ""), keyword: "!" };
8653
+ } else if (importantRegex.test(input)) {
8654
+ return { fixed: input.replace(importantRegex, ""), keyword: "!important" };
8655
+ } else {
8656
+ return { fixed: input, keyword: null };
8657
+ }
8658
+ };
8659
+ const handleLiteral = (node) => {
8660
+ if (!isLiteral(node))
8661
+ return;
8662
+ if (!hasImportantKeyword(node.value?.toString()))
8663
+ return;
8664
+ sendReport(node);
8665
+ };
8666
+ const handleTemplateLiteral = (node) => {
8667
+ if (!isTemplateLiteral(node))
8668
+ return;
8669
+ if (node.expressions.length > 0)
8670
+ return;
8671
+ if (!hasImportantKeyword(node.quasis[0].value.raw))
8672
+ return;
8673
+ sendReport(node.quasis[0], node.quasis[0].value.raw);
8674
+ };
8675
+ const sendReport = (node, _value) => {
8676
+ const value = _value ?? node.value?.toString();
8677
+ const { keyword, fixed } = removeImportantKeyword(value);
8678
+ return context.report({
8679
+ node,
8680
+ messageId: "important",
8681
+ suggest: [
8682
+ {
8683
+ messageId: "remove",
8684
+ data: { keyword },
8685
+ fix: (fixer) => {
8686
+ return fixer.replaceTextRange(removeQuotes(node.range), fixed);
8687
+ }
8688
+ }
8689
+ ]
8690
+ });
8691
+ };
8692
+ return {
8693
+ JSXAttribute(node) {
8694
+ if (!node.value)
8695
+ return;
8696
+ if (!isPandaProp(node, context))
8697
+ return;
8698
+ handleLiteral(node.value);
8699
+ if (!isJSXExpressionContainer(node.value))
8700
+ return;
8701
+ handleLiteral(node.value.expression);
8702
+ handleTemplateLiteral(node.value.expression);
8703
+ },
8704
+ Property(node) {
8705
+ if (!isIdentifier(node.key))
8706
+ return;
8707
+ if (!isLiteral(node.value) && !isTemplateLiteral(node.value))
8708
+ return;
8709
+ if (!isPandaAttribute(node, context))
8710
+ return;
8711
+ handleLiteral(node.value);
8712
+ handleTemplateLiteral(node.value);
8713
+ }
8714
+ };
8715
+ }
8716
+ });
8717
+ no_important_default = rule7;
8718
+ }
8719
+ });
8720
+
8616
8721
  // src/rules/no-invalid-token-paths.ts
8617
8722
  import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
8618
8723
  import { isNodeOfTypes } from "@typescript-eslint/utils/ast-utils";
8619
- var RULE_NAME7, rule7, no_invalid_token_paths_default;
8724
+ var RULE_NAME8, rule8, no_invalid_token_paths_default;
8620
8725
  var init_no_invalid_token_paths = __esm({
8621
8726
  "src/rules/no-invalid-token-paths.ts"() {
8622
8727
  "use strict";
@@ -8624,9 +8729,9 @@ var init_no_invalid_token_paths = __esm({
8624
8729
  init_helpers();
8625
8730
  init_utils();
8626
8731
  init_nodes();
8627
- RULE_NAME7 = "no-invalid-token-paths";
8628
- rule7 = createRule({
8629
- name: RULE_NAME7,
8732
+ RULE_NAME8 = "no-invalid-token-paths";
8733
+ rule8 = createRule({
8734
+ name: RULE_NAME8,
8630
8735
  meta: {
8631
8736
  docs: {
8632
8737
  description: "Disallow the use of invalid token paths within token function syntax."
@@ -8726,12 +8831,12 @@ var init_no_invalid_token_paths = __esm({
8726
8831
  };
8727
8832
  }
8728
8833
  });
8729
- no_invalid_token_paths_default = rule7;
8834
+ no_invalid_token_paths_default = rule8;
8730
8835
  }
8731
8836
  });
8732
8837
 
8733
8838
  // src/rules/no-property-renaming.ts
8734
- var RULE_NAME8, rule8, no_property_renaming_default;
8839
+ var RULE_NAME9, rule9, no_property_renaming_default;
8735
8840
  var init_no_property_renaming = __esm({
8736
8841
  "src/rules/no-property-renaming.ts"() {
8737
8842
  "use strict";
@@ -8739,9 +8844,9 @@ var init_no_property_renaming = __esm({
8739
8844
  init_utils();
8740
8845
  init_helpers();
8741
8846
  init_nodes();
8742
- RULE_NAME8 = "no-property-renaming";
8743
- rule8 = createRule({
8744
- name: RULE_NAME8,
8847
+ RULE_NAME9 = "no-property-renaming";
8848
+ rule9 = createRule({
8849
+ name: RULE_NAME9,
8745
8850
  meta: {
8746
8851
  docs: {
8747
8852
  description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
@@ -8800,29 +8905,30 @@ var init_no_property_renaming = __esm({
8800
8905
  };
8801
8906
  }
8802
8907
  });
8803
- no_property_renaming_default = rule8;
8908
+ no_property_renaming_default = rule9;
8804
8909
  }
8805
8910
  });
8806
8911
 
8807
- // src/rules/prefer-longhand-properties.ts
8808
- var RULE_NAME9, rule9, prefer_longhand_properties_default;
8809
- var init_prefer_longhand_properties = __esm({
8810
- "src/rules/prefer-longhand-properties.ts"() {
8912
+ // src/rules/no-unsafe-token-fn-usage.ts
8913
+ import "@typescript-eslint/utils";
8914
+ var RULE_NAME10, rule10, no_unsafe_token_fn_usage_default;
8915
+ var init_no_unsafe_token_fn_usage = __esm({
8916
+ "src/rules/no-unsafe-token-fn-usage.ts"() {
8811
8917
  "use strict";
8812
8918
  init_esm_shims();
8813
8919
  init_helpers();
8814
8920
  init_utils();
8815
8921
  init_nodes();
8816
- RULE_NAME9 = "prefer-longhand-properties";
8817
- rule9 = createRule({
8818
- name: RULE_NAME9,
8922
+ RULE_NAME10 = "no-unsafe-token-fn-usage";
8923
+ rule10 = createRule({
8924
+ name: RULE_NAME10,
8819
8925
  meta: {
8820
8926
  docs: {
8821
- description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
8927
+ description: "Prevent users from using the token function in situations where they could simply use the raw design token."
8822
8928
  },
8823
8929
  messages: {
8824
- longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
8825
- replace: "Replace `{{shorthand}}` with `{{longhand}}`"
8930
+ noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
8931
+ replace: "Replace token function with `{{safe}}`"
8826
8932
  },
8827
8933
  type: "suggestion",
8828
8934
  hasSuggestions: true,
@@ -8830,22 +8936,57 @@ var init_prefer_longhand_properties = __esm({
8830
8936
  },
8831
8937
  defaultOptions: [],
8832
8938
  create(context) {
8833
- const sendReport = (node, name2) => {
8834
- const longhand = resolveLonghand(name2, context);
8835
- const data = {
8836
- shorthand: name2,
8837
- longhand
8838
- };
8939
+ const isUnsafeCallExpression = (node) => {
8940
+ const tkImport = getTokenImport(context);
8941
+ return isIdentifier(node.callee) && node.callee.name === tkImport?.alias;
8942
+ };
8943
+ const tokenWrap = (value) => value ? `token(${value})` : "";
8944
+ const handleRuntimeFm = (node) => {
8945
+ if (!isCallExpression(node))
8946
+ return;
8947
+ if (!isUnsafeCallExpression(node))
8948
+ return;
8949
+ const value = node.arguments[0];
8950
+ if (isLiteral(value)) {
8951
+ sendReport(node, tokenWrap(value.value?.toString()));
8952
+ }
8953
+ if (isTemplateLiteral(value)) {
8954
+ sendReport(node, tokenWrap(value.quasis[0].value.raw));
8955
+ }
8956
+ };
8957
+ const isCompositeValue = (input) => {
8958
+ if (!input)
8959
+ return;
8960
+ const tokenRegex = /^(?:token\([^)]*\)|\{[^}]*\})$/;
8961
+ return !tokenRegex.test(input);
8962
+ };
8963
+ const handleLiteral = (node) => {
8964
+ if (!isLiteral(node))
8965
+ return;
8966
+ if (isCompositeValue(node.value?.toString()))
8967
+ return;
8968
+ sendReport(node);
8969
+ };
8970
+ const handleTemplateLiteral = (node) => {
8971
+ if (!isTemplateLiteral(node))
8972
+ return;
8973
+ if (node.expressions.length > 0)
8974
+ return;
8975
+ sendReport(node, node.quasis[0].value.raw);
8976
+ };
8977
+ const sendReport = (node, _value) => {
8978
+ const value = _value ?? node.value?.toString();
8979
+ const tkImports = extractTokens(value);
8980
+ const token = tkImports[0].replace(/^[^.]*\./, "");
8839
8981
  return context.report({
8840
8982
  node,
8841
- messageId: "longhand",
8842
- data,
8983
+ messageId: "noUnsafeTokenFnUsage",
8843
8984
  suggest: [
8844
8985
  {
8845
8986
  messageId: "replace",
8846
- data,
8987
+ data: { safe: token },
8847
8988
  fix: (fixer) => {
8848
- return fixer.replaceTextRange(node.range, longhand);
8989
+ return fixer.replaceTextRange(node.range, `'${token}'`);
8849
8990
  }
8850
8991
  }
8851
8992
  ]
@@ -8853,51 +8994,52 @@ var init_prefer_longhand_properties = __esm({
8853
8994
  };
8854
8995
  return {
8855
8996
  JSXAttribute(node) {
8856
- if (!isJSXIdentifier(node.name))
8997
+ if (!node.value)
8857
8998
  return;
8858
8999
  if (!isPandaProp(node, context))
8859
9000
  return;
8860
- const longhand = resolveLonghand(node.name.name, context);
8861
- if (!longhand)
9001
+ handleLiteral(node.value);
9002
+ if (!isJSXExpressionContainer(node.value))
8862
9003
  return;
8863
- sendReport(node.name, node.name.name);
9004
+ handleLiteral(node.value.expression);
9005
+ handleTemplateLiteral(node.value.expression);
9006
+ handleRuntimeFm(node.value.expression);
8864
9007
  },
8865
9008
  Property(node) {
8866
- if (!isIdentifier(node.key))
9009
+ if (!isCallExpression(node.value) && !isLiteral(node.value) && !isTemplateLiteral(node.value))
8867
9010
  return;
8868
9011
  if (!isPandaAttribute(node, context))
8869
9012
  return;
8870
- const longhand = resolveLonghand(node.key.name, context);
8871
- if (!longhand)
8872
- return;
8873
- sendReport(node.key, node.key.name);
9013
+ handleRuntimeFm(node.value);
9014
+ handleLiteral(node.value);
9015
+ handleTemplateLiteral(node.value);
8874
9016
  }
8875
9017
  };
8876
9018
  }
8877
9019
  });
8878
- prefer_longhand_properties_default = rule9;
9020
+ no_unsafe_token_fn_usage_default = rule10;
8879
9021
  }
8880
9022
  });
8881
9023
 
8882
- // src/rules/prefer-shorthand-properties.ts
8883
- var RULE_NAME10, rule10, prefer_shorthand_properties_default;
8884
- var init_prefer_shorthand_properties = __esm({
8885
- "src/rules/prefer-shorthand-properties.ts"() {
9024
+ // src/rules/prefer-longhand-properties.ts
9025
+ var RULE_NAME11, rule11, prefer_longhand_properties_default;
9026
+ var init_prefer_longhand_properties = __esm({
9027
+ "src/rules/prefer-longhand-properties.ts"() {
8886
9028
  "use strict";
8887
9029
  init_esm_shims();
8888
9030
  init_helpers();
8889
9031
  init_utils();
8890
9032
  init_nodes();
8891
- RULE_NAME10 = "prefer-shorthand-properties";
8892
- rule10 = createRule({
8893
- name: RULE_NAME10,
9033
+ RULE_NAME11 = "prefer-longhand-properties";
9034
+ rule11 = createRule({
9035
+ name: RULE_NAME11,
8894
9036
  meta: {
8895
9037
  docs: {
8896
- description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
9038
+ description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
8897
9039
  },
8898
9040
  messages: {
8899
- shorthand: "Use shorthand property of `{{longhand}}` instead. Prefer {{shorthand}}",
8900
- replace: "Replace `{{longhand}}` with `{{shorthand}}`"
9041
+ longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
9042
+ replace: "Replace `{{shorthand}}` with `{{longhand}}`"
8901
9043
  },
8902
9044
  type: "suggestion",
8903
9045
  hasSuggestions: true,
@@ -8906,24 +9048,21 @@ var init_prefer_shorthand_properties = __esm({
8906
9048
  defaultOptions: [],
8907
9049
  create(context) {
8908
9050
  const sendReport = (node, name2) => {
8909
- const shorthands = resolveShorthands(name2, context);
8910
- if (!shorthands)
8911
- return;
8912
- const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
9051
+ const longhand = resolveLonghand(name2, context);
8913
9052
  const data = {
8914
- longhand: name2,
8915
- shorthand
9053
+ shorthand: name2,
9054
+ longhand
8916
9055
  };
8917
9056
  return context.report({
8918
9057
  node,
8919
- messageId: "shorthand",
9058
+ messageId: "longhand",
8920
9059
  data,
8921
9060
  suggest: [
8922
9061
  {
8923
9062
  messageId: "replace",
8924
9063
  data,
8925
9064
  fix: (fixer) => {
8926
- return fixer.replaceTextRange(node.range, shorthands[0]);
9065
+ return fixer.replaceTextRange(node.range, longhand);
8927
9066
  }
8928
9067
  }
8929
9068
  ]
@@ -8936,7 +9075,7 @@ var init_prefer_shorthand_properties = __esm({
8936
9075
  if (!isPandaProp(node, context))
8937
9076
  return;
8938
9077
  const longhand = resolveLonghand(node.name.name, context);
8939
- if (longhand)
9078
+ if (!longhand)
8940
9079
  return;
8941
9080
  sendReport(node.name, node.name.name);
8942
9081
  },
@@ -8946,37 +9085,36 @@ var init_prefer_shorthand_properties = __esm({
8946
9085
  if (!isPandaAttribute(node, context))
8947
9086
  return;
8948
9087
  const longhand = resolveLonghand(node.key.name, context);
8949
- if (longhand)
9088
+ if (!longhand)
8950
9089
  return;
8951
9090
  sendReport(node.key, node.key.name);
8952
9091
  }
8953
9092
  };
8954
9093
  }
8955
9094
  });
8956
- prefer_shorthand_properties_default = rule10;
9095
+ prefer_longhand_properties_default = rule11;
8957
9096
  }
8958
9097
  });
8959
9098
 
8960
- // src/rules/no-unsafe-token-fn-usage.ts
8961
- import "@typescript-eslint/utils";
8962
- var RULE_NAME11, rule11, no_unsafe_token_fn_usage_default;
8963
- var init_no_unsafe_token_fn_usage = __esm({
8964
- "src/rules/no-unsafe-token-fn-usage.ts"() {
9099
+ // src/rules/prefer-shorthand-properties.ts
9100
+ var RULE_NAME12, rule12, prefer_shorthand_properties_default;
9101
+ var init_prefer_shorthand_properties = __esm({
9102
+ "src/rules/prefer-shorthand-properties.ts"() {
8965
9103
  "use strict";
8966
9104
  init_esm_shims();
8967
9105
  init_helpers();
8968
9106
  init_utils();
8969
9107
  init_nodes();
8970
- RULE_NAME11 = "no-unsafe-token-fn-usage";
8971
- rule11 = createRule({
8972
- name: RULE_NAME11,
9108
+ RULE_NAME12 = "prefer-shorthand-properties";
9109
+ rule12 = createRule({
9110
+ name: RULE_NAME12,
8973
9111
  meta: {
8974
9112
  docs: {
8975
- description: "Prevent users from using the token function in situations where they could simply use the raw design token."
9113
+ description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
8976
9114
  },
8977
9115
  messages: {
8978
- noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
8979
- replace: "Replace token function with `{{safe}}`"
9116
+ shorthand: "Use shorthand property of `{{longhand}}` instead. Prefer {{shorthand}}",
9117
+ replace: "Replace `{{longhand}}` with `{{shorthand}}`"
8980
9118
  },
8981
9119
  type: "suggestion",
8982
9120
  hasSuggestions: true,
@@ -8984,57 +9122,25 @@ var init_no_unsafe_token_fn_usage = __esm({
8984
9122
  },
8985
9123
  defaultOptions: [],
8986
9124
  create(context) {
8987
- const isUnsafeCallExpression = (node) => {
8988
- const tkImport = getTokenImport(context);
8989
- return isIdentifier(node.callee) && node.callee.name === tkImport?.alias;
8990
- };
8991
- const tokenWrap = (value) => value ? `token(${value})` : "";
8992
- const handleRuntimeFm = (node) => {
8993
- if (!isCallExpression(node))
8994
- return;
8995
- if (!isUnsafeCallExpression(node))
8996
- return;
8997
- const value = node.arguments[0];
8998
- if (isLiteral(value)) {
8999
- sendReport(node, tokenWrap(value.value?.toString()));
9000
- }
9001
- if (isTemplateLiteral(value)) {
9002
- sendReport(node, tokenWrap(value.quasis[0].value.raw));
9003
- }
9004
- };
9005
- const isCompositeValue = (input) => {
9006
- if (!input)
9007
- return;
9008
- const tokenRegex = /^(?:token\([^)]*\)|\{[^}]*\})$/;
9009
- return !tokenRegex.test(input);
9010
- };
9011
- const handleLiteral = (node) => {
9012
- if (!isLiteral(node))
9013
- return;
9014
- if (isCompositeValue(node.value?.toString()))
9015
- return;
9016
- sendReport(node);
9017
- };
9018
- const handleTemplateLiteral = (node) => {
9019
- if (!isTemplateLiteral(node))
9020
- return;
9021
- if (node.expressions.length > 0)
9125
+ const sendReport = (node, name2) => {
9126
+ const shorthands = resolveShorthands(name2, context);
9127
+ if (!shorthands)
9022
9128
  return;
9023
- sendReport(node, node.quasis[0].value.raw);
9024
- };
9025
- const sendReport = (node, _value) => {
9026
- const value = _value ?? node.value?.toString();
9027
- const tkImports = extractTokens(value);
9028
- const token = tkImports[0].replace(/^[^.]*\./, "");
9129
+ const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
9130
+ const data = {
9131
+ longhand: name2,
9132
+ shorthand
9133
+ };
9029
9134
  return context.report({
9030
9135
  node,
9031
- messageId: "noUnsafeTokenFnUsage",
9136
+ messageId: "shorthand",
9137
+ data,
9032
9138
  suggest: [
9033
9139
  {
9034
9140
  messageId: "replace",
9035
- data: { safe: token },
9141
+ data,
9036
9142
  fix: (fixer) => {
9037
- return fixer.replaceTextRange(node.range, `'${token}'`);
9143
+ return fixer.replaceTextRange(node.range, shorthands[0]);
9038
9144
  }
9039
9145
  }
9040
9146
  ]
@@ -9042,30 +9148,29 @@ var init_no_unsafe_token_fn_usage = __esm({
9042
9148
  };
9043
9149
  return {
9044
9150
  JSXAttribute(node) {
9045
- if (!node.value)
9151
+ if (!isJSXIdentifier(node.name))
9046
9152
  return;
9047
9153
  if (!isPandaProp(node, context))
9048
9154
  return;
9049
- handleLiteral(node.value);
9050
- if (!isJSXExpressionContainer(node.value))
9155
+ const longhand = resolveLonghand(node.name.name, context);
9156
+ if (longhand)
9051
9157
  return;
9052
- handleLiteral(node.value.expression);
9053
- handleTemplateLiteral(node.value.expression);
9054
- handleRuntimeFm(node.value.expression);
9158
+ sendReport(node.name, node.name.name);
9055
9159
  },
9056
9160
  Property(node) {
9057
- if (!isCallExpression(node.value) && !isLiteral(node.value) && !isTemplateLiteral(node.value))
9161
+ if (!isIdentifier(node.key))
9058
9162
  return;
9059
9163
  if (!isPandaAttribute(node, context))
9060
9164
  return;
9061
- handleRuntimeFm(node.value);
9062
- handleLiteral(node.value);
9063
- handleTemplateLiteral(node.value);
9165
+ const longhand = resolveLonghand(node.key.name, context);
9166
+ if (longhand)
9167
+ return;
9168
+ sendReport(node.key, node.key.name);
9064
9169
  }
9065
9170
  };
9066
9171
  }
9067
9172
  });
9068
- no_unsafe_token_fn_usage_default = rule11;
9173
+ prefer_shorthand_properties_default = rule12;
9069
9174
  }
9070
9175
  });
9071
9176
 
@@ -9190,7 +9295,7 @@ var init_composite_properties = __esm({
9190
9295
  });
9191
9296
 
9192
9297
  // src/rules/prefer-atomic-properties.ts
9193
- var RULE_NAME12, rule12, prefer_atomic_properties_default;
9298
+ var RULE_NAME13, rule13, prefer_atomic_properties_default;
9194
9299
  var init_prefer_atomic_properties = __esm({
9195
9300
  "src/rules/prefer-atomic-properties.ts"() {
9196
9301
  "use strict";
@@ -9199,9 +9304,9 @@ var init_prefer_atomic_properties = __esm({
9199
9304
  init_utils();
9200
9305
  init_composite_properties();
9201
9306
  init_nodes();
9202
- RULE_NAME12 = "prefer-atomic-properties";
9203
- rule12 = createRule({
9204
- name: RULE_NAME12,
9307
+ RULE_NAME13 = "prefer-atomic-properties";
9308
+ rule13 = createRule({
9309
+ name: RULE_NAME13,
9205
9310
  meta: {
9206
9311
  docs: {
9207
9312
  description: "Encourage the use of atomic properties instead of composite properties in the codebase."
@@ -9257,12 +9362,12 @@ var init_prefer_atomic_properties = __esm({
9257
9362
  };
9258
9363
  }
9259
9364
  });
9260
- prefer_atomic_properties_default = rule12;
9365
+ prefer_atomic_properties_default = rule13;
9261
9366
  }
9262
9367
  });
9263
9368
 
9264
9369
  // src/rules/prefer-composite-properties.ts
9265
- var RULE_NAME13, rule13, prefer_composite_properties_default;
9370
+ var RULE_NAME14, rule14, prefer_composite_properties_default;
9266
9371
  var init_prefer_composite_properties = __esm({
9267
9372
  "src/rules/prefer-composite-properties.ts"() {
9268
9373
  "use strict";
@@ -9271,9 +9376,9 @@ var init_prefer_composite_properties = __esm({
9271
9376
  init_utils();
9272
9377
  init_composite_properties();
9273
9378
  init_nodes();
9274
- RULE_NAME13 = "prefer-composite-properties";
9275
- rule13 = createRule({
9276
- name: RULE_NAME13,
9379
+ RULE_NAME14 = "prefer-composite-properties";
9380
+ rule14 = createRule({
9381
+ name: RULE_NAME14,
9277
9382
  meta: {
9278
9383
  docs: {
9279
9384
  description: "Encourage the use of composite properties instead of atomic properties in the codebase."
@@ -9327,12 +9432,12 @@ var init_prefer_composite_properties = __esm({
9327
9432
  };
9328
9433
  }
9329
9434
  });
9330
- prefer_composite_properties_default = rule13;
9435
+ prefer_composite_properties_default = rule14;
9331
9436
  }
9332
9437
  });
9333
9438
 
9334
9439
  // src/rules/prefer-unified-property-style.ts
9335
- var RULE_NAME14, rule14, prefer_unified_property_style_default;
9440
+ var RULE_NAME15, rule15, prefer_unified_property_style_default;
9336
9441
  var init_prefer_unified_property_style = __esm({
9337
9442
  "src/rules/prefer-unified-property-style.ts"() {
9338
9443
  "use strict";
@@ -9341,9 +9446,9 @@ var init_prefer_unified_property_style = __esm({
9341
9446
  init_utils();
9342
9447
  init_composite_properties();
9343
9448
  init_nodes();
9344
- RULE_NAME14 = "prefer-unified-property-style";
9345
- rule14 = createRule({
9346
- name: RULE_NAME14,
9449
+ RULE_NAME15 = "prefer-unified-property-style";
9450
+ rule15 = createRule({
9451
+ name: RULE_NAME15,
9347
9452
  meta: {
9348
9453
  docs: {
9349
9454
  description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
@@ -9410,7 +9515,7 @@ var init_prefer_unified_property_style = __esm({
9410
9515
  };
9411
9516
  }
9412
9517
  });
9413
- prefer_unified_property_style_default = rule14;
9518
+ prefer_unified_property_style_default = rule15;
9414
9519
  }
9415
9520
  });
9416
9521
 
@@ -9426,11 +9531,12 @@ var init_rules = __esm({
9426
9531
  init_no_dynamic_styling();
9427
9532
  init_no_escape_hatch();
9428
9533
  init_no_hardcoded_color();
9534
+ init_no_important();
9429
9535
  init_no_invalid_token_paths();
9430
9536
  init_no_property_renaming();
9537
+ init_no_unsafe_token_fn_usage();
9431
9538
  init_prefer_longhand_properties();
9432
9539
  init_prefer_shorthand_properties();
9433
- init_no_unsafe_token_fn_usage();
9434
9540
  init_prefer_atomic_properties();
9435
9541
  init_prefer_composite_properties();
9436
9542
  init_prefer_unified_property_style();
@@ -9441,14 +9547,15 @@ var init_rules = __esm({
9441
9547
  [RULE_NAME4]: no_dynamic_styling_default,
9442
9548
  [RULE_NAME5]: no_escape_hatch_default,
9443
9549
  [RULE_NAME6]: no_hardcoded_color_default,
9444
- [RULE_NAME7]: no_invalid_token_paths_default,
9445
- [RULE_NAME8]: no_property_renaming_default,
9446
- [RULE_NAME9]: prefer_longhand_properties_default,
9447
- [RULE_NAME10]: prefer_shorthand_properties_default,
9448
- [RULE_NAME11]: no_unsafe_token_fn_usage_default,
9449
- [RULE_NAME12]: prefer_atomic_properties_default,
9450
- [RULE_NAME13]: prefer_composite_properties_default,
9451
- [RULE_NAME14]: prefer_unified_property_style_default
9550
+ [RULE_NAME7]: no_important_default,
9551
+ [RULE_NAME8]: no_invalid_token_paths_default,
9552
+ [RULE_NAME9]: no_property_renaming_default,
9553
+ [RULE_NAME10]: no_unsafe_token_fn_usage_default,
9554
+ [RULE_NAME11]: prefer_longhand_properties_default,
9555
+ [RULE_NAME12]: prefer_shorthand_properties_default,
9556
+ [RULE_NAME13]: prefer_atomic_properties_default,
9557
+ [RULE_NAME14]: prefer_composite_properties_default,
9558
+ [RULE_NAME15]: prefer_unified_property_style_default
9452
9559
  };
9453
9560
  }
9454
9561
  });
@@ -9463,7 +9570,7 @@ var init_all = __esm({
9463
9570
  init_file_not_included();
9464
9571
  init_no_config_function_in_source();
9465
9572
  init_no_invalid_token_paths();
9466
- errorRules = [RULE_NAME, RULE_NAME2, RULE_NAME7];
9573
+ errorRules = [RULE_NAME, RULE_NAME2, RULE_NAME8];
9467
9574
  allRules = Object.fromEntries(
9468
9575
  Object.entries(rules).map(([name2]) => {
9469
9576
  return [`@pandacss/${name2}`, errorRules.includes(name2) ? "error" : "warn"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/eslint-plugin",
3
- "version": "0.0.0-dev-20240209020540",
3
+ "version": "0.0.0-dev-20240209200922",
4
4
  "description": "Eslint plugin for Panda CSS",
5
5
  "author": "Abraham Aremu <anubra266@gmail.com>",
6
6
  "main": "dist/index.js",