@pandacss/eslint-plugin 0.0.11 → 0.0.12

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 +318 -142
  2. package/dist/index.mjs +352 -155
  3. package/package.json +1 -1
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.11";
13
+ version = "0.0.12";
14
14
  }
15
15
  });
16
16
 
@@ -7950,7 +7950,7 @@ var require_dist3 = __commonJS({
7950
7950
  // src/utils/nodes.ts
7951
7951
  import { isNodeOfType } from "@typescript-eslint/utils/ast-utils";
7952
7952
  import { AST_NODE_TYPES } from "@typescript-eslint/utils";
7953
- var isIdentifier, isLiteral, isTemplateLiteral, isObjectExpression, isMemberExpression, isVariableDeclarator, isVariableDeclaration, isJSXMemberExpression, isJSXOpeningElement, isJSXExpressionContainer, isJSXAttribute, isJSXIdentifier, isCallExpression, isImportDeclaration, isImportSpecifier;
7953
+ var isIdentifier, isLiteral, isTemplateLiteral, isObjectExpression, isMemberExpression, isVariableDeclarator, isVariableDeclaration, isJSXMemberExpression, isJSXOpeningElement, isJSXExpressionContainer, isJSXAttribute, isJSXIdentifier, isCallExpression, isImportDeclaration, isImportSpecifier, isProperty;
7954
7954
  var init_nodes = __esm({
7955
7955
  "src/utils/nodes.ts"() {
7956
7956
  "use strict";
@@ -7970,6 +7970,7 @@ var init_nodes = __esm({
7970
7970
  isCallExpression = isNodeOfType(AST_NODE_TYPES.CallExpression);
7971
7971
  isImportDeclaration = isNodeOfType(AST_NODE_TYPES.ImportDeclaration);
7972
7972
  isImportSpecifier = isNodeOfType(AST_NODE_TYPES.ImportSpecifier);
7973
+ isProperty = isNodeOfType(AST_NODE_TYPES.Property);
7973
7974
  }
7974
7975
  });
7975
7976
 
@@ -8612,10 +8613,117 @@ var init_no_hardcoded_color = __esm({
8612
8613
  }
8613
8614
  });
8614
8615
 
8616
+ // src/rules/no-important.ts
8617
+ import { getArbitraryValue as getArbitraryValue2 } from "@pandacss/shared";
8618
+ var exclamationRegex, importantRegex, RULE_NAME7, rule7, no_important_default;
8619
+ var init_no_important = __esm({
8620
+ "src/rules/no-important.ts"() {
8621
+ "use strict";
8622
+ init_esm_shims();
8623
+ init_helpers();
8624
+ init_utils();
8625
+ init_nodes();
8626
+ exclamationRegex = /\s*!$/;
8627
+ importantRegex = /\s*!important\s*$/;
8628
+ RULE_NAME7 = "no-important";
8629
+ rule7 = createRule({
8630
+ name: RULE_NAME7,
8631
+ meta: {
8632
+ docs: {
8633
+ description: "Disallow usage of important keyword. Prioroitize specificity for a maintainable and predictable styling structure."
8634
+ },
8635
+ messages: {
8636
+ important: "Avoid using the !important keyword. Refactor your code to prioritize specificity for predictable styling.",
8637
+ remove: "Remove the `{{keyword}}` keyword."
8638
+ },
8639
+ type: "suggestion",
8640
+ hasSuggestions: true,
8641
+ schema: []
8642
+ },
8643
+ defaultOptions: [],
8644
+ create(context) {
8645
+ const removeQuotes = ([start, end]) => [start + 1, end - 1];
8646
+ const hasImportantKeyword = (_value) => {
8647
+ if (!_value)
8648
+ return false;
8649
+ const value = getArbitraryValue2(_value);
8650
+ return exclamationRegex.test(value) || importantRegex.test(value);
8651
+ };
8652
+ const removeImportantKeyword = (input) => {
8653
+ if (exclamationRegex.test(input)) {
8654
+ return { fixed: input.replace(exclamationRegex, ""), keyword: "!" };
8655
+ } else if (importantRegex.test(input)) {
8656
+ return { fixed: input.replace(importantRegex, ""), keyword: "!important" };
8657
+ } else {
8658
+ return { fixed: input, keyword: null };
8659
+ }
8660
+ };
8661
+ const handleLiteral = (node) => {
8662
+ if (!isLiteral(node))
8663
+ return;
8664
+ if (!hasImportantKeyword(node.value?.toString()))
8665
+ return;
8666
+ sendReport(node);
8667
+ };
8668
+ const handleTemplateLiteral = (node) => {
8669
+ if (!isTemplateLiteral(node))
8670
+ return;
8671
+ if (node.expressions.length > 0)
8672
+ return;
8673
+ if (!hasImportantKeyword(node.quasis[0].value.raw))
8674
+ return;
8675
+ sendReport(node.quasis[0], node.quasis[0].value.raw);
8676
+ };
8677
+ const sendReport = (node, _value) => {
8678
+ const value = _value ?? node.value?.toString();
8679
+ const { keyword, fixed } = removeImportantKeyword(value);
8680
+ return context.report({
8681
+ node,
8682
+ messageId: "important",
8683
+ suggest: [
8684
+ {
8685
+ messageId: "remove",
8686
+ data: { keyword },
8687
+ fix: (fixer) => {
8688
+ return fixer.replaceTextRange(removeQuotes(node.range), fixed);
8689
+ }
8690
+ }
8691
+ ]
8692
+ });
8693
+ };
8694
+ return {
8695
+ JSXAttribute(node) {
8696
+ if (!node.value)
8697
+ return;
8698
+ if (!isPandaProp(node, context))
8699
+ return;
8700
+ handleLiteral(node.value);
8701
+ if (!isJSXExpressionContainer(node.value))
8702
+ return;
8703
+ handleLiteral(node.value.expression);
8704
+ handleTemplateLiteral(node.value.expression);
8705
+ },
8706
+ Property(node) {
8707
+ if (!isIdentifier(node.key))
8708
+ return;
8709
+ if (!isLiteral(node.value) && !isTemplateLiteral(node.value))
8710
+ return;
8711
+ if (!isPandaAttribute(node, context))
8712
+ return;
8713
+ handleLiteral(node.value);
8714
+ handleTemplateLiteral(node.value);
8715
+ }
8716
+ };
8717
+ }
8718
+ });
8719
+ no_important_default = rule7;
8720
+ }
8721
+ });
8722
+
8615
8723
  // src/rules/no-invalid-token-paths.ts
8616
8724
  import { AST_NODE_TYPES as AST_NODE_TYPES2 } from "@typescript-eslint/utils";
8617
8725
  import { isNodeOfTypes } from "@typescript-eslint/utils/ast-utils";
8618
- var RULE_NAME7, rule7, no_invalid_token_paths_default;
8726
+ var RULE_NAME8, rule8, no_invalid_token_paths_default;
8619
8727
  var init_no_invalid_token_paths = __esm({
8620
8728
  "src/rules/no-invalid-token-paths.ts"() {
8621
8729
  "use strict";
@@ -8623,9 +8731,9 @@ var init_no_invalid_token_paths = __esm({
8623
8731
  init_helpers();
8624
8732
  init_utils();
8625
8733
  init_nodes();
8626
- RULE_NAME7 = "no-invalid-token-paths";
8627
- rule7 = createRule({
8628
- name: RULE_NAME7,
8734
+ RULE_NAME8 = "no-invalid-token-paths";
8735
+ rule8 = createRule({
8736
+ name: RULE_NAME8,
8629
8737
  meta: {
8630
8738
  docs: {
8631
8739
  description: "Disallow the use of invalid token paths within token function syntax."
@@ -8725,12 +8833,12 @@ var init_no_invalid_token_paths = __esm({
8725
8833
  };
8726
8834
  }
8727
8835
  });
8728
- no_invalid_token_paths_default = rule7;
8836
+ no_invalid_token_paths_default = rule8;
8729
8837
  }
8730
8838
  });
8731
8839
 
8732
8840
  // src/rules/no-property-renaming.ts
8733
- var RULE_NAME8, rule8, no_property_renaming_default;
8841
+ var RULE_NAME9, rule9, no_property_renaming_default;
8734
8842
  var init_no_property_renaming = __esm({
8735
8843
  "src/rules/no-property-renaming.ts"() {
8736
8844
  "use strict";
@@ -8738,9 +8846,9 @@ var init_no_property_renaming = __esm({
8738
8846
  init_utils();
8739
8847
  init_helpers();
8740
8848
  init_nodes();
8741
- RULE_NAME8 = "no-property-renaming";
8742
- rule8 = createRule({
8743
- name: RULE_NAME8,
8849
+ RULE_NAME9 = "no-property-renaming";
8850
+ rule9 = createRule({
8851
+ name: RULE_NAME9,
8744
8852
  meta: {
8745
8853
  docs: {
8746
8854
  description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
@@ -8799,29 +8907,31 @@ var init_no_property_renaming = __esm({
8799
8907
  };
8800
8908
  }
8801
8909
  });
8802
- no_property_renaming_default = rule8;
8910
+ no_property_renaming_default = rule9;
8803
8911
  }
8804
8912
  });
8805
8913
 
8806
- // src/rules/prefer-longhand-properties.ts
8807
- var RULE_NAME9, rule9, prefer_longhand_properties_default;
8808
- var init_prefer_longhand_properties = __esm({
8809
- "src/rules/prefer-longhand-properties.ts"() {
8914
+ // src/rules/no-unsafe-token-fn-usage.ts
8915
+ import "@typescript-eslint/utils";
8916
+ import { getArbitraryValue as getArbitraryValue3 } from "@pandacss/shared";
8917
+ var RULE_NAME10, rule10, no_unsafe_token_fn_usage_default;
8918
+ var init_no_unsafe_token_fn_usage = __esm({
8919
+ "src/rules/no-unsafe-token-fn-usage.ts"() {
8810
8920
  "use strict";
8811
8921
  init_esm_shims();
8812
8922
  init_helpers();
8813
8923
  init_utils();
8814
8924
  init_nodes();
8815
- RULE_NAME9 = "prefer-longhand-properties";
8816
- rule9 = createRule({
8817
- name: RULE_NAME9,
8925
+ RULE_NAME10 = "no-unsafe-token-fn-usage";
8926
+ rule10 = createRule({
8927
+ name: RULE_NAME10,
8818
8928
  meta: {
8819
8929
  docs: {
8820
- description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
8930
+ description: "Prevent users from using the token function in situations where they could simply use the raw design token."
8821
8931
  },
8822
8932
  messages: {
8823
- longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
8824
- replace: "Replace `{{shorthand}}` with `{{longhand}}`"
8933
+ noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
8934
+ replace: "Replace token function with `{{safe}}`"
8825
8935
  },
8826
8936
  type: "suggestion",
8827
8937
  hasSuggestions: true,
@@ -8829,22 +8939,57 @@ var init_prefer_longhand_properties = __esm({
8829
8939
  },
8830
8940
  defaultOptions: [],
8831
8941
  create(context) {
8832
- const sendReport = (node, name2) => {
8833
- const longhand = resolveLonghand(name2, context);
8834
- const data = {
8835
- shorthand: name2,
8836
- longhand
8837
- };
8942
+ const isUnsafeCallExpression = (node) => {
8943
+ const tkImport = getTokenImport(context);
8944
+ return isIdentifier(node.callee) && node.callee.name === tkImport?.alias;
8945
+ };
8946
+ const tokenWrap = (value) => value ? `token(${value})` : "";
8947
+ const handleRuntimeFm = (node) => {
8948
+ if (!isCallExpression(node))
8949
+ return;
8950
+ if (!isUnsafeCallExpression(node))
8951
+ return;
8952
+ const value = node.arguments[0];
8953
+ if (isLiteral(value)) {
8954
+ sendReport(node, tokenWrap(getArbitraryValue3(value.value?.toString() ?? "")));
8955
+ }
8956
+ if (isTemplateLiteral(value)) {
8957
+ sendReport(node, tokenWrap(getArbitraryValue3(value.quasis[0].value.raw)));
8958
+ }
8959
+ };
8960
+ const isCompositeValue = (input) => {
8961
+ if (!input)
8962
+ return;
8963
+ const tokenRegex = /^(?:token\([^)]*\)|\{[^}]*\})$/;
8964
+ return !tokenRegex.test(input);
8965
+ };
8966
+ const handleLiteral = (node) => {
8967
+ if (!isLiteral(node))
8968
+ return;
8969
+ const value = getArbitraryValue3(node.value?.toString() ?? "");
8970
+ if (isCompositeValue(value))
8971
+ return;
8972
+ sendReport(node, value);
8973
+ };
8974
+ const handleTemplateLiteral = (node) => {
8975
+ if (!isTemplateLiteral(node))
8976
+ return;
8977
+ if (node.expressions.length > 0)
8978
+ return;
8979
+ sendReport(node, getArbitraryValue3(node.quasis[0].value.raw));
8980
+ };
8981
+ const sendReport = (node, value) => {
8982
+ const tkImports = extractTokens(value);
8983
+ const token = tkImports[0].replace(/^[^.]*\./, "");
8838
8984
  return context.report({
8839
8985
  node,
8840
- messageId: "longhand",
8841
- data,
8986
+ messageId: "noUnsafeTokenFnUsage",
8842
8987
  suggest: [
8843
8988
  {
8844
8989
  messageId: "replace",
8845
- data,
8990
+ data: { safe: token },
8846
8991
  fix: (fixer) => {
8847
- return fixer.replaceTextRange(node.range, longhand);
8992
+ return fixer.replaceTextRange(node.range, `'${token}'`);
8848
8993
  }
8849
8994
  }
8850
8995
  ]
@@ -8852,51 +8997,52 @@ var init_prefer_longhand_properties = __esm({
8852
8997
  };
8853
8998
  return {
8854
8999
  JSXAttribute(node) {
8855
- if (!isJSXIdentifier(node.name))
9000
+ if (!node.value)
8856
9001
  return;
8857
9002
  if (!isPandaProp(node, context))
8858
9003
  return;
8859
- const longhand = resolveLonghand(node.name.name, context);
8860
- if (!longhand)
9004
+ handleLiteral(node.value);
9005
+ if (!isJSXExpressionContainer(node.value))
8861
9006
  return;
8862
- sendReport(node.name, node.name.name);
9007
+ handleLiteral(node.value.expression);
9008
+ handleTemplateLiteral(node.value.expression);
9009
+ handleRuntimeFm(node.value.expression);
8863
9010
  },
8864
9011
  Property(node) {
8865
- if (!isIdentifier(node.key))
9012
+ if (!isCallExpression(node.value) && !isLiteral(node.value) && !isTemplateLiteral(node.value))
8866
9013
  return;
8867
9014
  if (!isPandaAttribute(node, context))
8868
9015
  return;
8869
- const longhand = resolveLonghand(node.key.name, context);
8870
- if (!longhand)
8871
- return;
8872
- sendReport(node.key, node.key.name);
9016
+ handleRuntimeFm(node.value);
9017
+ handleLiteral(node.value);
9018
+ handleTemplateLiteral(node.value);
8873
9019
  }
8874
9020
  };
8875
9021
  }
8876
9022
  });
8877
- prefer_longhand_properties_default = rule9;
9023
+ no_unsafe_token_fn_usage_default = rule10;
8878
9024
  }
8879
9025
  });
8880
9026
 
8881
- // src/rules/prefer-shorthand-properties.ts
8882
- var RULE_NAME10, rule10, prefer_shorthand_properties_default;
8883
- var init_prefer_shorthand_properties = __esm({
8884
- "src/rules/prefer-shorthand-properties.ts"() {
9027
+ // src/rules/prefer-longhand-properties.ts
9028
+ var RULE_NAME11, rule11, prefer_longhand_properties_default;
9029
+ var init_prefer_longhand_properties = __esm({
9030
+ "src/rules/prefer-longhand-properties.ts"() {
8885
9031
  "use strict";
8886
9032
  init_esm_shims();
8887
9033
  init_helpers();
8888
9034
  init_utils();
8889
9035
  init_nodes();
8890
- RULE_NAME10 = "prefer-shorthand-properties";
8891
- rule10 = createRule({
8892
- name: RULE_NAME10,
9036
+ RULE_NAME11 = "prefer-longhand-properties";
9037
+ rule11 = createRule({
9038
+ name: RULE_NAME11,
8893
9039
  meta: {
8894
9040
  docs: {
8895
- description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
9041
+ description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
8896
9042
  },
8897
9043
  messages: {
8898
- shorthand: "Use shorthand property of `{{longhand}}` instead. Prefer {{shorthand}}",
8899
- replace: "Replace `{{longhand}}` with `{{shorthand}}`"
9044
+ longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
9045
+ replace: "Replace `{{shorthand}}` with `{{longhand}}`"
8900
9046
  },
8901
9047
  type: "suggestion",
8902
9048
  hasSuggestions: true,
@@ -8905,24 +9051,21 @@ var init_prefer_shorthand_properties = __esm({
8905
9051
  defaultOptions: [],
8906
9052
  create(context) {
8907
9053
  const sendReport = (node, name2) => {
8908
- const shorthands = resolveShorthands(name2, context);
8909
- if (!shorthands)
8910
- return;
8911
- const shorthand = shorthands.map((s) => "`" + s + "`")?.join(", ");
9054
+ const longhand = resolveLonghand(name2, context);
8912
9055
  const data = {
8913
- longhand: name2,
8914
- shorthand
9056
+ shorthand: name2,
9057
+ longhand
8915
9058
  };
8916
9059
  return context.report({
8917
9060
  node,
8918
- messageId: "shorthand",
9061
+ messageId: "longhand",
8919
9062
  data,
8920
9063
  suggest: [
8921
9064
  {
8922
9065
  messageId: "replace",
8923
9066
  data,
8924
9067
  fix: (fixer) => {
8925
- return fixer.replaceTextRange(node.range, shorthands[0]);
9068
+ return fixer.replaceTextRange(node.range, longhand);
8926
9069
  }
8927
9070
  }
8928
9071
  ]
@@ -8935,7 +9078,7 @@ var init_prefer_shorthand_properties = __esm({
8935
9078
  if (!isPandaProp(node, context))
8936
9079
  return;
8937
9080
  const longhand = resolveLonghand(node.name.name, context);
8938
- if (longhand)
9081
+ if (!longhand)
8939
9082
  return;
8940
9083
  sendReport(node.name, node.name.name);
8941
9084
  },
@@ -8945,37 +9088,36 @@ var init_prefer_shorthand_properties = __esm({
8945
9088
  if (!isPandaAttribute(node, context))
8946
9089
  return;
8947
9090
  const longhand = resolveLonghand(node.key.name, context);
8948
- if (longhand)
9091
+ if (!longhand)
8949
9092
  return;
8950
9093
  sendReport(node.key, node.key.name);
8951
9094
  }
8952
9095
  };
8953
9096
  }
8954
9097
  });
8955
- prefer_shorthand_properties_default = rule10;
9098
+ prefer_longhand_properties_default = rule11;
8956
9099
  }
8957
9100
  });
8958
9101
 
8959
- // src/rules/no-unsafe-token-fn-usage.ts
8960
- import "@typescript-eslint/utils";
8961
- var RULE_NAME11, rule11, no_unsafe_token_fn_usage_default;
8962
- var init_no_unsafe_token_fn_usage = __esm({
8963
- "src/rules/no-unsafe-token-fn-usage.ts"() {
9102
+ // src/rules/prefer-shorthand-properties.ts
9103
+ var RULE_NAME12, rule12, prefer_shorthand_properties_default;
9104
+ var init_prefer_shorthand_properties = __esm({
9105
+ "src/rules/prefer-shorthand-properties.ts"() {
8964
9106
  "use strict";
8965
9107
  init_esm_shims();
8966
9108
  init_helpers();
8967
9109
  init_utils();
8968
9110
  init_nodes();
8969
- RULE_NAME11 = "no-unsafe-token-fn-usage";
8970
- rule11 = createRule({
8971
- name: RULE_NAME11,
9111
+ RULE_NAME12 = "prefer-shorthand-properties";
9112
+ rule12 = createRule({
9113
+ name: RULE_NAME12,
8972
9114
  meta: {
8973
9115
  docs: {
8974
- description: "Prevent users from using the token function in situations where they could simply use the raw design token."
9116
+ description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
8975
9117
  },
8976
9118
  messages: {
8977
- noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
8978
- replace: "Replace token function with `{{safe}}`"
9119
+ shorthand: "Use shorthand property of `{{longhand}}` instead. Prefer {{shorthand}}",
9120
+ replace: "Replace `{{longhand}}` with `{{shorthand}}`"
8979
9121
  },
8980
9122
  type: "suggestion",
8981
9123
  hasSuggestions: true,
@@ -8983,57 +9125,25 @@ var init_no_unsafe_token_fn_usage = __esm({
8983
9125
  },
8984
9126
  defaultOptions: [],
8985
9127
  create(context) {
8986
- const isUnsafeCallExpression = (node) => {
8987
- const tkImport = getTokenImport(context);
8988
- return isIdentifier(node.callee) && node.callee.name === tkImport?.alias;
8989
- };
8990
- const tokenWrap = (value) => value ? `token(${value})` : "";
8991
- const handleRuntimeFm = (node) => {
8992
- if (!isCallExpression(node))
8993
- return;
8994
- if (!isUnsafeCallExpression(node))
8995
- return;
8996
- const value = node.arguments[0];
8997
- if (isLiteral(value)) {
8998
- sendReport(node, tokenWrap(value.value?.toString()));
8999
- }
9000
- if (isTemplateLiteral(value)) {
9001
- sendReport(node, tokenWrap(value.quasis[0].value.raw));
9002
- }
9003
- };
9004
- const isCompositeValue = (input) => {
9005
- if (!input)
9006
- return;
9007
- const tokenRegex = /^(?:token\([^)]*\)|\{[^}]*\})$/;
9008
- return !tokenRegex.test(input);
9009
- };
9010
- const handleLiteral = (node) => {
9011
- if (!isLiteral(node))
9012
- return;
9013
- if (isCompositeValue(node.value?.toString()))
9014
- return;
9015
- sendReport(node);
9016
- };
9017
- const handleTemplateLiteral = (node) => {
9018
- if (!isTemplateLiteral(node))
9019
- return;
9020
- if (node.expressions.length > 0)
9128
+ const sendReport = (node, name2) => {
9129
+ const shorthands = resolveShorthands(name2, context);
9130
+ if (!shorthands)
9021
9131
  return;
9022
- sendReport(node, node.quasis[0].value.raw);
9023
- };
9024
- const sendReport = (node, _value) => {
9025
- const value = _value ?? node.value?.toString();
9026
- const tkImports = extractTokens(value);
9027
- const token = tkImports[0].replace(/^[^.]*\./, "");
9132
+ const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
9133
+ const data = {
9134
+ longhand: name2,
9135
+ shorthand
9136
+ };
9028
9137
  return context.report({
9029
9138
  node,
9030
- messageId: "noUnsafeTokenFnUsage",
9139
+ messageId: "shorthand",
9140
+ data,
9031
9141
  suggest: [
9032
9142
  {
9033
9143
  messageId: "replace",
9034
- data: { safe: token },
9144
+ data,
9035
9145
  fix: (fixer) => {
9036
- return fixer.replaceTextRange(node.range, `'${token}'`);
9146
+ return fixer.replaceTextRange(node.range, shorthands[0]);
9037
9147
  }
9038
9148
  }
9039
9149
  ]
@@ -9041,30 +9151,29 @@ var init_no_unsafe_token_fn_usage = __esm({
9041
9151
  };
9042
9152
  return {
9043
9153
  JSXAttribute(node) {
9044
- if (!node.value)
9154
+ if (!isJSXIdentifier(node.name))
9045
9155
  return;
9046
9156
  if (!isPandaProp(node, context))
9047
9157
  return;
9048
- handleLiteral(node.value);
9049
- if (!isJSXExpressionContainer(node.value))
9158
+ const longhand = resolveLonghand(node.name.name, context);
9159
+ if (longhand)
9050
9160
  return;
9051
- handleLiteral(node.value.expression);
9052
- handleTemplateLiteral(node.value.expression);
9053
- handleRuntimeFm(node.value.expression);
9161
+ sendReport(node.name, node.name.name);
9054
9162
  },
9055
9163
  Property(node) {
9056
- if (!isCallExpression(node.value) && !isLiteral(node.value) && !isTemplateLiteral(node.value))
9164
+ if (!isIdentifier(node.key))
9057
9165
  return;
9058
9166
  if (!isPandaAttribute(node, context))
9059
9167
  return;
9060
- handleRuntimeFm(node.value);
9061
- handleLiteral(node.value);
9062
- handleTemplateLiteral(node.value);
9168
+ const longhand = resolveLonghand(node.key.name, context);
9169
+ if (longhand)
9170
+ return;
9171
+ sendReport(node.key, node.key.name);
9063
9172
  }
9064
9173
  };
9065
9174
  }
9066
9175
  });
9067
- no_unsafe_token_fn_usage_default = rule11;
9176
+ prefer_shorthand_properties_default = rule12;
9068
9177
  }
9069
9178
  });
9070
9179
 
@@ -9189,7 +9298,7 @@ var init_composite_properties = __esm({
9189
9298
  });
9190
9299
 
9191
9300
  // src/rules/prefer-atomic-properties.ts
9192
- var RULE_NAME12, rule12, prefer_atomic_properties_default;
9301
+ var RULE_NAME13, rule13, prefer_atomic_properties_default;
9193
9302
  var init_prefer_atomic_properties = __esm({
9194
9303
  "src/rules/prefer-atomic-properties.ts"() {
9195
9304
  "use strict";
@@ -9198,9 +9307,9 @@ var init_prefer_atomic_properties = __esm({
9198
9307
  init_utils();
9199
9308
  init_composite_properties();
9200
9309
  init_nodes();
9201
- RULE_NAME12 = "prefer-atomic-properties";
9202
- rule12 = createRule({
9203
- name: RULE_NAME12,
9310
+ RULE_NAME13 = "prefer-atomic-properties";
9311
+ rule13 = createRule({
9312
+ name: RULE_NAME13,
9204
9313
  meta: {
9205
9314
  docs: {
9206
9315
  description: "Encourage the use of atomic properties instead of composite properties in the codebase."
@@ -9221,8 +9330,8 @@ var init_prefer_atomic_properties = __esm({
9221
9330
  return longhand;
9222
9331
  };
9223
9332
  const sendReport = (node, name2) => {
9224
- const cpd = resolveCompositeProperty(name2);
9225
- const atomics = compositeProperties[cpd].map((name3) => `\`${name3}\``).join(",\n");
9333
+ const cmp = resolveCompositeProperty(name2);
9334
+ const atomics = compositeProperties[cmp].map((name3) => `\`${name3}\``).join(",\n");
9226
9335
  return context.report({
9227
9336
  node,
9228
9337
  messageId: "atomic",
@@ -9238,8 +9347,8 @@ var init_prefer_atomic_properties = __esm({
9238
9347
  return;
9239
9348
  if (!isPandaProp(node, context))
9240
9349
  return;
9241
- const cpd = resolveCompositeProperty(node.name.name);
9242
- if (!cpd)
9350
+ const cmp = resolveCompositeProperty(node.name.name);
9351
+ if (!cmp)
9243
9352
  return;
9244
9353
  sendReport(node, node.name.name);
9245
9354
  },
@@ -9248,20 +9357,20 @@ var init_prefer_atomic_properties = __esm({
9248
9357
  return;
9249
9358
  if (!isPandaAttribute(node, context))
9250
9359
  return;
9251
- const cpd = resolveCompositeProperty(node.key.name);
9252
- if (!cpd)
9360
+ const cmp = resolveCompositeProperty(node.key.name);
9361
+ if (!cmp)
9253
9362
  return;
9254
9363
  sendReport(node.key, node.key.name);
9255
9364
  }
9256
9365
  };
9257
9366
  }
9258
9367
  });
9259
- prefer_atomic_properties_default = rule12;
9368
+ prefer_atomic_properties_default = rule13;
9260
9369
  }
9261
9370
  });
9262
9371
 
9263
9372
  // src/rules/prefer-composite-properties.ts
9264
- var RULE_NAME13, rule13, prefer_composite_properties_default;
9373
+ var RULE_NAME14, rule14, prefer_composite_properties_default;
9265
9374
  var init_prefer_composite_properties = __esm({
9266
9375
  "src/rules/prefer-composite-properties.ts"() {
9267
9376
  "use strict";
@@ -9270,9 +9379,9 @@ var init_prefer_composite_properties = __esm({
9270
9379
  init_utils();
9271
9380
  init_composite_properties();
9272
9381
  init_nodes();
9273
- RULE_NAME13 = "prefer-composite-properties";
9274
- rule13 = createRule({
9275
- name: RULE_NAME13,
9382
+ RULE_NAME14 = "prefer-composite-properties";
9383
+ rule14 = createRule({
9384
+ name: RULE_NAME14,
9276
9385
  meta: {
9277
9386
  docs: {
9278
9387
  description: "Encourage the use of composite properties instead of atomic properties in the codebase."
@@ -9326,7 +9435,90 @@ var init_prefer_composite_properties = __esm({
9326
9435
  };
9327
9436
  }
9328
9437
  });
9329
- prefer_composite_properties_default = rule13;
9438
+ prefer_composite_properties_default = rule14;
9439
+ }
9440
+ });
9441
+
9442
+ // src/rules/prefer-unified-property-style.ts
9443
+ var RULE_NAME15, rule15, prefer_unified_property_style_default;
9444
+ var init_prefer_unified_property_style = __esm({
9445
+ "src/rules/prefer-unified-property-style.ts"() {
9446
+ "use strict";
9447
+ init_esm_shims();
9448
+ init_helpers();
9449
+ init_utils();
9450
+ init_composite_properties();
9451
+ init_nodes();
9452
+ RULE_NAME15 = "prefer-unified-property-style";
9453
+ rule15 = createRule({
9454
+ name: RULE_NAME15,
9455
+ meta: {
9456
+ docs: {
9457
+ description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
9458
+ },
9459
+ messages: {
9460
+ unify: "You're mixing atomic {{atomicProperties}} with composite property {{composite}}. \nPrefer atomic styling to mixing atomic and composite properties. \nRemove `{{composite}}` and use one or more of {{atomics}} instead"
9461
+ },
9462
+ type: "suggestion",
9463
+ schema: []
9464
+ },
9465
+ defaultOptions: [],
9466
+ create(context) {
9467
+ const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
9468
+ const resolveCompositeProperty = (name2) => {
9469
+ if (Object.hasOwn(compositeProperties, name2))
9470
+ return name2;
9471
+ const longhand = getLonghand(name2);
9472
+ if (isValidProperty(longhand, context) && Object.hasOwn(compositeProperties, longhand))
9473
+ return longhand;
9474
+ };
9475
+ const sendReport = (node, cmp, siblings) => {
9476
+ const _atomicProperties = siblings.filter((prop) => compositeProperties[cmp].includes(getLonghand(prop))).map((prop) => `\`${prop}\``);
9477
+ if (!_atomicProperties.length)
9478
+ return;
9479
+ const atomicProperties = _atomicProperties.join(", ") + (_atomicProperties.length === 1 ? " style" : " styles");
9480
+ const atomics = compositeProperties[cmp].map((name2) => `\`${name2}\``).join(", ");
9481
+ context.report({
9482
+ node,
9483
+ messageId: "unify",
9484
+ data: {
9485
+ composite: cmp,
9486
+ atomicProperties,
9487
+ atomics
9488
+ }
9489
+ });
9490
+ };
9491
+ return {
9492
+ JSXAttribute(node) {
9493
+ if (!isJSXIdentifier(node.name))
9494
+ return;
9495
+ if (!isPandaProp(node, context))
9496
+ return;
9497
+ const cmp = resolveCompositeProperty(node.name.name);
9498
+ if (!cmp)
9499
+ return;
9500
+ if (!isJSXOpeningElement(node.parent))
9501
+ return;
9502
+ const siblings = node.parent.attributes.map((attr) => attr.name.name);
9503
+ sendReport(node, cmp, siblings);
9504
+ },
9505
+ Property(node) {
9506
+ if (!isIdentifier(node.key))
9507
+ return;
9508
+ if (!isPandaAttribute(node, context))
9509
+ return;
9510
+ const cmp = resolveCompositeProperty(node.key.name);
9511
+ if (!cmp)
9512
+ return;
9513
+ if (!isObjectExpression(node.parent))
9514
+ return;
9515
+ const siblings = node.parent.properties.map((prop) => isIdentifier(prop.key) && prop.key.name);
9516
+ sendReport(node.key, cmp, siblings);
9517
+ }
9518
+ };
9519
+ }
9520
+ });
9521
+ prefer_unified_property_style_default = rule15;
9330
9522
  }
9331
9523
  });
9332
9524
 
@@ -9342,13 +9534,15 @@ var init_rules = __esm({
9342
9534
  init_no_dynamic_styling();
9343
9535
  init_no_escape_hatch();
9344
9536
  init_no_hardcoded_color();
9537
+ init_no_important();
9345
9538
  init_no_invalid_token_paths();
9346
9539
  init_no_property_renaming();
9540
+ init_no_unsafe_token_fn_usage();
9347
9541
  init_prefer_longhand_properties();
9348
9542
  init_prefer_shorthand_properties();
9349
- init_no_unsafe_token_fn_usage();
9350
9543
  init_prefer_atomic_properties();
9351
9544
  init_prefer_composite_properties();
9545
+ init_prefer_unified_property_style();
9352
9546
  rules = {
9353
9547
  [RULE_NAME]: file_not_included_default,
9354
9548
  [RULE_NAME2]: no_config_function_in_source_default,
@@ -9356,13 +9550,15 @@ var init_rules = __esm({
9356
9550
  [RULE_NAME4]: no_dynamic_styling_default,
9357
9551
  [RULE_NAME5]: no_escape_hatch_default,
9358
9552
  [RULE_NAME6]: no_hardcoded_color_default,
9359
- [RULE_NAME7]: no_invalid_token_paths_default,
9360
- [RULE_NAME8]: no_property_renaming_default,
9361
- [RULE_NAME9]: prefer_longhand_properties_default,
9362
- [RULE_NAME10]: prefer_shorthand_properties_default,
9363
- [RULE_NAME11]: no_unsafe_token_fn_usage_default,
9364
- [RULE_NAME12]: prefer_atomic_properties_default,
9365
- [RULE_NAME13]: prefer_composite_properties_default
9553
+ [RULE_NAME7]: no_important_default,
9554
+ [RULE_NAME8]: no_invalid_token_paths_default,
9555
+ [RULE_NAME9]: no_property_renaming_default,
9556
+ [RULE_NAME10]: no_unsafe_token_fn_usage_default,
9557
+ [RULE_NAME11]: prefer_longhand_properties_default,
9558
+ [RULE_NAME12]: prefer_shorthand_properties_default,
9559
+ [RULE_NAME13]: prefer_atomic_properties_default,
9560
+ [RULE_NAME14]: prefer_composite_properties_default,
9561
+ [RULE_NAME15]: prefer_unified_property_style_default
9366
9562
  };
9367
9563
  }
9368
9564
  });
@@ -9377,7 +9573,7 @@ var init_all = __esm({
9377
9573
  init_file_not_included();
9378
9574
  init_no_config_function_in_source();
9379
9575
  init_no_invalid_token_paths();
9380
- errorRules = [RULE_NAME, RULE_NAME2, RULE_NAME7];
9576
+ errorRules = [RULE_NAME, RULE_NAME2, RULE_NAME8];
9381
9577
  allRules = Object.fromEntries(
9382
9578
  Object.entries(rules).map(([name2]) => {
9383
9579
  return [`@pandacss/${name2}`, errorRules.includes(name2) ? "error" : "warn"];
@@ -9407,8 +9603,9 @@ var init_recommended = __esm({
9407
9603
  "@pandacss/no-config-function-in-source": "error",
9408
9604
  "@pandacss/no-debug": "warn",
9409
9605
  "@pandacss/no-dynamic-styling": "warn",
9606
+ "@pandacss/no-invalid-token-paths": "error",
9410
9607
  "@pandacss/no-property-renaming": "warn",
9411
- "@pandacss/no-invalid-token-paths": "error"
9608
+ "@pandacss/prefer-unified-property-style": "warn"
9412
9609
  }
9413
9610
  };
9414
9611
  }