@pandacss/eslint-plugin 0.0.13 → 0.0.15
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 +149 -39
- package/dist/index.mjs +171 -46
- package/dist/utils/worker.js +4 -6
- package/dist/utils/worker.mjs +4 -6
- 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.
|
|
7960
|
+
var version = "0.0.15";
|
|
7961
7961
|
|
|
7962
7962
|
// src/configs/all.ts
|
|
7963
7963
|
init_cjs_shims();
|
|
@@ -8170,7 +8170,7 @@ var isPandaAttribute = (node, context) => {
|
|
|
8170
8170
|
return;
|
|
8171
8171
|
return isStyledProperty(node, context, callee);
|
|
8172
8172
|
}
|
|
8173
|
-
return isInJSXProp(node, context);
|
|
8173
|
+
return isInJSXProp(node, context) && isStyledProperty(node, context);
|
|
8174
8174
|
};
|
|
8175
8175
|
var resolveLonghand = (name2, context) => {
|
|
8176
8176
|
return syncAction("resolveLongHand", getSyncOpts(context), name2);
|
|
@@ -8715,6 +8715,8 @@ var rule8 = createRule({
|
|
|
8715
8715
|
return;
|
|
8716
8716
|
if (!isInPandaFunction(node, context) && !isInJSXProp(node, context))
|
|
8717
8717
|
return;
|
|
8718
|
+
if (isStyledProperty(node, context))
|
|
8719
|
+
return;
|
|
8718
8720
|
const invalidLiteral = isLiteral(node.key) && typeof node.key.value === "string" && !node.key.value.includes("&");
|
|
8719
8721
|
const invalidTemplateLiteral = isTemplateLiteral(node.key) && !node.key.quasis[0].value.raw.includes("&");
|
|
8720
8722
|
if (invalidLiteral || invalidTemplateLiteral) {
|
|
@@ -8837,11 +8839,118 @@ var rule9 = createRule({
|
|
|
8837
8839
|
});
|
|
8838
8840
|
var no_invalid_token_paths_default = rule9;
|
|
8839
8841
|
|
|
8840
|
-
// src/rules/no-
|
|
8842
|
+
// src/rules/no-physical-properties.ts
|
|
8841
8843
|
init_cjs_shims();
|
|
8842
|
-
|
|
8844
|
+
|
|
8845
|
+
// src/utils/physical-properties.ts
|
|
8846
|
+
init_cjs_shims();
|
|
8847
|
+
var physicalProperties = {
|
|
8848
|
+
borderBottom: "borderBlockEnd",
|
|
8849
|
+
borderBottomColor: "borderBlockEndColor",
|
|
8850
|
+
borderBottomStyle: "borderBlockEndStyle",
|
|
8851
|
+
borderBottomWidth: "borderBlockEndWidth",
|
|
8852
|
+
borderTop: "borderBlockStart",
|
|
8853
|
+
borderTopColor: "borderBlockStartColor",
|
|
8854
|
+
borderTopStyle: "borderBlockStartStyle",
|
|
8855
|
+
borderTopWidth: "borderBlockStartWidth",
|
|
8856
|
+
borderRight: "borderInlineEnd",
|
|
8857
|
+
borderRightColor: "borderInlineEndColor",
|
|
8858
|
+
borderRightStyle: "borderInlineEndStyle",
|
|
8859
|
+
borderRightWidth: "borderInlineEndWidth",
|
|
8860
|
+
borderLeft: "borderInlineStart",
|
|
8861
|
+
borderLeftColor: "borderInlineStartColor",
|
|
8862
|
+
borderLeftStyle: "borderInlineStartStyle",
|
|
8863
|
+
borderLeftWidth: "borderInlineStartWidth",
|
|
8864
|
+
borderTopLeftRadius: "borderStartStartRadius",
|
|
8865
|
+
borderBottomLeftRadius: "borderEndStartRadius",
|
|
8866
|
+
borderTopRightRadius: "borderStartEndRadius",
|
|
8867
|
+
borderBottomRightRadius: "borderEndEndRadius",
|
|
8868
|
+
marginBottom: "marginBlockEnd",
|
|
8869
|
+
marginTop: "marginBlockStart",
|
|
8870
|
+
marginRight: "marginInlineEnd",
|
|
8871
|
+
marginLeft: "marginInlineStart",
|
|
8872
|
+
paddingBottom: "paddingBlockEnd",
|
|
8873
|
+
paddingTop: "paddingBlockStart",
|
|
8874
|
+
paddingRight: "paddingInlineEnd",
|
|
8875
|
+
paddingLeft: "paddingInlineStart",
|
|
8876
|
+
left: "insetInlineStart",
|
|
8877
|
+
right: "insetInlineEnd",
|
|
8878
|
+
top: "insetBlockStart",
|
|
8879
|
+
bottom: "insetBlockEnd"
|
|
8880
|
+
};
|
|
8881
|
+
|
|
8882
|
+
// src/rules/no-physical-properties.ts
|
|
8883
|
+
var RULE_NAME10 = "no-physical-properties";
|
|
8843
8884
|
var rule10 = createRule({
|
|
8844
8885
|
name: RULE_NAME10,
|
|
8886
|
+
meta: {
|
|
8887
|
+
docs: {
|
|
8888
|
+
description: "Encourage the use of [logical properties](https://mdn.io/logical-properties-basic-concepts) over physical proeprties, to foster a responsive and adaptable user interface."
|
|
8889
|
+
},
|
|
8890
|
+
messages: {
|
|
8891
|
+
physical: "Use logical property of {{physical}} instead. Prefer `{{logical}}`",
|
|
8892
|
+
replace: "Replace `{{physical}}` with `{{logical}}`"
|
|
8893
|
+
},
|
|
8894
|
+
type: "suggestion",
|
|
8895
|
+
hasSuggestions: true,
|
|
8896
|
+
schema: []
|
|
8897
|
+
},
|
|
8898
|
+
defaultOptions: [],
|
|
8899
|
+
create(context) {
|
|
8900
|
+
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
8901
|
+
const sendReport = (node, name2) => {
|
|
8902
|
+
const logical = physicalProperties[getLonghand(name2)];
|
|
8903
|
+
const longhand = resolveLonghand(name2, context);
|
|
8904
|
+
return context.report({
|
|
8905
|
+
node,
|
|
8906
|
+
messageId: "physical",
|
|
8907
|
+
data: {
|
|
8908
|
+
physical: `\`${name2}\`${longhand ? ` - \`${longhand}\`` : ""}`,
|
|
8909
|
+
logical
|
|
8910
|
+
},
|
|
8911
|
+
suggest: [
|
|
8912
|
+
{
|
|
8913
|
+
messageId: "replace",
|
|
8914
|
+
data: {
|
|
8915
|
+
physical: name2,
|
|
8916
|
+
logical
|
|
8917
|
+
},
|
|
8918
|
+
fix: (fixer) => {
|
|
8919
|
+
return fixer.replaceTextRange(node.range, logical);
|
|
8920
|
+
}
|
|
8921
|
+
}
|
|
8922
|
+
]
|
|
8923
|
+
});
|
|
8924
|
+
};
|
|
8925
|
+
return {
|
|
8926
|
+
JSXAttribute(node) {
|
|
8927
|
+
if (!isJSXIdentifier(node.name))
|
|
8928
|
+
return;
|
|
8929
|
+
if (!isPandaProp(node, context))
|
|
8930
|
+
return;
|
|
8931
|
+
if (getLonghand(node.name.name) in physicalProperties) {
|
|
8932
|
+
sendReport(node.name, node.name.name);
|
|
8933
|
+
}
|
|
8934
|
+
},
|
|
8935
|
+
Property(node) {
|
|
8936
|
+
if (!isIdentifier(node.key))
|
|
8937
|
+
return;
|
|
8938
|
+
if (!isPandaAttribute(node, context))
|
|
8939
|
+
return;
|
|
8940
|
+
if (getLonghand(node.key.name) in physicalProperties) {
|
|
8941
|
+
sendReport(node.key, node.key.name);
|
|
8942
|
+
}
|
|
8943
|
+
}
|
|
8944
|
+
};
|
|
8945
|
+
}
|
|
8946
|
+
});
|
|
8947
|
+
var no_physical_properties_default = rule10;
|
|
8948
|
+
|
|
8949
|
+
// src/rules/no-property-renaming.ts
|
|
8950
|
+
init_cjs_shims();
|
|
8951
|
+
var RULE_NAME11 = "no-property-renaming";
|
|
8952
|
+
var rule11 = createRule({
|
|
8953
|
+
name: RULE_NAME11,
|
|
8845
8954
|
meta: {
|
|
8846
8955
|
docs: {
|
|
8847
8956
|
description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
|
|
@@ -8900,15 +9009,15 @@ var rule10 = createRule({
|
|
|
8900
9009
|
};
|
|
8901
9010
|
}
|
|
8902
9011
|
});
|
|
8903
|
-
var no_property_renaming_default =
|
|
9012
|
+
var no_property_renaming_default = rule11;
|
|
8904
9013
|
|
|
8905
9014
|
// src/rules/no-unsafe-token-fn-usage.ts
|
|
8906
9015
|
init_cjs_shims();
|
|
8907
|
-
var
|
|
9016
|
+
var import_utils16 = require("@typescript-eslint/utils");
|
|
8908
9017
|
var import_shared3 = require("@pandacss/shared");
|
|
8909
|
-
var
|
|
8910
|
-
var
|
|
8911
|
-
name:
|
|
9018
|
+
var RULE_NAME12 = "no-unsafe-token-fn-usage";
|
|
9019
|
+
var rule12 = createRule({
|
|
9020
|
+
name: RULE_NAME12,
|
|
8912
9021
|
meta: {
|
|
8913
9022
|
docs: {
|
|
8914
9023
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
@@ -9004,13 +9113,13 @@ var rule11 = createRule({
|
|
|
9004
9113
|
};
|
|
9005
9114
|
}
|
|
9006
9115
|
});
|
|
9007
|
-
var no_unsafe_token_fn_usage_default =
|
|
9116
|
+
var no_unsafe_token_fn_usage_default = rule12;
|
|
9008
9117
|
|
|
9009
9118
|
// src/rules/prefer-longhand-properties.ts
|
|
9010
9119
|
init_cjs_shims();
|
|
9011
|
-
var
|
|
9012
|
-
var
|
|
9013
|
-
name:
|
|
9120
|
+
var RULE_NAME13 = "prefer-longhand-properties";
|
|
9121
|
+
var rule13 = createRule({
|
|
9122
|
+
name: RULE_NAME13,
|
|
9014
9123
|
meta: {
|
|
9015
9124
|
docs: {
|
|
9016
9125
|
description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
|
|
@@ -9070,13 +9179,13 @@ var rule12 = createRule({
|
|
|
9070
9179
|
};
|
|
9071
9180
|
}
|
|
9072
9181
|
});
|
|
9073
|
-
var prefer_longhand_properties_default =
|
|
9182
|
+
var prefer_longhand_properties_default = rule13;
|
|
9074
9183
|
|
|
9075
9184
|
// src/rules/prefer-shorthand-properties.ts
|
|
9076
9185
|
init_cjs_shims();
|
|
9077
|
-
var
|
|
9078
|
-
var
|
|
9079
|
-
name:
|
|
9186
|
+
var RULE_NAME14 = "prefer-shorthand-properties";
|
|
9187
|
+
var rule14 = createRule({
|
|
9188
|
+
name: RULE_NAME14,
|
|
9080
9189
|
meta: {
|
|
9081
9190
|
docs: {
|
|
9082
9191
|
description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
|
|
@@ -9139,7 +9248,7 @@ var rule13 = createRule({
|
|
|
9139
9248
|
};
|
|
9140
9249
|
}
|
|
9141
9250
|
});
|
|
9142
|
-
var prefer_shorthand_properties_default =
|
|
9251
|
+
var prefer_shorthand_properties_default = rule14;
|
|
9143
9252
|
|
|
9144
9253
|
// src/rules/prefer-atomic-properties.ts
|
|
9145
9254
|
init_cjs_shims();
|
|
@@ -9259,9 +9368,9 @@ var compositeProperties = {
|
|
|
9259
9368
|
};
|
|
9260
9369
|
|
|
9261
9370
|
// src/rules/prefer-atomic-properties.ts
|
|
9262
|
-
var
|
|
9263
|
-
var
|
|
9264
|
-
name:
|
|
9371
|
+
var RULE_NAME15 = "prefer-atomic-properties";
|
|
9372
|
+
var rule15 = createRule({
|
|
9373
|
+
name: RULE_NAME15,
|
|
9265
9374
|
meta: {
|
|
9266
9375
|
docs: {
|
|
9267
9376
|
description: "Encourage the use of atomic properties instead of composite properties in the codebase."
|
|
@@ -9317,13 +9426,13 @@ var rule14 = createRule({
|
|
|
9317
9426
|
};
|
|
9318
9427
|
}
|
|
9319
9428
|
});
|
|
9320
|
-
var prefer_atomic_properties_default =
|
|
9429
|
+
var prefer_atomic_properties_default = rule15;
|
|
9321
9430
|
|
|
9322
9431
|
// src/rules/prefer-composite-properties.ts
|
|
9323
9432
|
init_cjs_shims();
|
|
9324
|
-
var
|
|
9325
|
-
var
|
|
9326
|
-
name:
|
|
9433
|
+
var RULE_NAME16 = "prefer-composite-properties";
|
|
9434
|
+
var rule16 = createRule({
|
|
9435
|
+
name: RULE_NAME16,
|
|
9327
9436
|
meta: {
|
|
9328
9437
|
docs: {
|
|
9329
9438
|
description: "Encourage the use of composite properties instead of atomic properties in the codebase."
|
|
@@ -9377,13 +9486,13 @@ var rule15 = createRule({
|
|
|
9377
9486
|
};
|
|
9378
9487
|
}
|
|
9379
9488
|
});
|
|
9380
|
-
var prefer_composite_properties_default =
|
|
9489
|
+
var prefer_composite_properties_default = rule16;
|
|
9381
9490
|
|
|
9382
9491
|
// src/rules/prefer-unified-property-style.ts
|
|
9383
9492
|
init_cjs_shims();
|
|
9384
|
-
var
|
|
9385
|
-
var
|
|
9386
|
-
name:
|
|
9493
|
+
var RULE_NAME17 = "prefer-unified-property-style";
|
|
9494
|
+
var rule17 = createRule({
|
|
9495
|
+
name: RULE_NAME17,
|
|
9387
9496
|
meta: {
|
|
9388
9497
|
docs: {
|
|
9389
9498
|
description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
|
|
@@ -9398,10 +9507,10 @@ var rule16 = createRule({
|
|
|
9398
9507
|
create(context) {
|
|
9399
9508
|
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
9400
9509
|
const resolveCompositeProperty = (name2) => {
|
|
9401
|
-
if (
|
|
9510
|
+
if (name2 in compositeProperties)
|
|
9402
9511
|
return name2;
|
|
9403
9512
|
const longhand = getLonghand(name2);
|
|
9404
|
-
if (isValidProperty(longhand, context) &&
|
|
9513
|
+
if (isValidProperty(longhand, context) && longhand in compositeProperties)
|
|
9405
9514
|
return longhand;
|
|
9406
9515
|
};
|
|
9407
9516
|
const sendReport = (node, cmp, siblings) => {
|
|
@@ -9450,7 +9559,7 @@ var rule16 = createRule({
|
|
|
9450
9559
|
};
|
|
9451
9560
|
}
|
|
9452
9561
|
});
|
|
9453
|
-
var prefer_unified_property_style_default =
|
|
9562
|
+
var prefer_unified_property_style_default = rule17;
|
|
9454
9563
|
|
|
9455
9564
|
// src/rules/index.ts
|
|
9456
9565
|
var rules = {
|
|
@@ -9463,13 +9572,14 @@ var rules = {
|
|
|
9463
9572
|
[RULE_NAME7]: no_important_default,
|
|
9464
9573
|
[RULE_NAME9]: no_invalid_token_paths_default,
|
|
9465
9574
|
[RULE_NAME8]: no_invalid_nesting_default,
|
|
9466
|
-
[
|
|
9467
|
-
[
|
|
9468
|
-
[RULE_NAME12]:
|
|
9469
|
-
[RULE_NAME13]:
|
|
9470
|
-
[RULE_NAME14]:
|
|
9471
|
-
[RULE_NAME15]:
|
|
9472
|
-
[RULE_NAME16]:
|
|
9575
|
+
[RULE_NAME11]: no_property_renaming_default,
|
|
9576
|
+
[RULE_NAME10]: no_physical_properties_default,
|
|
9577
|
+
[RULE_NAME12]: no_unsafe_token_fn_usage_default,
|
|
9578
|
+
[RULE_NAME13]: prefer_longhand_properties_default,
|
|
9579
|
+
[RULE_NAME14]: prefer_shorthand_properties_default,
|
|
9580
|
+
[RULE_NAME15]: prefer_atomic_properties_default,
|
|
9581
|
+
[RULE_NAME16]: prefer_composite_properties_default,
|
|
9582
|
+
[RULE_NAME17]: prefer_unified_property_style_default
|
|
9473
9583
|
};
|
|
9474
9584
|
|
|
9475
9585
|
// src/configs/all.ts
|
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.
|
|
13
|
+
version = "0.0.15";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -8146,7 +8146,7 @@ var init_helpers = __esm({
|
|
|
8146
8146
|
return;
|
|
8147
8147
|
return isStyledProperty(node, context, callee);
|
|
8148
8148
|
}
|
|
8149
|
-
return isInJSXProp(node, context);
|
|
8149
|
+
return isInJSXProp(node, context) && isStyledProperty(node, context);
|
|
8150
8150
|
};
|
|
8151
8151
|
resolveLonghand = (name2, context) => {
|
|
8152
8152
|
return syncAction("resolveLongHand", getSyncOpts(context), name2);
|
|
@@ -8763,6 +8763,8 @@ var init_no_invalid_nesting = __esm({
|
|
|
8763
8763
|
return;
|
|
8764
8764
|
if (!isInPandaFunction(node, context) && !isInJSXProp(node, context))
|
|
8765
8765
|
return;
|
|
8766
|
+
if (isStyledProperty(node, context))
|
|
8767
|
+
return;
|
|
8766
8768
|
const invalidLiteral = isLiteral(node.key) && typeof node.key.value === "string" && !node.key.value.includes("&");
|
|
8767
8769
|
const invalidTemplateLiteral = isTemplateLiteral(node.key) && !node.key.quasis[0].value.raw.includes("&");
|
|
8768
8770
|
if (invalidLiteral || invalidTemplateLiteral) {
|
|
@@ -8896,8 +8898,129 @@ var init_no_invalid_token_paths = __esm({
|
|
|
8896
8898
|
}
|
|
8897
8899
|
});
|
|
8898
8900
|
|
|
8901
|
+
// src/utils/physical-properties.ts
|
|
8902
|
+
var physicalProperties;
|
|
8903
|
+
var init_physical_properties = __esm({
|
|
8904
|
+
"src/utils/physical-properties.ts"() {
|
|
8905
|
+
"use strict";
|
|
8906
|
+
init_esm_shims();
|
|
8907
|
+
physicalProperties = {
|
|
8908
|
+
borderBottom: "borderBlockEnd",
|
|
8909
|
+
borderBottomColor: "borderBlockEndColor",
|
|
8910
|
+
borderBottomStyle: "borderBlockEndStyle",
|
|
8911
|
+
borderBottomWidth: "borderBlockEndWidth",
|
|
8912
|
+
borderTop: "borderBlockStart",
|
|
8913
|
+
borderTopColor: "borderBlockStartColor",
|
|
8914
|
+
borderTopStyle: "borderBlockStartStyle",
|
|
8915
|
+
borderTopWidth: "borderBlockStartWidth",
|
|
8916
|
+
borderRight: "borderInlineEnd",
|
|
8917
|
+
borderRightColor: "borderInlineEndColor",
|
|
8918
|
+
borderRightStyle: "borderInlineEndStyle",
|
|
8919
|
+
borderRightWidth: "borderInlineEndWidth",
|
|
8920
|
+
borderLeft: "borderInlineStart",
|
|
8921
|
+
borderLeftColor: "borderInlineStartColor",
|
|
8922
|
+
borderLeftStyle: "borderInlineStartStyle",
|
|
8923
|
+
borderLeftWidth: "borderInlineStartWidth",
|
|
8924
|
+
borderTopLeftRadius: "borderStartStartRadius",
|
|
8925
|
+
borderBottomLeftRadius: "borderEndStartRadius",
|
|
8926
|
+
borderTopRightRadius: "borderStartEndRadius",
|
|
8927
|
+
borderBottomRightRadius: "borderEndEndRadius",
|
|
8928
|
+
marginBottom: "marginBlockEnd",
|
|
8929
|
+
marginTop: "marginBlockStart",
|
|
8930
|
+
marginRight: "marginInlineEnd",
|
|
8931
|
+
marginLeft: "marginInlineStart",
|
|
8932
|
+
paddingBottom: "paddingBlockEnd",
|
|
8933
|
+
paddingTop: "paddingBlockStart",
|
|
8934
|
+
paddingRight: "paddingInlineEnd",
|
|
8935
|
+
paddingLeft: "paddingInlineStart",
|
|
8936
|
+
left: "insetInlineStart",
|
|
8937
|
+
right: "insetInlineEnd",
|
|
8938
|
+
top: "insetBlockStart",
|
|
8939
|
+
bottom: "insetBlockEnd"
|
|
8940
|
+
};
|
|
8941
|
+
}
|
|
8942
|
+
});
|
|
8943
|
+
|
|
8944
|
+
// src/rules/no-physical-properties.ts
|
|
8945
|
+
var RULE_NAME10, rule10, no_physical_properties_default;
|
|
8946
|
+
var init_no_physical_properties = __esm({
|
|
8947
|
+
"src/rules/no-physical-properties.ts"() {
|
|
8948
|
+
"use strict";
|
|
8949
|
+
init_esm_shims();
|
|
8950
|
+
init_helpers();
|
|
8951
|
+
init_utils();
|
|
8952
|
+
init_nodes();
|
|
8953
|
+
init_physical_properties();
|
|
8954
|
+
RULE_NAME10 = "no-physical-properties";
|
|
8955
|
+
rule10 = createRule({
|
|
8956
|
+
name: RULE_NAME10,
|
|
8957
|
+
meta: {
|
|
8958
|
+
docs: {
|
|
8959
|
+
description: "Encourage the use of [logical properties](https://mdn.io/logical-properties-basic-concepts) over physical proeprties, to foster a responsive and adaptable user interface."
|
|
8960
|
+
},
|
|
8961
|
+
messages: {
|
|
8962
|
+
physical: "Use logical property of {{physical}} instead. Prefer `{{logical}}`",
|
|
8963
|
+
replace: "Replace `{{physical}}` with `{{logical}}`"
|
|
8964
|
+
},
|
|
8965
|
+
type: "suggestion",
|
|
8966
|
+
hasSuggestions: true,
|
|
8967
|
+
schema: []
|
|
8968
|
+
},
|
|
8969
|
+
defaultOptions: [],
|
|
8970
|
+
create(context) {
|
|
8971
|
+
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
8972
|
+
const sendReport = (node, name2) => {
|
|
8973
|
+
const logical = physicalProperties[getLonghand(name2)];
|
|
8974
|
+
const longhand = resolveLonghand(name2, context);
|
|
8975
|
+
return context.report({
|
|
8976
|
+
node,
|
|
8977
|
+
messageId: "physical",
|
|
8978
|
+
data: {
|
|
8979
|
+
physical: `\`${name2}\`${longhand ? ` - \`${longhand}\`` : ""}`,
|
|
8980
|
+
logical
|
|
8981
|
+
},
|
|
8982
|
+
suggest: [
|
|
8983
|
+
{
|
|
8984
|
+
messageId: "replace",
|
|
8985
|
+
data: {
|
|
8986
|
+
physical: name2,
|
|
8987
|
+
logical
|
|
8988
|
+
},
|
|
8989
|
+
fix: (fixer) => {
|
|
8990
|
+
return fixer.replaceTextRange(node.range, logical);
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
]
|
|
8994
|
+
});
|
|
8995
|
+
};
|
|
8996
|
+
return {
|
|
8997
|
+
JSXAttribute(node) {
|
|
8998
|
+
if (!isJSXIdentifier(node.name))
|
|
8999
|
+
return;
|
|
9000
|
+
if (!isPandaProp(node, context))
|
|
9001
|
+
return;
|
|
9002
|
+
if (getLonghand(node.name.name) in physicalProperties) {
|
|
9003
|
+
sendReport(node.name, node.name.name);
|
|
9004
|
+
}
|
|
9005
|
+
},
|
|
9006
|
+
Property(node) {
|
|
9007
|
+
if (!isIdentifier(node.key))
|
|
9008
|
+
return;
|
|
9009
|
+
if (!isPandaAttribute(node, context))
|
|
9010
|
+
return;
|
|
9011
|
+
if (getLonghand(node.key.name) in physicalProperties) {
|
|
9012
|
+
sendReport(node.key, node.key.name);
|
|
9013
|
+
}
|
|
9014
|
+
}
|
|
9015
|
+
};
|
|
9016
|
+
}
|
|
9017
|
+
});
|
|
9018
|
+
no_physical_properties_default = rule10;
|
|
9019
|
+
}
|
|
9020
|
+
});
|
|
9021
|
+
|
|
8899
9022
|
// src/rules/no-property-renaming.ts
|
|
8900
|
-
var
|
|
9023
|
+
var RULE_NAME11, rule11, no_property_renaming_default;
|
|
8901
9024
|
var init_no_property_renaming = __esm({
|
|
8902
9025
|
"src/rules/no-property-renaming.ts"() {
|
|
8903
9026
|
"use strict";
|
|
@@ -8905,9 +9028,9 @@ var init_no_property_renaming = __esm({
|
|
|
8905
9028
|
init_utils();
|
|
8906
9029
|
init_helpers();
|
|
8907
9030
|
init_nodes();
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
name:
|
|
9031
|
+
RULE_NAME11 = "no-property-renaming";
|
|
9032
|
+
rule11 = createRule({
|
|
9033
|
+
name: RULE_NAME11,
|
|
8911
9034
|
meta: {
|
|
8912
9035
|
docs: {
|
|
8913
9036
|
description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
|
|
@@ -8966,14 +9089,14 @@ var init_no_property_renaming = __esm({
|
|
|
8966
9089
|
};
|
|
8967
9090
|
}
|
|
8968
9091
|
});
|
|
8969
|
-
no_property_renaming_default =
|
|
9092
|
+
no_property_renaming_default = rule11;
|
|
8970
9093
|
}
|
|
8971
9094
|
});
|
|
8972
9095
|
|
|
8973
9096
|
// src/rules/no-unsafe-token-fn-usage.ts
|
|
8974
9097
|
import "@typescript-eslint/utils";
|
|
8975
9098
|
import { getArbitraryValue as getArbitraryValue3 } from "@pandacss/shared";
|
|
8976
|
-
var
|
|
9099
|
+
var RULE_NAME12, rule12, no_unsafe_token_fn_usage_default;
|
|
8977
9100
|
var init_no_unsafe_token_fn_usage = __esm({
|
|
8978
9101
|
"src/rules/no-unsafe-token-fn-usage.ts"() {
|
|
8979
9102
|
"use strict";
|
|
@@ -8981,9 +9104,9 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8981
9104
|
init_helpers();
|
|
8982
9105
|
init_utils();
|
|
8983
9106
|
init_nodes();
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
name:
|
|
9107
|
+
RULE_NAME12 = "no-unsafe-token-fn-usage";
|
|
9108
|
+
rule12 = createRule({
|
|
9109
|
+
name: RULE_NAME12,
|
|
8987
9110
|
meta: {
|
|
8988
9111
|
docs: {
|
|
8989
9112
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
@@ -9079,12 +9202,12 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
9079
9202
|
};
|
|
9080
9203
|
}
|
|
9081
9204
|
});
|
|
9082
|
-
no_unsafe_token_fn_usage_default =
|
|
9205
|
+
no_unsafe_token_fn_usage_default = rule12;
|
|
9083
9206
|
}
|
|
9084
9207
|
});
|
|
9085
9208
|
|
|
9086
9209
|
// src/rules/prefer-longhand-properties.ts
|
|
9087
|
-
var
|
|
9210
|
+
var RULE_NAME13, rule13, prefer_longhand_properties_default;
|
|
9088
9211
|
var init_prefer_longhand_properties = __esm({
|
|
9089
9212
|
"src/rules/prefer-longhand-properties.ts"() {
|
|
9090
9213
|
"use strict";
|
|
@@ -9092,9 +9215,9 @@ var init_prefer_longhand_properties = __esm({
|
|
|
9092
9215
|
init_helpers();
|
|
9093
9216
|
init_utils();
|
|
9094
9217
|
init_nodes();
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
name:
|
|
9218
|
+
RULE_NAME13 = "prefer-longhand-properties";
|
|
9219
|
+
rule13 = createRule({
|
|
9220
|
+
name: RULE_NAME13,
|
|
9098
9221
|
meta: {
|
|
9099
9222
|
docs: {
|
|
9100
9223
|
description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
|
|
@@ -9154,12 +9277,12 @@ var init_prefer_longhand_properties = __esm({
|
|
|
9154
9277
|
};
|
|
9155
9278
|
}
|
|
9156
9279
|
});
|
|
9157
|
-
prefer_longhand_properties_default =
|
|
9280
|
+
prefer_longhand_properties_default = rule13;
|
|
9158
9281
|
}
|
|
9159
9282
|
});
|
|
9160
9283
|
|
|
9161
9284
|
// src/rules/prefer-shorthand-properties.ts
|
|
9162
|
-
var
|
|
9285
|
+
var RULE_NAME14, rule14, prefer_shorthand_properties_default;
|
|
9163
9286
|
var init_prefer_shorthand_properties = __esm({
|
|
9164
9287
|
"src/rules/prefer-shorthand-properties.ts"() {
|
|
9165
9288
|
"use strict";
|
|
@@ -9167,9 +9290,9 @@ var init_prefer_shorthand_properties = __esm({
|
|
|
9167
9290
|
init_helpers();
|
|
9168
9291
|
init_utils();
|
|
9169
9292
|
init_nodes();
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
name:
|
|
9293
|
+
RULE_NAME14 = "prefer-shorthand-properties";
|
|
9294
|
+
rule14 = createRule({
|
|
9295
|
+
name: RULE_NAME14,
|
|
9173
9296
|
meta: {
|
|
9174
9297
|
docs: {
|
|
9175
9298
|
description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
|
|
@@ -9232,7 +9355,7 @@ var init_prefer_shorthand_properties = __esm({
|
|
|
9232
9355
|
};
|
|
9233
9356
|
}
|
|
9234
9357
|
});
|
|
9235
|
-
prefer_shorthand_properties_default =
|
|
9358
|
+
prefer_shorthand_properties_default = rule14;
|
|
9236
9359
|
}
|
|
9237
9360
|
});
|
|
9238
9361
|
|
|
@@ -9357,7 +9480,7 @@ var init_composite_properties = __esm({
|
|
|
9357
9480
|
});
|
|
9358
9481
|
|
|
9359
9482
|
// src/rules/prefer-atomic-properties.ts
|
|
9360
|
-
var
|
|
9483
|
+
var RULE_NAME15, rule15, prefer_atomic_properties_default;
|
|
9361
9484
|
var init_prefer_atomic_properties = __esm({
|
|
9362
9485
|
"src/rules/prefer-atomic-properties.ts"() {
|
|
9363
9486
|
"use strict";
|
|
@@ -9366,9 +9489,9 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9366
9489
|
init_utils();
|
|
9367
9490
|
init_composite_properties();
|
|
9368
9491
|
init_nodes();
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
name:
|
|
9492
|
+
RULE_NAME15 = "prefer-atomic-properties";
|
|
9493
|
+
rule15 = createRule({
|
|
9494
|
+
name: RULE_NAME15,
|
|
9372
9495
|
meta: {
|
|
9373
9496
|
docs: {
|
|
9374
9497
|
description: "Encourage the use of atomic properties instead of composite properties in the codebase."
|
|
@@ -9424,12 +9547,12 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9424
9547
|
};
|
|
9425
9548
|
}
|
|
9426
9549
|
});
|
|
9427
|
-
prefer_atomic_properties_default =
|
|
9550
|
+
prefer_atomic_properties_default = rule15;
|
|
9428
9551
|
}
|
|
9429
9552
|
});
|
|
9430
9553
|
|
|
9431
9554
|
// src/rules/prefer-composite-properties.ts
|
|
9432
|
-
var
|
|
9555
|
+
var RULE_NAME16, rule16, prefer_composite_properties_default;
|
|
9433
9556
|
var init_prefer_composite_properties = __esm({
|
|
9434
9557
|
"src/rules/prefer-composite-properties.ts"() {
|
|
9435
9558
|
"use strict";
|
|
@@ -9438,9 +9561,9 @@ var init_prefer_composite_properties = __esm({
|
|
|
9438
9561
|
init_utils();
|
|
9439
9562
|
init_composite_properties();
|
|
9440
9563
|
init_nodes();
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
name:
|
|
9564
|
+
RULE_NAME16 = "prefer-composite-properties";
|
|
9565
|
+
rule16 = createRule({
|
|
9566
|
+
name: RULE_NAME16,
|
|
9444
9567
|
meta: {
|
|
9445
9568
|
docs: {
|
|
9446
9569
|
description: "Encourage the use of composite properties instead of atomic properties in the codebase."
|
|
@@ -9494,12 +9617,12 @@ var init_prefer_composite_properties = __esm({
|
|
|
9494
9617
|
};
|
|
9495
9618
|
}
|
|
9496
9619
|
});
|
|
9497
|
-
prefer_composite_properties_default =
|
|
9620
|
+
prefer_composite_properties_default = rule16;
|
|
9498
9621
|
}
|
|
9499
9622
|
});
|
|
9500
9623
|
|
|
9501
9624
|
// src/rules/prefer-unified-property-style.ts
|
|
9502
|
-
var
|
|
9625
|
+
var RULE_NAME17, rule17, prefer_unified_property_style_default;
|
|
9503
9626
|
var init_prefer_unified_property_style = __esm({
|
|
9504
9627
|
"src/rules/prefer-unified-property-style.ts"() {
|
|
9505
9628
|
"use strict";
|
|
@@ -9508,9 +9631,9 @@ var init_prefer_unified_property_style = __esm({
|
|
|
9508
9631
|
init_utils();
|
|
9509
9632
|
init_composite_properties();
|
|
9510
9633
|
init_nodes();
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
name:
|
|
9634
|
+
RULE_NAME17 = "prefer-unified-property-style";
|
|
9635
|
+
rule17 = createRule({
|
|
9636
|
+
name: RULE_NAME17,
|
|
9514
9637
|
meta: {
|
|
9515
9638
|
docs: {
|
|
9516
9639
|
description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
|
|
@@ -9525,10 +9648,10 @@ var init_prefer_unified_property_style = __esm({
|
|
|
9525
9648
|
create(context) {
|
|
9526
9649
|
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
9527
9650
|
const resolveCompositeProperty = (name2) => {
|
|
9528
|
-
if (
|
|
9651
|
+
if (name2 in compositeProperties)
|
|
9529
9652
|
return name2;
|
|
9530
9653
|
const longhand = getLonghand(name2);
|
|
9531
|
-
if (isValidProperty(longhand, context) &&
|
|
9654
|
+
if (isValidProperty(longhand, context) && longhand in compositeProperties)
|
|
9532
9655
|
return longhand;
|
|
9533
9656
|
};
|
|
9534
9657
|
const sendReport = (node, cmp, siblings) => {
|
|
@@ -9577,7 +9700,7 @@ var init_prefer_unified_property_style = __esm({
|
|
|
9577
9700
|
};
|
|
9578
9701
|
}
|
|
9579
9702
|
});
|
|
9580
|
-
prefer_unified_property_style_default =
|
|
9703
|
+
prefer_unified_property_style_default = rule17;
|
|
9581
9704
|
}
|
|
9582
9705
|
});
|
|
9583
9706
|
|
|
@@ -9596,6 +9719,7 @@ var init_rules = __esm({
|
|
|
9596
9719
|
init_no_important();
|
|
9597
9720
|
init_no_invalid_nesting();
|
|
9598
9721
|
init_no_invalid_token_paths();
|
|
9722
|
+
init_no_physical_properties();
|
|
9599
9723
|
init_no_property_renaming();
|
|
9600
9724
|
init_no_unsafe_token_fn_usage();
|
|
9601
9725
|
init_prefer_longhand_properties();
|
|
@@ -9613,13 +9737,14 @@ var init_rules = __esm({
|
|
|
9613
9737
|
[RULE_NAME7]: no_important_default,
|
|
9614
9738
|
[RULE_NAME9]: no_invalid_token_paths_default,
|
|
9615
9739
|
[RULE_NAME8]: no_invalid_nesting_default,
|
|
9616
|
-
[
|
|
9617
|
-
[
|
|
9618
|
-
[RULE_NAME12]:
|
|
9619
|
-
[RULE_NAME13]:
|
|
9620
|
-
[RULE_NAME14]:
|
|
9621
|
-
[RULE_NAME15]:
|
|
9622
|
-
[RULE_NAME16]:
|
|
9740
|
+
[RULE_NAME11]: no_property_renaming_default,
|
|
9741
|
+
[RULE_NAME10]: no_physical_properties_default,
|
|
9742
|
+
[RULE_NAME12]: no_unsafe_token_fn_usage_default,
|
|
9743
|
+
[RULE_NAME13]: prefer_longhand_properties_default,
|
|
9744
|
+
[RULE_NAME14]: prefer_shorthand_properties_default,
|
|
9745
|
+
[RULE_NAME15]: prefer_atomic_properties_default,
|
|
9746
|
+
[RULE_NAME16]: prefer_composite_properties_default,
|
|
9747
|
+
[RULE_NAME17]: prefer_unified_property_style_default
|
|
9623
9748
|
};
|
|
9624
9749
|
}
|
|
9625
9750
|
});
|
package/dist/utils/worker.js
CHANGED
|
@@ -3482,7 +3482,6 @@ var createContext = (userConfig) => {
|
|
|
3482
3482
|
var import_ts_path = require("@pandacss/config/ts-path");
|
|
3483
3483
|
var import_config3 = require("@pandacss/config");
|
|
3484
3484
|
var import_path = __toESM(require("path"));
|
|
3485
|
-
var import_fs = __toESM(require("fs"));
|
|
3486
3485
|
var promise;
|
|
3487
3486
|
var configPath;
|
|
3488
3487
|
async function _getContext(configPath2) {
|
|
@@ -3538,18 +3537,17 @@ async function isColorAttribute(ctx, _attr) {
|
|
|
3538
3537
|
return attrConfig?.values === "colors";
|
|
3539
3538
|
}
|
|
3540
3539
|
var arePathsEqual = (path1, path2) => {
|
|
3541
|
-
const
|
|
3542
|
-
const
|
|
3543
|
-
return
|
|
3540
|
+
const normalizedPath1 = import_path.default.resolve(path1);
|
|
3541
|
+
const normalizedPath2 = import_path.default.resolve(path2);
|
|
3542
|
+
return normalizedPath1 === normalizedPath2;
|
|
3544
3543
|
};
|
|
3545
3544
|
async function isConfigFile(fileName) {
|
|
3546
3545
|
return arePathsEqual(configPath, fileName);
|
|
3547
3546
|
}
|
|
3548
3547
|
async function isValidFile(ctx, fileName) {
|
|
3549
|
-
return ctx.getFiles().
|
|
3548
|
+
return ctx.getFiles().some((file) => arePathsEqual(file, fileName));
|
|
3550
3549
|
}
|
|
3551
3550
|
async function resolveShorthands(ctx, name) {
|
|
3552
|
-
console.log("name", name, ctx.utility.getPropShorthandsMap().get(name));
|
|
3553
3551
|
return ctx.utility.getPropShorthandsMap().get(name);
|
|
3554
3552
|
}
|
|
3555
3553
|
async function resolveLongHand(ctx, name) {
|
package/dist/utils/worker.mjs
CHANGED
|
@@ -3466,7 +3466,6 @@ init_esm_shims();
|
|
|
3466
3466
|
import { resolveTsPathPattern } from "@pandacss/config/ts-path";
|
|
3467
3467
|
import { findConfig, bundleConfig } from "@pandacss/config";
|
|
3468
3468
|
import path from "path";
|
|
3469
|
-
import fs from "fs";
|
|
3470
3469
|
var promise;
|
|
3471
3470
|
var configPath;
|
|
3472
3471
|
async function _getContext(configPath2) {
|
|
@@ -3522,18 +3521,17 @@ async function isColorAttribute(ctx, _attr) {
|
|
|
3522
3521
|
return attrConfig?.values === "colors";
|
|
3523
3522
|
}
|
|
3524
3523
|
var arePathsEqual = (path1, path2) => {
|
|
3525
|
-
const
|
|
3526
|
-
const
|
|
3527
|
-
return
|
|
3524
|
+
const normalizedPath1 = path.resolve(path1);
|
|
3525
|
+
const normalizedPath2 = path.resolve(path2);
|
|
3526
|
+
return normalizedPath1 === normalizedPath2;
|
|
3528
3527
|
};
|
|
3529
3528
|
async function isConfigFile(fileName) {
|
|
3530
3529
|
return arePathsEqual(configPath, fileName);
|
|
3531
3530
|
}
|
|
3532
3531
|
async function isValidFile(ctx, fileName) {
|
|
3533
|
-
return ctx.getFiles().
|
|
3532
|
+
return ctx.getFiles().some((file) => arePathsEqual(file, fileName));
|
|
3534
3533
|
}
|
|
3535
3534
|
async function resolveShorthands(ctx, name) {
|
|
3536
|
-
console.log("name", name, ctx.utility.getPropShorthandsMap().get(name));
|
|
3537
3535
|
return ctx.utility.getPropShorthandsMap().get(name);
|
|
3538
3536
|
}
|
|
3539
3537
|
async function resolveLongHand(ctx, name) {
|