@pandacss/eslint-plugin 0.0.14 → 0.0.16
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 +234 -96
- package/dist/index.mjs +266 -103
- 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.16";
|
|
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,162 @@ var rule9 = createRule({
|
|
|
8837
8839
|
});
|
|
8838
8840
|
var no_invalid_token_paths_default = rule9;
|
|
8839
8841
|
|
|
8840
|
-
// src/rules/no-
|
|
8842
|
+
// src/rules/no-margin-properties.ts
|
|
8841
8843
|
init_cjs_shims();
|
|
8842
|
-
var RULE_NAME10 = "no-
|
|
8844
|
+
var RULE_NAME10 = "no-margin-properties";
|
|
8843
8845
|
var rule10 = createRule({
|
|
8844
8846
|
name: RULE_NAME10,
|
|
8847
|
+
meta: {
|
|
8848
|
+
docs: {
|
|
8849
|
+
description: "Discourage using margin properties for spacing; prefer defining spacing in parent elements with `flex` or `grid` using the `gap` property for a more resilient layout. Margins make components less reusable in other contexts."
|
|
8850
|
+
},
|
|
8851
|
+
messages: {
|
|
8852
|
+
noMargin: "Use flex or grid with the `gap` property to define spacing in parent elements for a more resilient layout."
|
|
8853
|
+
},
|
|
8854
|
+
type: "suggestion",
|
|
8855
|
+
schema: []
|
|
8856
|
+
},
|
|
8857
|
+
defaultOptions: [],
|
|
8858
|
+
create(context) {
|
|
8859
|
+
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
8860
|
+
const sendReport = (node) => {
|
|
8861
|
+
if (!getLonghand(node.name).toLowerCase().includes("margin"))
|
|
8862
|
+
return;
|
|
8863
|
+
return context.report({
|
|
8864
|
+
node,
|
|
8865
|
+
messageId: "noMargin"
|
|
8866
|
+
});
|
|
8867
|
+
};
|
|
8868
|
+
return {
|
|
8869
|
+
JSXAttribute(node) {
|
|
8870
|
+
if (!isJSXIdentifier(node.name))
|
|
8871
|
+
return;
|
|
8872
|
+
if (!isPandaProp(node, context))
|
|
8873
|
+
return;
|
|
8874
|
+
sendReport(node.name);
|
|
8875
|
+
},
|
|
8876
|
+
Property(node) {
|
|
8877
|
+
if (!isIdentifier(node.key))
|
|
8878
|
+
return;
|
|
8879
|
+
if (!isPandaAttribute(node, context))
|
|
8880
|
+
return;
|
|
8881
|
+
sendReport(node.key);
|
|
8882
|
+
}
|
|
8883
|
+
};
|
|
8884
|
+
}
|
|
8885
|
+
});
|
|
8886
|
+
var no_margin_properties_default = rule10;
|
|
8887
|
+
|
|
8888
|
+
// src/rules/no-physical-properties.ts
|
|
8889
|
+
init_cjs_shims();
|
|
8890
|
+
|
|
8891
|
+
// src/utils/physical-properties.ts
|
|
8892
|
+
init_cjs_shims();
|
|
8893
|
+
var physicalProperties = {
|
|
8894
|
+
borderBottom: "borderBlockEnd",
|
|
8895
|
+
borderBottomColor: "borderBlockEndColor",
|
|
8896
|
+
borderBottomStyle: "borderBlockEndStyle",
|
|
8897
|
+
borderBottomWidth: "borderBlockEndWidth",
|
|
8898
|
+
borderTop: "borderBlockStart",
|
|
8899
|
+
borderTopColor: "borderBlockStartColor",
|
|
8900
|
+
borderTopStyle: "borderBlockStartStyle",
|
|
8901
|
+
borderTopWidth: "borderBlockStartWidth",
|
|
8902
|
+
borderRight: "borderInlineEnd",
|
|
8903
|
+
borderRightColor: "borderInlineEndColor",
|
|
8904
|
+
borderRightStyle: "borderInlineEndStyle",
|
|
8905
|
+
borderRightWidth: "borderInlineEndWidth",
|
|
8906
|
+
borderLeft: "borderInlineStart",
|
|
8907
|
+
borderLeftColor: "borderInlineStartColor",
|
|
8908
|
+
borderLeftStyle: "borderInlineStartStyle",
|
|
8909
|
+
borderLeftWidth: "borderInlineStartWidth",
|
|
8910
|
+
borderTopLeftRadius: "borderStartStartRadius",
|
|
8911
|
+
borderBottomLeftRadius: "borderEndStartRadius",
|
|
8912
|
+
borderTopRightRadius: "borderStartEndRadius",
|
|
8913
|
+
borderBottomRightRadius: "borderEndEndRadius",
|
|
8914
|
+
marginBottom: "marginBlockEnd",
|
|
8915
|
+
marginTop: "marginBlockStart",
|
|
8916
|
+
marginRight: "marginInlineEnd",
|
|
8917
|
+
marginLeft: "marginInlineStart",
|
|
8918
|
+
paddingBottom: "paddingBlockEnd",
|
|
8919
|
+
paddingTop: "paddingBlockStart",
|
|
8920
|
+
paddingRight: "paddingInlineEnd",
|
|
8921
|
+
paddingLeft: "paddingInlineStart",
|
|
8922
|
+
left: "insetInlineStart",
|
|
8923
|
+
right: "insetInlineEnd",
|
|
8924
|
+
top: "insetBlockStart",
|
|
8925
|
+
bottom: "insetBlockEnd"
|
|
8926
|
+
};
|
|
8927
|
+
|
|
8928
|
+
// src/rules/no-physical-properties.ts
|
|
8929
|
+
var RULE_NAME11 = "no-physical-properties";
|
|
8930
|
+
var rule11 = createRule({
|
|
8931
|
+
name: RULE_NAME11,
|
|
8932
|
+
meta: {
|
|
8933
|
+
docs: {
|
|
8934
|
+
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."
|
|
8935
|
+
},
|
|
8936
|
+
messages: {
|
|
8937
|
+
physical: "Use logical property of {{physical}} instead. Prefer `{{logical}}`",
|
|
8938
|
+
replace: "Replace `{{physical}}` with `{{logical}}`"
|
|
8939
|
+
},
|
|
8940
|
+
type: "suggestion",
|
|
8941
|
+
hasSuggestions: true,
|
|
8942
|
+
schema: []
|
|
8943
|
+
},
|
|
8944
|
+
defaultOptions: [],
|
|
8945
|
+
create(context) {
|
|
8946
|
+
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
8947
|
+
const sendReport = (node) => {
|
|
8948
|
+
if (!(getLonghand(node.name) in physicalProperties))
|
|
8949
|
+
return;
|
|
8950
|
+
const logical = physicalProperties[getLonghand(node.name)];
|
|
8951
|
+
const longhand = resolveLonghand(node.name, context);
|
|
8952
|
+
return context.report({
|
|
8953
|
+
node,
|
|
8954
|
+
messageId: "physical",
|
|
8955
|
+
data: {
|
|
8956
|
+
physical: `\`${node.name}\`${longhand ? ` - \`${longhand}\`` : ""}`,
|
|
8957
|
+
logical
|
|
8958
|
+
},
|
|
8959
|
+
suggest: [
|
|
8960
|
+
{
|
|
8961
|
+
messageId: "replace",
|
|
8962
|
+
data: {
|
|
8963
|
+
physical: node.name,
|
|
8964
|
+
logical
|
|
8965
|
+
},
|
|
8966
|
+
fix: (fixer) => {
|
|
8967
|
+
return fixer.replaceTextRange(node.range, logical);
|
|
8968
|
+
}
|
|
8969
|
+
}
|
|
8970
|
+
]
|
|
8971
|
+
});
|
|
8972
|
+
};
|
|
8973
|
+
return {
|
|
8974
|
+
JSXAttribute(node) {
|
|
8975
|
+
if (!isJSXIdentifier(node.name))
|
|
8976
|
+
return;
|
|
8977
|
+
if (!isPandaProp(node, context))
|
|
8978
|
+
return;
|
|
8979
|
+
sendReport(node.name);
|
|
8980
|
+
},
|
|
8981
|
+
Property(node) {
|
|
8982
|
+
if (!isIdentifier(node.key))
|
|
8983
|
+
return;
|
|
8984
|
+
if (!isPandaAttribute(node, context))
|
|
8985
|
+
return;
|
|
8986
|
+
sendReport(node.key);
|
|
8987
|
+
}
|
|
8988
|
+
};
|
|
8989
|
+
}
|
|
8990
|
+
});
|
|
8991
|
+
var no_physical_properties_default = rule11;
|
|
8992
|
+
|
|
8993
|
+
// src/rules/no-property-renaming.ts
|
|
8994
|
+
init_cjs_shims();
|
|
8995
|
+
var RULE_NAME12 = "no-property-renaming";
|
|
8996
|
+
var rule12 = createRule({
|
|
8997
|
+
name: RULE_NAME12,
|
|
8845
8998
|
meta: {
|
|
8846
8999
|
docs: {
|
|
8847
9000
|
description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
|
|
@@ -8864,6 +9017,14 @@ var rule10 = createRule({
|
|
|
8864
9017
|
}
|
|
8865
9018
|
});
|
|
8866
9019
|
};
|
|
9020
|
+
const handleReport = (node, value, attr) => {
|
|
9021
|
+
if (isIdentifier(value) && attr !== value.name) {
|
|
9022
|
+
return sendReport(node, attr, value.name);
|
|
9023
|
+
}
|
|
9024
|
+
if (isMemberExpression(value) && isIdentifier(value.property) && attr !== value.property.name) {
|
|
9025
|
+
return sendReport(node, attr, value.property.name);
|
|
9026
|
+
}
|
|
9027
|
+
};
|
|
8867
9028
|
return {
|
|
8868
9029
|
JSXAttribute(node) {
|
|
8869
9030
|
if (!node.value)
|
|
@@ -8874,12 +9035,7 @@ var rule10 = createRule({
|
|
|
8874
9035
|
return;
|
|
8875
9036
|
const attr = node.name.name.toString();
|
|
8876
9037
|
const expression = node.value.expression;
|
|
8877
|
-
|
|
8878
|
-
return sendReport(node, attr, expression.name);
|
|
8879
|
-
}
|
|
8880
|
-
if (isMemberExpression(expression) && isIdentifier(expression.property) && attr !== expression.property.name) {
|
|
8881
|
-
return sendReport(node, attr, expression.property.name);
|
|
8882
|
-
}
|
|
9038
|
+
handleReport(node, expression, attr);
|
|
8883
9039
|
},
|
|
8884
9040
|
Property(node) {
|
|
8885
9041
|
if (!isIdentifier(node.key))
|
|
@@ -8890,25 +9046,20 @@ var rule10 = createRule({
|
|
|
8890
9046
|
return;
|
|
8891
9047
|
const attr = node.key.name.toString();
|
|
8892
9048
|
const value = node.value;
|
|
8893
|
-
|
|
8894
|
-
return sendReport(node, attr, value.name);
|
|
8895
|
-
}
|
|
8896
|
-
if (isMemberExpression(value) && isIdentifier(value.property) && attr !== value.property.name) {
|
|
8897
|
-
return sendReport(node, attr, value.property.name);
|
|
8898
|
-
}
|
|
9049
|
+
handleReport(node, value, attr);
|
|
8899
9050
|
}
|
|
8900
9051
|
};
|
|
8901
9052
|
}
|
|
8902
9053
|
});
|
|
8903
|
-
var no_property_renaming_default =
|
|
9054
|
+
var no_property_renaming_default = rule12;
|
|
8904
9055
|
|
|
8905
9056
|
// src/rules/no-unsafe-token-fn-usage.ts
|
|
8906
9057
|
init_cjs_shims();
|
|
8907
|
-
var
|
|
9058
|
+
var import_utils17 = require("@typescript-eslint/utils");
|
|
8908
9059
|
var import_shared3 = require("@pandacss/shared");
|
|
8909
|
-
var
|
|
8910
|
-
var
|
|
8911
|
-
name:
|
|
9060
|
+
var RULE_NAME13 = "no-unsafe-token-fn-usage";
|
|
9061
|
+
var rule13 = createRule({
|
|
9062
|
+
name: RULE_NAME13,
|
|
8912
9063
|
meta: {
|
|
8913
9064
|
docs: {
|
|
8914
9065
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
@@ -9004,13 +9155,13 @@ var rule11 = createRule({
|
|
|
9004
9155
|
};
|
|
9005
9156
|
}
|
|
9006
9157
|
});
|
|
9007
|
-
var no_unsafe_token_fn_usage_default =
|
|
9158
|
+
var no_unsafe_token_fn_usage_default = rule13;
|
|
9008
9159
|
|
|
9009
9160
|
// src/rules/prefer-longhand-properties.ts
|
|
9010
9161
|
init_cjs_shims();
|
|
9011
|
-
var
|
|
9012
|
-
var
|
|
9013
|
-
name:
|
|
9162
|
+
var RULE_NAME14 = "prefer-longhand-properties";
|
|
9163
|
+
var rule14 = createRule({
|
|
9164
|
+
name: RULE_NAME14,
|
|
9014
9165
|
meta: {
|
|
9015
9166
|
docs: {
|
|
9016
9167
|
description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
|
|
@@ -9025,10 +9176,12 @@ var rule12 = createRule({
|
|
|
9025
9176
|
},
|
|
9026
9177
|
defaultOptions: [],
|
|
9027
9178
|
create(context) {
|
|
9028
|
-
const sendReport = (node
|
|
9029
|
-
const longhand = resolveLonghand(
|
|
9179
|
+
const sendReport = (node) => {
|
|
9180
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9181
|
+
if (!longhand)
|
|
9182
|
+
return;
|
|
9030
9183
|
const data = {
|
|
9031
|
-
shorthand:
|
|
9184
|
+
shorthand: node.name,
|
|
9032
9185
|
longhand
|
|
9033
9186
|
};
|
|
9034
9187
|
return context.report({
|
|
@@ -9052,31 +9205,25 @@ var rule12 = createRule({
|
|
|
9052
9205
|
return;
|
|
9053
9206
|
if (!isPandaProp(node, context))
|
|
9054
9207
|
return;
|
|
9055
|
-
|
|
9056
|
-
if (!longhand)
|
|
9057
|
-
return;
|
|
9058
|
-
sendReport(node.name, node.name.name);
|
|
9208
|
+
sendReport(node.name);
|
|
9059
9209
|
},
|
|
9060
9210
|
Property(node) {
|
|
9061
9211
|
if (!isIdentifier(node.key))
|
|
9062
9212
|
return;
|
|
9063
9213
|
if (!isPandaAttribute(node, context))
|
|
9064
9214
|
return;
|
|
9065
|
-
|
|
9066
|
-
if (!longhand)
|
|
9067
|
-
return;
|
|
9068
|
-
sendReport(node.key, node.key.name);
|
|
9215
|
+
sendReport(node.key);
|
|
9069
9216
|
}
|
|
9070
9217
|
};
|
|
9071
9218
|
}
|
|
9072
9219
|
});
|
|
9073
|
-
var prefer_longhand_properties_default =
|
|
9220
|
+
var prefer_longhand_properties_default = rule14;
|
|
9074
9221
|
|
|
9075
9222
|
// src/rules/prefer-shorthand-properties.ts
|
|
9076
9223
|
init_cjs_shims();
|
|
9077
|
-
var
|
|
9078
|
-
var
|
|
9079
|
-
name:
|
|
9224
|
+
var RULE_NAME15 = "prefer-shorthand-properties";
|
|
9225
|
+
var rule15 = createRule({
|
|
9226
|
+
name: RULE_NAME15,
|
|
9080
9227
|
meta: {
|
|
9081
9228
|
docs: {
|
|
9082
9229
|
description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
|
|
@@ -9091,13 +9238,16 @@ var rule13 = createRule({
|
|
|
9091
9238
|
},
|
|
9092
9239
|
defaultOptions: [],
|
|
9093
9240
|
create(context) {
|
|
9094
|
-
const sendReport = (node
|
|
9095
|
-
const
|
|
9241
|
+
const sendReport = (node) => {
|
|
9242
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9243
|
+
if (longhand)
|
|
9244
|
+
return;
|
|
9245
|
+
const shorthands = resolveShorthands(node.name, context);
|
|
9096
9246
|
if (!shorthands)
|
|
9097
9247
|
return;
|
|
9098
9248
|
const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
|
|
9099
9249
|
const data = {
|
|
9100
|
-
longhand:
|
|
9250
|
+
longhand: node.name,
|
|
9101
9251
|
shorthand
|
|
9102
9252
|
};
|
|
9103
9253
|
return context.report({
|
|
@@ -9121,25 +9271,19 @@ var rule13 = createRule({
|
|
|
9121
9271
|
return;
|
|
9122
9272
|
if (!isPandaProp(node, context))
|
|
9123
9273
|
return;
|
|
9124
|
-
|
|
9125
|
-
if (longhand)
|
|
9126
|
-
return;
|
|
9127
|
-
sendReport(node.name, node.name.name);
|
|
9274
|
+
sendReport(node.name);
|
|
9128
9275
|
},
|
|
9129
9276
|
Property(node) {
|
|
9130
9277
|
if (!isIdentifier(node.key))
|
|
9131
9278
|
return;
|
|
9132
9279
|
if (!isPandaAttribute(node, context))
|
|
9133
9280
|
return;
|
|
9134
|
-
|
|
9135
|
-
if (longhand)
|
|
9136
|
-
return;
|
|
9137
|
-
sendReport(node.key, node.key.name);
|
|
9281
|
+
sendReport(node.key);
|
|
9138
9282
|
}
|
|
9139
9283
|
};
|
|
9140
9284
|
}
|
|
9141
9285
|
});
|
|
9142
|
-
var prefer_shorthand_properties_default =
|
|
9286
|
+
var prefer_shorthand_properties_default = rule15;
|
|
9143
9287
|
|
|
9144
9288
|
// src/rules/prefer-atomic-properties.ts
|
|
9145
9289
|
init_cjs_shims();
|
|
@@ -9259,9 +9403,9 @@ var compositeProperties = {
|
|
|
9259
9403
|
};
|
|
9260
9404
|
|
|
9261
9405
|
// src/rules/prefer-atomic-properties.ts
|
|
9262
|
-
var
|
|
9263
|
-
var
|
|
9264
|
-
name:
|
|
9406
|
+
var RULE_NAME16 = "prefer-atomic-properties";
|
|
9407
|
+
var rule16 = createRule({
|
|
9408
|
+
name: RULE_NAME16,
|
|
9265
9409
|
meta: {
|
|
9266
9410
|
docs: {
|
|
9267
9411
|
description: "Encourage the use of atomic properties instead of composite properties in the codebase."
|
|
@@ -9281,14 +9425,16 @@ var rule14 = createRule({
|
|
|
9281
9425
|
if (isValidProperty(longhand, context) && Object.hasOwn(compositeProperties, longhand))
|
|
9282
9426
|
return longhand;
|
|
9283
9427
|
};
|
|
9284
|
-
const sendReport = (node
|
|
9285
|
-
const cmp = resolveCompositeProperty(
|
|
9286
|
-
|
|
9428
|
+
const sendReport = (node) => {
|
|
9429
|
+
const cmp = resolveCompositeProperty(node.name);
|
|
9430
|
+
if (!cmp)
|
|
9431
|
+
return;
|
|
9432
|
+
const atomics = compositeProperties[cmp].map((name2) => `\`${name2}\``).join(",\n");
|
|
9287
9433
|
return context.report({
|
|
9288
9434
|
node,
|
|
9289
9435
|
messageId: "atomic",
|
|
9290
9436
|
data: {
|
|
9291
|
-
composite:
|
|
9437
|
+
composite: node.name,
|
|
9292
9438
|
atomics
|
|
9293
9439
|
}
|
|
9294
9440
|
});
|
|
@@ -9299,31 +9445,25 @@ var rule14 = createRule({
|
|
|
9299
9445
|
return;
|
|
9300
9446
|
if (!isPandaProp(node, context))
|
|
9301
9447
|
return;
|
|
9302
|
-
|
|
9303
|
-
if (!cmp)
|
|
9304
|
-
return;
|
|
9305
|
-
sendReport(node, node.name.name);
|
|
9448
|
+
sendReport(node.name);
|
|
9306
9449
|
},
|
|
9307
9450
|
Property(node) {
|
|
9308
9451
|
if (!isIdentifier(node.key))
|
|
9309
9452
|
return;
|
|
9310
9453
|
if (!isPandaAttribute(node, context))
|
|
9311
9454
|
return;
|
|
9312
|
-
|
|
9313
|
-
if (!cmp)
|
|
9314
|
-
return;
|
|
9315
|
-
sendReport(node.key, node.key.name);
|
|
9455
|
+
sendReport(node.key);
|
|
9316
9456
|
}
|
|
9317
9457
|
};
|
|
9318
9458
|
}
|
|
9319
9459
|
});
|
|
9320
|
-
var prefer_atomic_properties_default =
|
|
9460
|
+
var prefer_atomic_properties_default = rule16;
|
|
9321
9461
|
|
|
9322
9462
|
// src/rules/prefer-composite-properties.ts
|
|
9323
9463
|
init_cjs_shims();
|
|
9324
|
-
var
|
|
9325
|
-
var
|
|
9326
|
-
name:
|
|
9464
|
+
var RULE_NAME17 = "prefer-composite-properties";
|
|
9465
|
+
var rule17 = createRule({
|
|
9466
|
+
name: RULE_NAME17,
|
|
9327
9467
|
meta: {
|
|
9328
9468
|
docs: {
|
|
9329
9469
|
description: "Encourage the use of composite properties instead of atomic properties in the codebase."
|
|
@@ -9342,14 +9482,16 @@ var rule15 = createRule({
|
|
|
9342
9482
|
return;
|
|
9343
9483
|
return Object.keys(compositeProperties).find((cpd) => compositeProperties[cpd].includes(longhand));
|
|
9344
9484
|
};
|
|
9345
|
-
const sendReport = (node
|
|
9346
|
-
const cmp = resolveCompositeProperty(
|
|
9485
|
+
const sendReport = (node) => {
|
|
9486
|
+
const cmp = resolveCompositeProperty(node.name);
|
|
9487
|
+
if (!cmp)
|
|
9488
|
+
return;
|
|
9347
9489
|
return context.report({
|
|
9348
9490
|
node,
|
|
9349
9491
|
messageId: "composite",
|
|
9350
9492
|
data: {
|
|
9351
9493
|
composite: cmp,
|
|
9352
|
-
atomic:
|
|
9494
|
+
atomic: node.name
|
|
9353
9495
|
}
|
|
9354
9496
|
});
|
|
9355
9497
|
};
|
|
@@ -9359,31 +9501,25 @@ var rule15 = createRule({
|
|
|
9359
9501
|
return;
|
|
9360
9502
|
if (!isPandaProp(node, context))
|
|
9361
9503
|
return;
|
|
9362
|
-
|
|
9363
|
-
if (!atm)
|
|
9364
|
-
return;
|
|
9365
|
-
sendReport(node, node.name.name);
|
|
9504
|
+
sendReport(node.name);
|
|
9366
9505
|
},
|
|
9367
9506
|
Property(node) {
|
|
9368
9507
|
if (!isIdentifier(node.key))
|
|
9369
9508
|
return;
|
|
9370
9509
|
if (!isPandaAttribute(node, context))
|
|
9371
9510
|
return;
|
|
9372
|
-
|
|
9373
|
-
if (!atm)
|
|
9374
|
-
return;
|
|
9375
|
-
sendReport(node.key, node.key.name);
|
|
9511
|
+
sendReport(node.key);
|
|
9376
9512
|
}
|
|
9377
9513
|
};
|
|
9378
9514
|
}
|
|
9379
9515
|
});
|
|
9380
|
-
var prefer_composite_properties_default =
|
|
9516
|
+
var prefer_composite_properties_default = rule17;
|
|
9381
9517
|
|
|
9382
9518
|
// src/rules/prefer-unified-property-style.ts
|
|
9383
9519
|
init_cjs_shims();
|
|
9384
|
-
var
|
|
9385
|
-
var
|
|
9386
|
-
name:
|
|
9520
|
+
var RULE_NAME18 = "prefer-unified-property-style";
|
|
9521
|
+
var rule18 = createRule({
|
|
9522
|
+
name: RULE_NAME18,
|
|
9387
9523
|
meta: {
|
|
9388
9524
|
docs: {
|
|
9389
9525
|
description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
|
|
@@ -9398,10 +9534,10 @@ var rule16 = createRule({
|
|
|
9398
9534
|
create(context) {
|
|
9399
9535
|
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
9400
9536
|
const resolveCompositeProperty = (name2) => {
|
|
9401
|
-
if (
|
|
9537
|
+
if (name2 in compositeProperties)
|
|
9402
9538
|
return name2;
|
|
9403
9539
|
const longhand = getLonghand(name2);
|
|
9404
|
-
if (isValidProperty(longhand, context) &&
|
|
9540
|
+
if (isValidProperty(longhand, context) && longhand in compositeProperties)
|
|
9405
9541
|
return longhand;
|
|
9406
9542
|
};
|
|
9407
9543
|
const sendReport = (node, cmp, siblings) => {
|
|
@@ -9450,7 +9586,7 @@ var rule16 = createRule({
|
|
|
9450
9586
|
};
|
|
9451
9587
|
}
|
|
9452
9588
|
});
|
|
9453
|
-
var prefer_unified_property_style_default =
|
|
9589
|
+
var prefer_unified_property_style_default = rule18;
|
|
9454
9590
|
|
|
9455
9591
|
// src/rules/index.ts
|
|
9456
9592
|
var rules = {
|
|
@@ -9463,13 +9599,15 @@ var rules = {
|
|
|
9463
9599
|
[RULE_NAME7]: no_important_default,
|
|
9464
9600
|
[RULE_NAME9]: no_invalid_token_paths_default,
|
|
9465
9601
|
[RULE_NAME8]: no_invalid_nesting_default,
|
|
9466
|
-
[RULE_NAME10]:
|
|
9467
|
-
[RULE_NAME11]:
|
|
9468
|
-
[RULE_NAME12]:
|
|
9469
|
-
[RULE_NAME13]:
|
|
9470
|
-
[RULE_NAME14]:
|
|
9471
|
-
[RULE_NAME15]:
|
|
9472
|
-
[RULE_NAME16]:
|
|
9602
|
+
[RULE_NAME10]: no_margin_properties_default,
|
|
9603
|
+
[RULE_NAME11]: no_physical_properties_default,
|
|
9604
|
+
[RULE_NAME12]: no_property_renaming_default,
|
|
9605
|
+
[RULE_NAME13]: no_unsafe_token_fn_usage_default,
|
|
9606
|
+
[RULE_NAME14]: prefer_longhand_properties_default,
|
|
9607
|
+
[RULE_NAME15]: prefer_shorthand_properties_default,
|
|
9608
|
+
[RULE_NAME16]: prefer_atomic_properties_default,
|
|
9609
|
+
[RULE_NAME17]: prefer_composite_properties_default,
|
|
9610
|
+
[RULE_NAME18]: prefer_unified_property_style_default
|
|
9473
9611
|
};
|
|
9474
9612
|
|
|
9475
9613
|
// 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.16";
|
|
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,182 @@ var init_no_invalid_token_paths = __esm({
|
|
|
8896
8898
|
}
|
|
8897
8899
|
});
|
|
8898
8900
|
|
|
8901
|
+
// src/rules/no-margin-properties.ts
|
|
8902
|
+
var RULE_NAME10, rule10, no_margin_properties_default;
|
|
8903
|
+
var init_no_margin_properties = __esm({
|
|
8904
|
+
"src/rules/no-margin-properties.ts"() {
|
|
8905
|
+
"use strict";
|
|
8906
|
+
init_esm_shims();
|
|
8907
|
+
init_helpers();
|
|
8908
|
+
init_utils();
|
|
8909
|
+
init_nodes();
|
|
8910
|
+
RULE_NAME10 = "no-margin-properties";
|
|
8911
|
+
rule10 = createRule({
|
|
8912
|
+
name: RULE_NAME10,
|
|
8913
|
+
meta: {
|
|
8914
|
+
docs: {
|
|
8915
|
+
description: "Discourage using margin properties for spacing; prefer defining spacing in parent elements with `flex` or `grid` using the `gap` property for a more resilient layout. Margins make components less reusable in other contexts."
|
|
8916
|
+
},
|
|
8917
|
+
messages: {
|
|
8918
|
+
noMargin: "Use flex or grid with the `gap` property to define spacing in parent elements for a more resilient layout."
|
|
8919
|
+
},
|
|
8920
|
+
type: "suggestion",
|
|
8921
|
+
schema: []
|
|
8922
|
+
},
|
|
8923
|
+
defaultOptions: [],
|
|
8924
|
+
create(context) {
|
|
8925
|
+
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
8926
|
+
const sendReport = (node) => {
|
|
8927
|
+
if (!getLonghand(node.name).toLowerCase().includes("margin"))
|
|
8928
|
+
return;
|
|
8929
|
+
return context.report({
|
|
8930
|
+
node,
|
|
8931
|
+
messageId: "noMargin"
|
|
8932
|
+
});
|
|
8933
|
+
};
|
|
8934
|
+
return {
|
|
8935
|
+
JSXAttribute(node) {
|
|
8936
|
+
if (!isJSXIdentifier(node.name))
|
|
8937
|
+
return;
|
|
8938
|
+
if (!isPandaProp(node, context))
|
|
8939
|
+
return;
|
|
8940
|
+
sendReport(node.name);
|
|
8941
|
+
},
|
|
8942
|
+
Property(node) {
|
|
8943
|
+
if (!isIdentifier(node.key))
|
|
8944
|
+
return;
|
|
8945
|
+
if (!isPandaAttribute(node, context))
|
|
8946
|
+
return;
|
|
8947
|
+
sendReport(node.key);
|
|
8948
|
+
}
|
|
8949
|
+
};
|
|
8950
|
+
}
|
|
8951
|
+
});
|
|
8952
|
+
no_margin_properties_default = rule10;
|
|
8953
|
+
}
|
|
8954
|
+
});
|
|
8955
|
+
|
|
8956
|
+
// src/utils/physical-properties.ts
|
|
8957
|
+
var physicalProperties;
|
|
8958
|
+
var init_physical_properties = __esm({
|
|
8959
|
+
"src/utils/physical-properties.ts"() {
|
|
8960
|
+
"use strict";
|
|
8961
|
+
init_esm_shims();
|
|
8962
|
+
physicalProperties = {
|
|
8963
|
+
borderBottom: "borderBlockEnd",
|
|
8964
|
+
borderBottomColor: "borderBlockEndColor",
|
|
8965
|
+
borderBottomStyle: "borderBlockEndStyle",
|
|
8966
|
+
borderBottomWidth: "borderBlockEndWidth",
|
|
8967
|
+
borderTop: "borderBlockStart",
|
|
8968
|
+
borderTopColor: "borderBlockStartColor",
|
|
8969
|
+
borderTopStyle: "borderBlockStartStyle",
|
|
8970
|
+
borderTopWidth: "borderBlockStartWidth",
|
|
8971
|
+
borderRight: "borderInlineEnd",
|
|
8972
|
+
borderRightColor: "borderInlineEndColor",
|
|
8973
|
+
borderRightStyle: "borderInlineEndStyle",
|
|
8974
|
+
borderRightWidth: "borderInlineEndWidth",
|
|
8975
|
+
borderLeft: "borderInlineStart",
|
|
8976
|
+
borderLeftColor: "borderInlineStartColor",
|
|
8977
|
+
borderLeftStyle: "borderInlineStartStyle",
|
|
8978
|
+
borderLeftWidth: "borderInlineStartWidth",
|
|
8979
|
+
borderTopLeftRadius: "borderStartStartRadius",
|
|
8980
|
+
borderBottomLeftRadius: "borderEndStartRadius",
|
|
8981
|
+
borderTopRightRadius: "borderStartEndRadius",
|
|
8982
|
+
borderBottomRightRadius: "borderEndEndRadius",
|
|
8983
|
+
marginBottom: "marginBlockEnd",
|
|
8984
|
+
marginTop: "marginBlockStart",
|
|
8985
|
+
marginRight: "marginInlineEnd",
|
|
8986
|
+
marginLeft: "marginInlineStart",
|
|
8987
|
+
paddingBottom: "paddingBlockEnd",
|
|
8988
|
+
paddingTop: "paddingBlockStart",
|
|
8989
|
+
paddingRight: "paddingInlineEnd",
|
|
8990
|
+
paddingLeft: "paddingInlineStart",
|
|
8991
|
+
left: "insetInlineStart",
|
|
8992
|
+
right: "insetInlineEnd",
|
|
8993
|
+
top: "insetBlockStart",
|
|
8994
|
+
bottom: "insetBlockEnd"
|
|
8995
|
+
};
|
|
8996
|
+
}
|
|
8997
|
+
});
|
|
8998
|
+
|
|
8999
|
+
// src/rules/no-physical-properties.ts
|
|
9000
|
+
var RULE_NAME11, rule11, no_physical_properties_default;
|
|
9001
|
+
var init_no_physical_properties = __esm({
|
|
9002
|
+
"src/rules/no-physical-properties.ts"() {
|
|
9003
|
+
"use strict";
|
|
9004
|
+
init_esm_shims();
|
|
9005
|
+
init_helpers();
|
|
9006
|
+
init_utils();
|
|
9007
|
+
init_nodes();
|
|
9008
|
+
init_physical_properties();
|
|
9009
|
+
RULE_NAME11 = "no-physical-properties";
|
|
9010
|
+
rule11 = createRule({
|
|
9011
|
+
name: RULE_NAME11,
|
|
9012
|
+
meta: {
|
|
9013
|
+
docs: {
|
|
9014
|
+
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."
|
|
9015
|
+
},
|
|
9016
|
+
messages: {
|
|
9017
|
+
physical: "Use logical property of {{physical}} instead. Prefer `{{logical}}`",
|
|
9018
|
+
replace: "Replace `{{physical}}` with `{{logical}}`"
|
|
9019
|
+
},
|
|
9020
|
+
type: "suggestion",
|
|
9021
|
+
hasSuggestions: true,
|
|
9022
|
+
schema: []
|
|
9023
|
+
},
|
|
9024
|
+
defaultOptions: [],
|
|
9025
|
+
create(context) {
|
|
9026
|
+
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
9027
|
+
const sendReport = (node) => {
|
|
9028
|
+
if (!(getLonghand(node.name) in physicalProperties))
|
|
9029
|
+
return;
|
|
9030
|
+
const logical = physicalProperties[getLonghand(node.name)];
|
|
9031
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9032
|
+
return context.report({
|
|
9033
|
+
node,
|
|
9034
|
+
messageId: "physical",
|
|
9035
|
+
data: {
|
|
9036
|
+
physical: `\`${node.name}\`${longhand ? ` - \`${longhand}\`` : ""}`,
|
|
9037
|
+
logical
|
|
9038
|
+
},
|
|
9039
|
+
suggest: [
|
|
9040
|
+
{
|
|
9041
|
+
messageId: "replace",
|
|
9042
|
+
data: {
|
|
9043
|
+
physical: node.name,
|
|
9044
|
+
logical
|
|
9045
|
+
},
|
|
9046
|
+
fix: (fixer) => {
|
|
9047
|
+
return fixer.replaceTextRange(node.range, logical);
|
|
9048
|
+
}
|
|
9049
|
+
}
|
|
9050
|
+
]
|
|
9051
|
+
});
|
|
9052
|
+
};
|
|
9053
|
+
return {
|
|
9054
|
+
JSXAttribute(node) {
|
|
9055
|
+
if (!isJSXIdentifier(node.name))
|
|
9056
|
+
return;
|
|
9057
|
+
if (!isPandaProp(node, context))
|
|
9058
|
+
return;
|
|
9059
|
+
sendReport(node.name);
|
|
9060
|
+
},
|
|
9061
|
+
Property(node) {
|
|
9062
|
+
if (!isIdentifier(node.key))
|
|
9063
|
+
return;
|
|
9064
|
+
if (!isPandaAttribute(node, context))
|
|
9065
|
+
return;
|
|
9066
|
+
sendReport(node.key);
|
|
9067
|
+
}
|
|
9068
|
+
};
|
|
9069
|
+
}
|
|
9070
|
+
});
|
|
9071
|
+
no_physical_properties_default = rule11;
|
|
9072
|
+
}
|
|
9073
|
+
});
|
|
9074
|
+
|
|
8899
9075
|
// src/rules/no-property-renaming.ts
|
|
8900
|
-
var
|
|
9076
|
+
var RULE_NAME12, rule12, no_property_renaming_default;
|
|
8901
9077
|
var init_no_property_renaming = __esm({
|
|
8902
9078
|
"src/rules/no-property-renaming.ts"() {
|
|
8903
9079
|
"use strict";
|
|
@@ -8905,9 +9081,9 @@ var init_no_property_renaming = __esm({
|
|
|
8905
9081
|
init_utils();
|
|
8906
9082
|
init_helpers();
|
|
8907
9083
|
init_nodes();
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
name:
|
|
9084
|
+
RULE_NAME12 = "no-property-renaming";
|
|
9085
|
+
rule12 = createRule({
|
|
9086
|
+
name: RULE_NAME12,
|
|
8911
9087
|
meta: {
|
|
8912
9088
|
docs: {
|
|
8913
9089
|
description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
|
|
@@ -8930,6 +9106,14 @@ var init_no_property_renaming = __esm({
|
|
|
8930
9106
|
}
|
|
8931
9107
|
});
|
|
8932
9108
|
};
|
|
9109
|
+
const handleReport = (node, value, attr) => {
|
|
9110
|
+
if (isIdentifier(value) && attr !== value.name) {
|
|
9111
|
+
return sendReport(node, attr, value.name);
|
|
9112
|
+
}
|
|
9113
|
+
if (isMemberExpression(value) && isIdentifier(value.property) && attr !== value.property.name) {
|
|
9114
|
+
return sendReport(node, attr, value.property.name);
|
|
9115
|
+
}
|
|
9116
|
+
};
|
|
8933
9117
|
return {
|
|
8934
9118
|
JSXAttribute(node) {
|
|
8935
9119
|
if (!node.value)
|
|
@@ -8940,12 +9124,7 @@ var init_no_property_renaming = __esm({
|
|
|
8940
9124
|
return;
|
|
8941
9125
|
const attr = node.name.name.toString();
|
|
8942
9126
|
const expression = node.value.expression;
|
|
8943
|
-
|
|
8944
|
-
return sendReport(node, attr, expression.name);
|
|
8945
|
-
}
|
|
8946
|
-
if (isMemberExpression(expression) && isIdentifier(expression.property) && attr !== expression.property.name) {
|
|
8947
|
-
return sendReport(node, attr, expression.property.name);
|
|
8948
|
-
}
|
|
9127
|
+
handleReport(node, expression, attr);
|
|
8949
9128
|
},
|
|
8950
9129
|
Property(node) {
|
|
8951
9130
|
if (!isIdentifier(node.key))
|
|
@@ -8956,24 +9135,19 @@ var init_no_property_renaming = __esm({
|
|
|
8956
9135
|
return;
|
|
8957
9136
|
const attr = node.key.name.toString();
|
|
8958
9137
|
const value = node.value;
|
|
8959
|
-
|
|
8960
|
-
return sendReport(node, attr, value.name);
|
|
8961
|
-
}
|
|
8962
|
-
if (isMemberExpression(value) && isIdentifier(value.property) && attr !== value.property.name) {
|
|
8963
|
-
return sendReport(node, attr, value.property.name);
|
|
8964
|
-
}
|
|
9138
|
+
handleReport(node, value, attr);
|
|
8965
9139
|
}
|
|
8966
9140
|
};
|
|
8967
9141
|
}
|
|
8968
9142
|
});
|
|
8969
|
-
no_property_renaming_default =
|
|
9143
|
+
no_property_renaming_default = rule12;
|
|
8970
9144
|
}
|
|
8971
9145
|
});
|
|
8972
9146
|
|
|
8973
9147
|
// src/rules/no-unsafe-token-fn-usage.ts
|
|
8974
9148
|
import "@typescript-eslint/utils";
|
|
8975
9149
|
import { getArbitraryValue as getArbitraryValue3 } from "@pandacss/shared";
|
|
8976
|
-
var
|
|
9150
|
+
var RULE_NAME13, rule13, no_unsafe_token_fn_usage_default;
|
|
8977
9151
|
var init_no_unsafe_token_fn_usage = __esm({
|
|
8978
9152
|
"src/rules/no-unsafe-token-fn-usage.ts"() {
|
|
8979
9153
|
"use strict";
|
|
@@ -8981,9 +9155,9 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8981
9155
|
init_helpers();
|
|
8982
9156
|
init_utils();
|
|
8983
9157
|
init_nodes();
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
name:
|
|
9158
|
+
RULE_NAME13 = "no-unsafe-token-fn-usage";
|
|
9159
|
+
rule13 = createRule({
|
|
9160
|
+
name: RULE_NAME13,
|
|
8987
9161
|
meta: {
|
|
8988
9162
|
docs: {
|
|
8989
9163
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
@@ -9079,12 +9253,12 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
9079
9253
|
};
|
|
9080
9254
|
}
|
|
9081
9255
|
});
|
|
9082
|
-
no_unsafe_token_fn_usage_default =
|
|
9256
|
+
no_unsafe_token_fn_usage_default = rule13;
|
|
9083
9257
|
}
|
|
9084
9258
|
});
|
|
9085
9259
|
|
|
9086
9260
|
// src/rules/prefer-longhand-properties.ts
|
|
9087
|
-
var
|
|
9261
|
+
var RULE_NAME14, rule14, prefer_longhand_properties_default;
|
|
9088
9262
|
var init_prefer_longhand_properties = __esm({
|
|
9089
9263
|
"src/rules/prefer-longhand-properties.ts"() {
|
|
9090
9264
|
"use strict";
|
|
@@ -9092,9 +9266,9 @@ var init_prefer_longhand_properties = __esm({
|
|
|
9092
9266
|
init_helpers();
|
|
9093
9267
|
init_utils();
|
|
9094
9268
|
init_nodes();
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
name:
|
|
9269
|
+
RULE_NAME14 = "prefer-longhand-properties";
|
|
9270
|
+
rule14 = createRule({
|
|
9271
|
+
name: RULE_NAME14,
|
|
9098
9272
|
meta: {
|
|
9099
9273
|
docs: {
|
|
9100
9274
|
description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
|
|
@@ -9109,10 +9283,12 @@ var init_prefer_longhand_properties = __esm({
|
|
|
9109
9283
|
},
|
|
9110
9284
|
defaultOptions: [],
|
|
9111
9285
|
create(context) {
|
|
9112
|
-
const sendReport = (node
|
|
9113
|
-
const longhand = resolveLonghand(
|
|
9286
|
+
const sendReport = (node) => {
|
|
9287
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9288
|
+
if (!longhand)
|
|
9289
|
+
return;
|
|
9114
9290
|
const data = {
|
|
9115
|
-
shorthand:
|
|
9291
|
+
shorthand: node.name,
|
|
9116
9292
|
longhand
|
|
9117
9293
|
};
|
|
9118
9294
|
return context.report({
|
|
@@ -9136,30 +9312,24 @@ var init_prefer_longhand_properties = __esm({
|
|
|
9136
9312
|
return;
|
|
9137
9313
|
if (!isPandaProp(node, context))
|
|
9138
9314
|
return;
|
|
9139
|
-
|
|
9140
|
-
if (!longhand)
|
|
9141
|
-
return;
|
|
9142
|
-
sendReport(node.name, node.name.name);
|
|
9315
|
+
sendReport(node.name);
|
|
9143
9316
|
},
|
|
9144
9317
|
Property(node) {
|
|
9145
9318
|
if (!isIdentifier(node.key))
|
|
9146
9319
|
return;
|
|
9147
9320
|
if (!isPandaAttribute(node, context))
|
|
9148
9321
|
return;
|
|
9149
|
-
|
|
9150
|
-
if (!longhand)
|
|
9151
|
-
return;
|
|
9152
|
-
sendReport(node.key, node.key.name);
|
|
9322
|
+
sendReport(node.key);
|
|
9153
9323
|
}
|
|
9154
9324
|
};
|
|
9155
9325
|
}
|
|
9156
9326
|
});
|
|
9157
|
-
prefer_longhand_properties_default =
|
|
9327
|
+
prefer_longhand_properties_default = rule14;
|
|
9158
9328
|
}
|
|
9159
9329
|
});
|
|
9160
9330
|
|
|
9161
9331
|
// src/rules/prefer-shorthand-properties.ts
|
|
9162
|
-
var
|
|
9332
|
+
var RULE_NAME15, rule15, prefer_shorthand_properties_default;
|
|
9163
9333
|
var init_prefer_shorthand_properties = __esm({
|
|
9164
9334
|
"src/rules/prefer-shorthand-properties.ts"() {
|
|
9165
9335
|
"use strict";
|
|
@@ -9167,9 +9337,9 @@ var init_prefer_shorthand_properties = __esm({
|
|
|
9167
9337
|
init_helpers();
|
|
9168
9338
|
init_utils();
|
|
9169
9339
|
init_nodes();
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
name:
|
|
9340
|
+
RULE_NAME15 = "prefer-shorthand-properties";
|
|
9341
|
+
rule15 = createRule({
|
|
9342
|
+
name: RULE_NAME15,
|
|
9173
9343
|
meta: {
|
|
9174
9344
|
docs: {
|
|
9175
9345
|
description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
|
|
@@ -9184,13 +9354,16 @@ var init_prefer_shorthand_properties = __esm({
|
|
|
9184
9354
|
},
|
|
9185
9355
|
defaultOptions: [],
|
|
9186
9356
|
create(context) {
|
|
9187
|
-
const sendReport = (node
|
|
9188
|
-
const
|
|
9357
|
+
const sendReport = (node) => {
|
|
9358
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9359
|
+
if (longhand)
|
|
9360
|
+
return;
|
|
9361
|
+
const shorthands = resolveShorthands(node.name, context);
|
|
9189
9362
|
if (!shorthands)
|
|
9190
9363
|
return;
|
|
9191
9364
|
const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
|
|
9192
9365
|
const data = {
|
|
9193
|
-
longhand:
|
|
9366
|
+
longhand: node.name,
|
|
9194
9367
|
shorthand
|
|
9195
9368
|
};
|
|
9196
9369
|
return context.report({
|
|
@@ -9214,25 +9387,19 @@ var init_prefer_shorthand_properties = __esm({
|
|
|
9214
9387
|
return;
|
|
9215
9388
|
if (!isPandaProp(node, context))
|
|
9216
9389
|
return;
|
|
9217
|
-
|
|
9218
|
-
if (longhand)
|
|
9219
|
-
return;
|
|
9220
|
-
sendReport(node.name, node.name.name);
|
|
9390
|
+
sendReport(node.name);
|
|
9221
9391
|
},
|
|
9222
9392
|
Property(node) {
|
|
9223
9393
|
if (!isIdentifier(node.key))
|
|
9224
9394
|
return;
|
|
9225
9395
|
if (!isPandaAttribute(node, context))
|
|
9226
9396
|
return;
|
|
9227
|
-
|
|
9228
|
-
if (longhand)
|
|
9229
|
-
return;
|
|
9230
|
-
sendReport(node.key, node.key.name);
|
|
9397
|
+
sendReport(node.key);
|
|
9231
9398
|
}
|
|
9232
9399
|
};
|
|
9233
9400
|
}
|
|
9234
9401
|
});
|
|
9235
|
-
prefer_shorthand_properties_default =
|
|
9402
|
+
prefer_shorthand_properties_default = rule15;
|
|
9236
9403
|
}
|
|
9237
9404
|
});
|
|
9238
9405
|
|
|
@@ -9357,7 +9524,7 @@ var init_composite_properties = __esm({
|
|
|
9357
9524
|
});
|
|
9358
9525
|
|
|
9359
9526
|
// src/rules/prefer-atomic-properties.ts
|
|
9360
|
-
var
|
|
9527
|
+
var RULE_NAME16, rule16, prefer_atomic_properties_default;
|
|
9361
9528
|
var init_prefer_atomic_properties = __esm({
|
|
9362
9529
|
"src/rules/prefer-atomic-properties.ts"() {
|
|
9363
9530
|
"use strict";
|
|
@@ -9366,9 +9533,9 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9366
9533
|
init_utils();
|
|
9367
9534
|
init_composite_properties();
|
|
9368
9535
|
init_nodes();
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
name:
|
|
9536
|
+
RULE_NAME16 = "prefer-atomic-properties";
|
|
9537
|
+
rule16 = createRule({
|
|
9538
|
+
name: RULE_NAME16,
|
|
9372
9539
|
meta: {
|
|
9373
9540
|
docs: {
|
|
9374
9541
|
description: "Encourage the use of atomic properties instead of composite properties in the codebase."
|
|
@@ -9388,14 +9555,16 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9388
9555
|
if (isValidProperty(longhand, context) && Object.hasOwn(compositeProperties, longhand))
|
|
9389
9556
|
return longhand;
|
|
9390
9557
|
};
|
|
9391
|
-
const sendReport = (node
|
|
9392
|
-
const cmp = resolveCompositeProperty(
|
|
9393
|
-
|
|
9558
|
+
const sendReport = (node) => {
|
|
9559
|
+
const cmp = resolveCompositeProperty(node.name);
|
|
9560
|
+
if (!cmp)
|
|
9561
|
+
return;
|
|
9562
|
+
const atomics = compositeProperties[cmp].map((name2) => `\`${name2}\``).join(",\n");
|
|
9394
9563
|
return context.report({
|
|
9395
9564
|
node,
|
|
9396
9565
|
messageId: "atomic",
|
|
9397
9566
|
data: {
|
|
9398
|
-
composite:
|
|
9567
|
+
composite: node.name,
|
|
9399
9568
|
atomics
|
|
9400
9569
|
}
|
|
9401
9570
|
});
|
|
@@ -9406,30 +9575,24 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9406
9575
|
return;
|
|
9407
9576
|
if (!isPandaProp(node, context))
|
|
9408
9577
|
return;
|
|
9409
|
-
|
|
9410
|
-
if (!cmp)
|
|
9411
|
-
return;
|
|
9412
|
-
sendReport(node, node.name.name);
|
|
9578
|
+
sendReport(node.name);
|
|
9413
9579
|
},
|
|
9414
9580
|
Property(node) {
|
|
9415
9581
|
if (!isIdentifier(node.key))
|
|
9416
9582
|
return;
|
|
9417
9583
|
if (!isPandaAttribute(node, context))
|
|
9418
9584
|
return;
|
|
9419
|
-
|
|
9420
|
-
if (!cmp)
|
|
9421
|
-
return;
|
|
9422
|
-
sendReport(node.key, node.key.name);
|
|
9585
|
+
sendReport(node.key);
|
|
9423
9586
|
}
|
|
9424
9587
|
};
|
|
9425
9588
|
}
|
|
9426
9589
|
});
|
|
9427
|
-
prefer_atomic_properties_default =
|
|
9590
|
+
prefer_atomic_properties_default = rule16;
|
|
9428
9591
|
}
|
|
9429
9592
|
});
|
|
9430
9593
|
|
|
9431
9594
|
// src/rules/prefer-composite-properties.ts
|
|
9432
|
-
var
|
|
9595
|
+
var RULE_NAME17, rule17, prefer_composite_properties_default;
|
|
9433
9596
|
var init_prefer_composite_properties = __esm({
|
|
9434
9597
|
"src/rules/prefer-composite-properties.ts"() {
|
|
9435
9598
|
"use strict";
|
|
@@ -9438,9 +9601,9 @@ var init_prefer_composite_properties = __esm({
|
|
|
9438
9601
|
init_utils();
|
|
9439
9602
|
init_composite_properties();
|
|
9440
9603
|
init_nodes();
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
name:
|
|
9604
|
+
RULE_NAME17 = "prefer-composite-properties";
|
|
9605
|
+
rule17 = createRule({
|
|
9606
|
+
name: RULE_NAME17,
|
|
9444
9607
|
meta: {
|
|
9445
9608
|
docs: {
|
|
9446
9609
|
description: "Encourage the use of composite properties instead of atomic properties in the codebase."
|
|
@@ -9459,14 +9622,16 @@ var init_prefer_composite_properties = __esm({
|
|
|
9459
9622
|
return;
|
|
9460
9623
|
return Object.keys(compositeProperties).find((cpd) => compositeProperties[cpd].includes(longhand));
|
|
9461
9624
|
};
|
|
9462
|
-
const sendReport = (node
|
|
9463
|
-
const cmp = resolveCompositeProperty(
|
|
9625
|
+
const sendReport = (node) => {
|
|
9626
|
+
const cmp = resolveCompositeProperty(node.name);
|
|
9627
|
+
if (!cmp)
|
|
9628
|
+
return;
|
|
9464
9629
|
return context.report({
|
|
9465
9630
|
node,
|
|
9466
9631
|
messageId: "composite",
|
|
9467
9632
|
data: {
|
|
9468
9633
|
composite: cmp,
|
|
9469
|
-
atomic:
|
|
9634
|
+
atomic: node.name
|
|
9470
9635
|
}
|
|
9471
9636
|
});
|
|
9472
9637
|
};
|
|
@@ -9476,30 +9641,24 @@ var init_prefer_composite_properties = __esm({
|
|
|
9476
9641
|
return;
|
|
9477
9642
|
if (!isPandaProp(node, context))
|
|
9478
9643
|
return;
|
|
9479
|
-
|
|
9480
|
-
if (!atm)
|
|
9481
|
-
return;
|
|
9482
|
-
sendReport(node, node.name.name);
|
|
9644
|
+
sendReport(node.name);
|
|
9483
9645
|
},
|
|
9484
9646
|
Property(node) {
|
|
9485
9647
|
if (!isIdentifier(node.key))
|
|
9486
9648
|
return;
|
|
9487
9649
|
if (!isPandaAttribute(node, context))
|
|
9488
9650
|
return;
|
|
9489
|
-
|
|
9490
|
-
if (!atm)
|
|
9491
|
-
return;
|
|
9492
|
-
sendReport(node.key, node.key.name);
|
|
9651
|
+
sendReport(node.key);
|
|
9493
9652
|
}
|
|
9494
9653
|
};
|
|
9495
9654
|
}
|
|
9496
9655
|
});
|
|
9497
|
-
prefer_composite_properties_default =
|
|
9656
|
+
prefer_composite_properties_default = rule17;
|
|
9498
9657
|
}
|
|
9499
9658
|
});
|
|
9500
9659
|
|
|
9501
9660
|
// src/rules/prefer-unified-property-style.ts
|
|
9502
|
-
var
|
|
9661
|
+
var RULE_NAME18, rule18, prefer_unified_property_style_default;
|
|
9503
9662
|
var init_prefer_unified_property_style = __esm({
|
|
9504
9663
|
"src/rules/prefer-unified-property-style.ts"() {
|
|
9505
9664
|
"use strict";
|
|
@@ -9508,9 +9667,9 @@ var init_prefer_unified_property_style = __esm({
|
|
|
9508
9667
|
init_utils();
|
|
9509
9668
|
init_composite_properties();
|
|
9510
9669
|
init_nodes();
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
name:
|
|
9670
|
+
RULE_NAME18 = "prefer-unified-property-style";
|
|
9671
|
+
rule18 = createRule({
|
|
9672
|
+
name: RULE_NAME18,
|
|
9514
9673
|
meta: {
|
|
9515
9674
|
docs: {
|
|
9516
9675
|
description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
|
|
@@ -9525,10 +9684,10 @@ var init_prefer_unified_property_style = __esm({
|
|
|
9525
9684
|
create(context) {
|
|
9526
9685
|
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
9527
9686
|
const resolveCompositeProperty = (name2) => {
|
|
9528
|
-
if (
|
|
9687
|
+
if (name2 in compositeProperties)
|
|
9529
9688
|
return name2;
|
|
9530
9689
|
const longhand = getLonghand(name2);
|
|
9531
|
-
if (isValidProperty(longhand, context) &&
|
|
9690
|
+
if (isValidProperty(longhand, context) && longhand in compositeProperties)
|
|
9532
9691
|
return longhand;
|
|
9533
9692
|
};
|
|
9534
9693
|
const sendReport = (node, cmp, siblings) => {
|
|
@@ -9577,7 +9736,7 @@ var init_prefer_unified_property_style = __esm({
|
|
|
9577
9736
|
};
|
|
9578
9737
|
}
|
|
9579
9738
|
});
|
|
9580
|
-
prefer_unified_property_style_default =
|
|
9739
|
+
prefer_unified_property_style_default = rule18;
|
|
9581
9740
|
}
|
|
9582
9741
|
});
|
|
9583
9742
|
|
|
@@ -9596,6 +9755,8 @@ var init_rules = __esm({
|
|
|
9596
9755
|
init_no_important();
|
|
9597
9756
|
init_no_invalid_nesting();
|
|
9598
9757
|
init_no_invalid_token_paths();
|
|
9758
|
+
init_no_margin_properties();
|
|
9759
|
+
init_no_physical_properties();
|
|
9599
9760
|
init_no_property_renaming();
|
|
9600
9761
|
init_no_unsafe_token_fn_usage();
|
|
9601
9762
|
init_prefer_longhand_properties();
|
|
@@ -9613,13 +9774,15 @@ var init_rules = __esm({
|
|
|
9613
9774
|
[RULE_NAME7]: no_important_default,
|
|
9614
9775
|
[RULE_NAME9]: no_invalid_token_paths_default,
|
|
9615
9776
|
[RULE_NAME8]: no_invalid_nesting_default,
|
|
9616
|
-
[RULE_NAME10]:
|
|
9617
|
-
[RULE_NAME11]:
|
|
9618
|
-
[RULE_NAME12]:
|
|
9619
|
-
[RULE_NAME13]:
|
|
9620
|
-
[RULE_NAME14]:
|
|
9621
|
-
[RULE_NAME15]:
|
|
9622
|
-
[RULE_NAME16]:
|
|
9777
|
+
[RULE_NAME10]: no_margin_properties_default,
|
|
9778
|
+
[RULE_NAME11]: no_physical_properties_default,
|
|
9779
|
+
[RULE_NAME12]: no_property_renaming_default,
|
|
9780
|
+
[RULE_NAME13]: no_unsafe_token_fn_usage_default,
|
|
9781
|
+
[RULE_NAME14]: prefer_longhand_properties_default,
|
|
9782
|
+
[RULE_NAME15]: prefer_shorthand_properties_default,
|
|
9783
|
+
[RULE_NAME16]: prefer_atomic_properties_default,
|
|
9784
|
+
[RULE_NAME17]: prefer_composite_properties_default,
|
|
9785
|
+
[RULE_NAME18]: prefer_unified_property_style_default
|
|
9623
9786
|
};
|
|
9624
9787
|
}
|
|
9625
9788
|
});
|