@pandacss/eslint-plugin 0.0.0-dev-20240210234546 → 0.0.0-dev-20240211163817
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 +181 -110
- package/dist/index.mjs +198 -117
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7957,7 +7957,7 @@ init_cjs_shims();
|
|
|
7957
7957
|
|
|
7958
7958
|
// package.json
|
|
7959
7959
|
var name = "@pandacss/eslint-plugin";
|
|
7960
|
-
var version = "0.0.0-dev-
|
|
7960
|
+
var version = "0.0.0-dev-20240211163817";
|
|
7961
7961
|
|
|
7962
7962
|
// src/configs/all.ts
|
|
7963
7963
|
init_cjs_shims();
|
|
@@ -8839,6 +8839,95 @@ var rule9 = createRule({
|
|
|
8839
8839
|
});
|
|
8840
8840
|
var no_invalid_token_paths_default = rule9;
|
|
8841
8841
|
|
|
8842
|
+
// src/rules/no-margin-properties.ts
|
|
8843
|
+
init_cjs_shims();
|
|
8844
|
+
var RULE_NAME10 = "no-margin-properties";
|
|
8845
|
+
var rule10 = createRule({
|
|
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
|
+
TaggedTemplateExpression(node) {
|
|
8884
|
+
const handleExpression = (caller) => {
|
|
8885
|
+
if (!isPandaIsh(caller, context))
|
|
8886
|
+
return;
|
|
8887
|
+
const quasis = node.quasi.quasis[0];
|
|
8888
|
+
const styles = quasis.value.raw;
|
|
8889
|
+
const propertyRegex = /([a-zA-Z-]+):/g;
|
|
8890
|
+
const propertyMatches = [...styles.matchAll(propertyRegex)];
|
|
8891
|
+
const properties = propertyMatches.map((match) => match[1].trim());
|
|
8892
|
+
properties.forEach((property, i, arr) => {
|
|
8893
|
+
if (!property.includes("margin"))
|
|
8894
|
+
return;
|
|
8895
|
+
if (arr.indexOf(property) < i)
|
|
8896
|
+
return;
|
|
8897
|
+
let index = styles.indexOf(property);
|
|
8898
|
+
while (index !== -1) {
|
|
8899
|
+
const start = quasis.range[0] + 1 + index;
|
|
8900
|
+
const end = start + property.length;
|
|
8901
|
+
context.report({
|
|
8902
|
+
loc: {
|
|
8903
|
+
start: context.sourceCode.getLocFromIndex(start),
|
|
8904
|
+
end: context.sourceCode.getLocFromIndex(end)
|
|
8905
|
+
},
|
|
8906
|
+
messageId: "noMargin"
|
|
8907
|
+
});
|
|
8908
|
+
index = styles.indexOf(property, index + 1);
|
|
8909
|
+
}
|
|
8910
|
+
});
|
|
8911
|
+
};
|
|
8912
|
+
if (isIdentifier(node.tag)) {
|
|
8913
|
+
handleExpression(node.tag.name);
|
|
8914
|
+
}
|
|
8915
|
+
if (isMemberExpression(node.tag)) {
|
|
8916
|
+
if (!isIdentifier(node.tag.object))
|
|
8917
|
+
return;
|
|
8918
|
+
handleExpression(node.tag.object.name);
|
|
8919
|
+
}
|
|
8920
|
+
if (isCallExpression(node.tag)) {
|
|
8921
|
+
if (!isIdentifier(node.tag.callee))
|
|
8922
|
+
return;
|
|
8923
|
+
handleExpression(node.tag.callee.name);
|
|
8924
|
+
}
|
|
8925
|
+
}
|
|
8926
|
+
};
|
|
8927
|
+
}
|
|
8928
|
+
});
|
|
8929
|
+
var no_margin_properties_default = rule10;
|
|
8930
|
+
|
|
8842
8931
|
// src/rules/no-physical-properties.ts
|
|
8843
8932
|
init_cjs_shims();
|
|
8844
8933
|
|
|
@@ -8880,9 +8969,9 @@ var physicalProperties = {
|
|
|
8880
8969
|
};
|
|
8881
8970
|
|
|
8882
8971
|
// src/rules/no-physical-properties.ts
|
|
8883
|
-
var
|
|
8884
|
-
var
|
|
8885
|
-
name:
|
|
8972
|
+
var RULE_NAME11 = "no-physical-properties";
|
|
8973
|
+
var rule11 = createRule({
|
|
8974
|
+
name: RULE_NAME11,
|
|
8886
8975
|
meta: {
|
|
8887
8976
|
docs: {
|
|
8888
8977
|
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."
|
|
@@ -8898,21 +8987,23 @@ var rule10 = createRule({
|
|
|
8898
8987
|
defaultOptions: [],
|
|
8899
8988
|
create(context) {
|
|
8900
8989
|
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
8901
|
-
const sendReport = (node
|
|
8902
|
-
|
|
8903
|
-
|
|
8990
|
+
const sendReport = (node) => {
|
|
8991
|
+
if (!(getLonghand(node.name) in physicalProperties))
|
|
8992
|
+
return;
|
|
8993
|
+
const logical = physicalProperties[getLonghand(node.name)];
|
|
8994
|
+
const longhand = resolveLonghand(node.name, context);
|
|
8904
8995
|
return context.report({
|
|
8905
8996
|
node,
|
|
8906
8997
|
messageId: "physical",
|
|
8907
8998
|
data: {
|
|
8908
|
-
physical: `\`${
|
|
8999
|
+
physical: `\`${node.name}\`${longhand ? ` - \`${longhand}\`` : ""}`,
|
|
8909
9000
|
logical
|
|
8910
9001
|
},
|
|
8911
9002
|
suggest: [
|
|
8912
9003
|
{
|
|
8913
9004
|
messageId: "replace",
|
|
8914
9005
|
data: {
|
|
8915
|
-
physical:
|
|
9006
|
+
physical: node.name,
|
|
8916
9007
|
logical
|
|
8917
9008
|
},
|
|
8918
9009
|
fix: (fixer) => {
|
|
@@ -8928,29 +9019,25 @@ var rule10 = createRule({
|
|
|
8928
9019
|
return;
|
|
8929
9020
|
if (!isPandaProp(node, context))
|
|
8930
9021
|
return;
|
|
8931
|
-
|
|
8932
|
-
sendReport(node.name, node.name.name);
|
|
8933
|
-
}
|
|
9022
|
+
sendReport(node.name);
|
|
8934
9023
|
},
|
|
8935
9024
|
Property(node) {
|
|
8936
9025
|
if (!isIdentifier(node.key))
|
|
8937
9026
|
return;
|
|
8938
9027
|
if (!isPandaAttribute(node, context))
|
|
8939
9028
|
return;
|
|
8940
|
-
|
|
8941
|
-
sendReport(node.key, node.key.name);
|
|
8942
|
-
}
|
|
9029
|
+
sendReport(node.key);
|
|
8943
9030
|
}
|
|
8944
9031
|
};
|
|
8945
9032
|
}
|
|
8946
9033
|
});
|
|
8947
|
-
var no_physical_properties_default =
|
|
9034
|
+
var no_physical_properties_default = rule11;
|
|
8948
9035
|
|
|
8949
9036
|
// src/rules/no-property-renaming.ts
|
|
8950
9037
|
init_cjs_shims();
|
|
8951
|
-
var
|
|
8952
|
-
var
|
|
8953
|
-
name:
|
|
9038
|
+
var RULE_NAME12 = "no-property-renaming";
|
|
9039
|
+
var rule12 = createRule({
|
|
9040
|
+
name: RULE_NAME12,
|
|
8954
9041
|
meta: {
|
|
8955
9042
|
docs: {
|
|
8956
9043
|
description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
|
|
@@ -8973,6 +9060,14 @@ var rule11 = createRule({
|
|
|
8973
9060
|
}
|
|
8974
9061
|
});
|
|
8975
9062
|
};
|
|
9063
|
+
const handleReport = (node, value, attr) => {
|
|
9064
|
+
if (isIdentifier(value) && attr !== value.name) {
|
|
9065
|
+
return sendReport(node, attr, value.name);
|
|
9066
|
+
}
|
|
9067
|
+
if (isMemberExpression(value) && isIdentifier(value.property) && attr !== value.property.name) {
|
|
9068
|
+
return sendReport(node, attr, value.property.name);
|
|
9069
|
+
}
|
|
9070
|
+
};
|
|
8976
9071
|
return {
|
|
8977
9072
|
JSXAttribute(node) {
|
|
8978
9073
|
if (!node.value)
|
|
@@ -8983,12 +9078,7 @@ var rule11 = createRule({
|
|
|
8983
9078
|
return;
|
|
8984
9079
|
const attr = node.name.name.toString();
|
|
8985
9080
|
const expression = node.value.expression;
|
|
8986
|
-
|
|
8987
|
-
return sendReport(node, attr, expression.name);
|
|
8988
|
-
}
|
|
8989
|
-
if (isMemberExpression(expression) && isIdentifier(expression.property) && attr !== expression.property.name) {
|
|
8990
|
-
return sendReport(node, attr, expression.property.name);
|
|
8991
|
-
}
|
|
9081
|
+
handleReport(node, expression, attr);
|
|
8992
9082
|
},
|
|
8993
9083
|
Property(node) {
|
|
8994
9084
|
if (!isIdentifier(node.key))
|
|
@@ -8999,25 +9089,20 @@ var rule11 = createRule({
|
|
|
8999
9089
|
return;
|
|
9000
9090
|
const attr = node.key.name.toString();
|
|
9001
9091
|
const value = node.value;
|
|
9002
|
-
|
|
9003
|
-
return sendReport(node, attr, value.name);
|
|
9004
|
-
}
|
|
9005
|
-
if (isMemberExpression(value) && isIdentifier(value.property) && attr !== value.property.name) {
|
|
9006
|
-
return sendReport(node, attr, value.property.name);
|
|
9007
|
-
}
|
|
9092
|
+
handleReport(node, value, attr);
|
|
9008
9093
|
}
|
|
9009
9094
|
};
|
|
9010
9095
|
}
|
|
9011
9096
|
});
|
|
9012
|
-
var no_property_renaming_default =
|
|
9097
|
+
var no_property_renaming_default = rule12;
|
|
9013
9098
|
|
|
9014
9099
|
// src/rules/no-unsafe-token-fn-usage.ts
|
|
9015
9100
|
init_cjs_shims();
|
|
9016
|
-
var
|
|
9101
|
+
var import_utils17 = require("@typescript-eslint/utils");
|
|
9017
9102
|
var import_shared3 = require("@pandacss/shared");
|
|
9018
|
-
var
|
|
9019
|
-
var
|
|
9020
|
-
name:
|
|
9103
|
+
var RULE_NAME13 = "no-unsafe-token-fn-usage";
|
|
9104
|
+
var rule13 = createRule({
|
|
9105
|
+
name: RULE_NAME13,
|
|
9021
9106
|
meta: {
|
|
9022
9107
|
docs: {
|
|
9023
9108
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
@@ -9113,13 +9198,13 @@ var rule12 = createRule({
|
|
|
9113
9198
|
};
|
|
9114
9199
|
}
|
|
9115
9200
|
});
|
|
9116
|
-
var no_unsafe_token_fn_usage_default =
|
|
9201
|
+
var no_unsafe_token_fn_usage_default = rule13;
|
|
9117
9202
|
|
|
9118
9203
|
// src/rules/prefer-longhand-properties.ts
|
|
9119
9204
|
init_cjs_shims();
|
|
9120
|
-
var
|
|
9121
|
-
var
|
|
9122
|
-
name:
|
|
9205
|
+
var RULE_NAME14 = "prefer-longhand-properties";
|
|
9206
|
+
var rule14 = createRule({
|
|
9207
|
+
name: RULE_NAME14,
|
|
9123
9208
|
meta: {
|
|
9124
9209
|
docs: {
|
|
9125
9210
|
description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
|
|
@@ -9134,10 +9219,12 @@ var rule13 = createRule({
|
|
|
9134
9219
|
},
|
|
9135
9220
|
defaultOptions: [],
|
|
9136
9221
|
create(context) {
|
|
9137
|
-
const sendReport = (node
|
|
9138
|
-
const longhand = resolveLonghand(
|
|
9222
|
+
const sendReport = (node) => {
|
|
9223
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9224
|
+
if (!longhand)
|
|
9225
|
+
return;
|
|
9139
9226
|
const data = {
|
|
9140
|
-
shorthand:
|
|
9227
|
+
shorthand: node.name,
|
|
9141
9228
|
longhand
|
|
9142
9229
|
};
|
|
9143
9230
|
return context.report({
|
|
@@ -9161,31 +9248,25 @@ var rule13 = createRule({
|
|
|
9161
9248
|
return;
|
|
9162
9249
|
if (!isPandaProp(node, context))
|
|
9163
9250
|
return;
|
|
9164
|
-
|
|
9165
|
-
if (!longhand)
|
|
9166
|
-
return;
|
|
9167
|
-
sendReport(node.name, node.name.name);
|
|
9251
|
+
sendReport(node.name);
|
|
9168
9252
|
},
|
|
9169
9253
|
Property(node) {
|
|
9170
9254
|
if (!isIdentifier(node.key))
|
|
9171
9255
|
return;
|
|
9172
9256
|
if (!isPandaAttribute(node, context))
|
|
9173
9257
|
return;
|
|
9174
|
-
|
|
9175
|
-
if (!longhand)
|
|
9176
|
-
return;
|
|
9177
|
-
sendReport(node.key, node.key.name);
|
|
9258
|
+
sendReport(node.key);
|
|
9178
9259
|
}
|
|
9179
9260
|
};
|
|
9180
9261
|
}
|
|
9181
9262
|
});
|
|
9182
|
-
var prefer_longhand_properties_default =
|
|
9263
|
+
var prefer_longhand_properties_default = rule14;
|
|
9183
9264
|
|
|
9184
9265
|
// src/rules/prefer-shorthand-properties.ts
|
|
9185
9266
|
init_cjs_shims();
|
|
9186
|
-
var
|
|
9187
|
-
var
|
|
9188
|
-
name:
|
|
9267
|
+
var RULE_NAME15 = "prefer-shorthand-properties";
|
|
9268
|
+
var rule15 = createRule({
|
|
9269
|
+
name: RULE_NAME15,
|
|
9189
9270
|
meta: {
|
|
9190
9271
|
docs: {
|
|
9191
9272
|
description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
|
|
@@ -9200,13 +9281,16 @@ var rule14 = createRule({
|
|
|
9200
9281
|
},
|
|
9201
9282
|
defaultOptions: [],
|
|
9202
9283
|
create(context) {
|
|
9203
|
-
const sendReport = (node
|
|
9204
|
-
const
|
|
9284
|
+
const sendReport = (node) => {
|
|
9285
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9286
|
+
if (longhand)
|
|
9287
|
+
return;
|
|
9288
|
+
const shorthands = resolveShorthands(node.name, context);
|
|
9205
9289
|
if (!shorthands)
|
|
9206
9290
|
return;
|
|
9207
9291
|
const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
|
|
9208
9292
|
const data = {
|
|
9209
|
-
longhand:
|
|
9293
|
+
longhand: node.name,
|
|
9210
9294
|
shorthand
|
|
9211
9295
|
};
|
|
9212
9296
|
return context.report({
|
|
@@ -9230,25 +9314,19 @@ var rule14 = createRule({
|
|
|
9230
9314
|
return;
|
|
9231
9315
|
if (!isPandaProp(node, context))
|
|
9232
9316
|
return;
|
|
9233
|
-
|
|
9234
|
-
if (longhand)
|
|
9235
|
-
return;
|
|
9236
|
-
sendReport(node.name, node.name.name);
|
|
9317
|
+
sendReport(node.name);
|
|
9237
9318
|
},
|
|
9238
9319
|
Property(node) {
|
|
9239
9320
|
if (!isIdentifier(node.key))
|
|
9240
9321
|
return;
|
|
9241
9322
|
if (!isPandaAttribute(node, context))
|
|
9242
9323
|
return;
|
|
9243
|
-
|
|
9244
|
-
if (longhand)
|
|
9245
|
-
return;
|
|
9246
|
-
sendReport(node.key, node.key.name);
|
|
9324
|
+
sendReport(node.key);
|
|
9247
9325
|
}
|
|
9248
9326
|
};
|
|
9249
9327
|
}
|
|
9250
9328
|
});
|
|
9251
|
-
var prefer_shorthand_properties_default =
|
|
9329
|
+
var prefer_shorthand_properties_default = rule15;
|
|
9252
9330
|
|
|
9253
9331
|
// src/rules/prefer-atomic-properties.ts
|
|
9254
9332
|
init_cjs_shims();
|
|
@@ -9368,9 +9446,9 @@ var compositeProperties = {
|
|
|
9368
9446
|
};
|
|
9369
9447
|
|
|
9370
9448
|
// src/rules/prefer-atomic-properties.ts
|
|
9371
|
-
var
|
|
9372
|
-
var
|
|
9373
|
-
name:
|
|
9449
|
+
var RULE_NAME16 = "prefer-atomic-properties";
|
|
9450
|
+
var rule16 = createRule({
|
|
9451
|
+
name: RULE_NAME16,
|
|
9374
9452
|
meta: {
|
|
9375
9453
|
docs: {
|
|
9376
9454
|
description: "Encourage the use of atomic properties instead of composite properties in the codebase."
|
|
@@ -9390,14 +9468,16 @@ var rule15 = createRule({
|
|
|
9390
9468
|
if (isValidProperty(longhand, context) && Object.hasOwn(compositeProperties, longhand))
|
|
9391
9469
|
return longhand;
|
|
9392
9470
|
};
|
|
9393
|
-
const sendReport = (node
|
|
9394
|
-
const cmp = resolveCompositeProperty(
|
|
9395
|
-
|
|
9471
|
+
const sendReport = (node) => {
|
|
9472
|
+
const cmp = resolveCompositeProperty(node.name);
|
|
9473
|
+
if (!cmp)
|
|
9474
|
+
return;
|
|
9475
|
+
const atomics = compositeProperties[cmp].map((name2) => `\`${name2}\``).join(",\n");
|
|
9396
9476
|
return context.report({
|
|
9397
9477
|
node,
|
|
9398
9478
|
messageId: "atomic",
|
|
9399
9479
|
data: {
|
|
9400
|
-
composite:
|
|
9480
|
+
composite: node.name,
|
|
9401
9481
|
atomics
|
|
9402
9482
|
}
|
|
9403
9483
|
});
|
|
@@ -9408,31 +9488,25 @@ var rule15 = createRule({
|
|
|
9408
9488
|
return;
|
|
9409
9489
|
if (!isPandaProp(node, context))
|
|
9410
9490
|
return;
|
|
9411
|
-
|
|
9412
|
-
if (!cmp)
|
|
9413
|
-
return;
|
|
9414
|
-
sendReport(node, node.name.name);
|
|
9491
|
+
sendReport(node.name);
|
|
9415
9492
|
},
|
|
9416
9493
|
Property(node) {
|
|
9417
9494
|
if (!isIdentifier(node.key))
|
|
9418
9495
|
return;
|
|
9419
9496
|
if (!isPandaAttribute(node, context))
|
|
9420
9497
|
return;
|
|
9421
|
-
|
|
9422
|
-
if (!cmp)
|
|
9423
|
-
return;
|
|
9424
|
-
sendReport(node.key, node.key.name);
|
|
9498
|
+
sendReport(node.key);
|
|
9425
9499
|
}
|
|
9426
9500
|
};
|
|
9427
9501
|
}
|
|
9428
9502
|
});
|
|
9429
|
-
var prefer_atomic_properties_default =
|
|
9503
|
+
var prefer_atomic_properties_default = rule16;
|
|
9430
9504
|
|
|
9431
9505
|
// src/rules/prefer-composite-properties.ts
|
|
9432
9506
|
init_cjs_shims();
|
|
9433
|
-
var
|
|
9434
|
-
var
|
|
9435
|
-
name:
|
|
9507
|
+
var RULE_NAME17 = "prefer-composite-properties";
|
|
9508
|
+
var rule17 = createRule({
|
|
9509
|
+
name: RULE_NAME17,
|
|
9436
9510
|
meta: {
|
|
9437
9511
|
docs: {
|
|
9438
9512
|
description: "Encourage the use of composite properties instead of atomic properties in the codebase."
|
|
@@ -9451,14 +9525,16 @@ var rule16 = createRule({
|
|
|
9451
9525
|
return;
|
|
9452
9526
|
return Object.keys(compositeProperties).find((cpd) => compositeProperties[cpd].includes(longhand));
|
|
9453
9527
|
};
|
|
9454
|
-
const sendReport = (node
|
|
9455
|
-
const cmp = resolveCompositeProperty(
|
|
9528
|
+
const sendReport = (node) => {
|
|
9529
|
+
const cmp = resolveCompositeProperty(node.name);
|
|
9530
|
+
if (!cmp)
|
|
9531
|
+
return;
|
|
9456
9532
|
return context.report({
|
|
9457
9533
|
node,
|
|
9458
9534
|
messageId: "composite",
|
|
9459
9535
|
data: {
|
|
9460
9536
|
composite: cmp,
|
|
9461
|
-
atomic:
|
|
9537
|
+
atomic: node.name
|
|
9462
9538
|
}
|
|
9463
9539
|
});
|
|
9464
9540
|
};
|
|
@@ -9468,31 +9544,25 @@ var rule16 = createRule({
|
|
|
9468
9544
|
return;
|
|
9469
9545
|
if (!isPandaProp(node, context))
|
|
9470
9546
|
return;
|
|
9471
|
-
|
|
9472
|
-
if (!atm)
|
|
9473
|
-
return;
|
|
9474
|
-
sendReport(node, node.name.name);
|
|
9547
|
+
sendReport(node.name);
|
|
9475
9548
|
},
|
|
9476
9549
|
Property(node) {
|
|
9477
9550
|
if (!isIdentifier(node.key))
|
|
9478
9551
|
return;
|
|
9479
9552
|
if (!isPandaAttribute(node, context))
|
|
9480
9553
|
return;
|
|
9481
|
-
|
|
9482
|
-
if (!atm)
|
|
9483
|
-
return;
|
|
9484
|
-
sendReport(node.key, node.key.name);
|
|
9554
|
+
sendReport(node.key);
|
|
9485
9555
|
}
|
|
9486
9556
|
};
|
|
9487
9557
|
}
|
|
9488
9558
|
});
|
|
9489
|
-
var prefer_composite_properties_default =
|
|
9559
|
+
var prefer_composite_properties_default = rule17;
|
|
9490
9560
|
|
|
9491
9561
|
// src/rules/prefer-unified-property-style.ts
|
|
9492
9562
|
init_cjs_shims();
|
|
9493
|
-
var
|
|
9494
|
-
var
|
|
9495
|
-
name:
|
|
9563
|
+
var RULE_NAME18 = "prefer-unified-property-style";
|
|
9564
|
+
var rule18 = createRule({
|
|
9565
|
+
name: RULE_NAME18,
|
|
9496
9566
|
meta: {
|
|
9497
9567
|
docs: {
|
|
9498
9568
|
description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
|
|
@@ -9559,7 +9629,7 @@ var rule17 = createRule({
|
|
|
9559
9629
|
};
|
|
9560
9630
|
}
|
|
9561
9631
|
});
|
|
9562
|
-
var prefer_unified_property_style_default =
|
|
9632
|
+
var prefer_unified_property_style_default = rule18;
|
|
9563
9633
|
|
|
9564
9634
|
// src/rules/index.ts
|
|
9565
9635
|
var rules = {
|
|
@@ -9572,14 +9642,15 @@ var rules = {
|
|
|
9572
9642
|
[RULE_NAME7]: no_important_default,
|
|
9573
9643
|
[RULE_NAME9]: no_invalid_token_paths_default,
|
|
9574
9644
|
[RULE_NAME8]: no_invalid_nesting_default,
|
|
9575
|
-
[
|
|
9576
|
-
[
|
|
9577
|
-
[RULE_NAME12]:
|
|
9578
|
-
[RULE_NAME13]:
|
|
9579
|
-
[RULE_NAME14]:
|
|
9580
|
-
[RULE_NAME15]:
|
|
9581
|
-
[RULE_NAME16]:
|
|
9582
|
-
[RULE_NAME17]:
|
|
9645
|
+
[RULE_NAME10]: no_margin_properties_default,
|
|
9646
|
+
[RULE_NAME11]: no_physical_properties_default,
|
|
9647
|
+
[RULE_NAME12]: no_property_renaming_default,
|
|
9648
|
+
[RULE_NAME13]: no_unsafe_token_fn_usage_default,
|
|
9649
|
+
[RULE_NAME14]: prefer_longhand_properties_default,
|
|
9650
|
+
[RULE_NAME15]: prefer_shorthand_properties_default,
|
|
9651
|
+
[RULE_NAME16]: prefer_atomic_properties_default,
|
|
9652
|
+
[RULE_NAME17]: prefer_composite_properties_default,
|
|
9653
|
+
[RULE_NAME18]: prefer_unified_property_style_default
|
|
9583
9654
|
};
|
|
9584
9655
|
|
|
9585
9656
|
// 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.0-dev-
|
|
13
|
+
version = "0.0.0-dev-20240211163817";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -8898,6 +8898,104 @@ var init_no_invalid_token_paths = __esm({
|
|
|
8898
8898
|
}
|
|
8899
8899
|
});
|
|
8900
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
|
+
TaggedTemplateExpression(node) {
|
|
8950
|
+
const handleExpression = (caller) => {
|
|
8951
|
+
if (!isPandaIsh(caller, context))
|
|
8952
|
+
return;
|
|
8953
|
+
const quasis = node.quasi.quasis[0];
|
|
8954
|
+
const styles = quasis.value.raw;
|
|
8955
|
+
const propertyRegex = /([a-zA-Z-]+):/g;
|
|
8956
|
+
const propertyMatches = [...styles.matchAll(propertyRegex)];
|
|
8957
|
+
const properties = propertyMatches.map((match) => match[1].trim());
|
|
8958
|
+
properties.forEach((property, i, arr) => {
|
|
8959
|
+
if (!property.includes("margin"))
|
|
8960
|
+
return;
|
|
8961
|
+
if (arr.indexOf(property) < i)
|
|
8962
|
+
return;
|
|
8963
|
+
let index = styles.indexOf(property);
|
|
8964
|
+
while (index !== -1) {
|
|
8965
|
+
const start = quasis.range[0] + 1 + index;
|
|
8966
|
+
const end = start + property.length;
|
|
8967
|
+
context.report({
|
|
8968
|
+
loc: {
|
|
8969
|
+
start: context.sourceCode.getLocFromIndex(start),
|
|
8970
|
+
end: context.sourceCode.getLocFromIndex(end)
|
|
8971
|
+
},
|
|
8972
|
+
messageId: "noMargin"
|
|
8973
|
+
});
|
|
8974
|
+
index = styles.indexOf(property, index + 1);
|
|
8975
|
+
}
|
|
8976
|
+
});
|
|
8977
|
+
};
|
|
8978
|
+
if (isIdentifier(node.tag)) {
|
|
8979
|
+
handleExpression(node.tag.name);
|
|
8980
|
+
}
|
|
8981
|
+
if (isMemberExpression(node.tag)) {
|
|
8982
|
+
if (!isIdentifier(node.tag.object))
|
|
8983
|
+
return;
|
|
8984
|
+
handleExpression(node.tag.object.name);
|
|
8985
|
+
}
|
|
8986
|
+
if (isCallExpression(node.tag)) {
|
|
8987
|
+
if (!isIdentifier(node.tag.callee))
|
|
8988
|
+
return;
|
|
8989
|
+
handleExpression(node.tag.callee.name);
|
|
8990
|
+
}
|
|
8991
|
+
}
|
|
8992
|
+
};
|
|
8993
|
+
}
|
|
8994
|
+
});
|
|
8995
|
+
no_margin_properties_default = rule10;
|
|
8996
|
+
}
|
|
8997
|
+
});
|
|
8998
|
+
|
|
8901
8999
|
// src/utils/physical-properties.ts
|
|
8902
9000
|
var physicalProperties;
|
|
8903
9001
|
var init_physical_properties = __esm({
|
|
@@ -8942,7 +9040,7 @@ var init_physical_properties = __esm({
|
|
|
8942
9040
|
});
|
|
8943
9041
|
|
|
8944
9042
|
// src/rules/no-physical-properties.ts
|
|
8945
|
-
var
|
|
9043
|
+
var RULE_NAME11, rule11, no_physical_properties_default;
|
|
8946
9044
|
var init_no_physical_properties = __esm({
|
|
8947
9045
|
"src/rules/no-physical-properties.ts"() {
|
|
8948
9046
|
"use strict";
|
|
@@ -8951,9 +9049,9 @@ var init_no_physical_properties = __esm({
|
|
|
8951
9049
|
init_utils();
|
|
8952
9050
|
init_nodes();
|
|
8953
9051
|
init_physical_properties();
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
name:
|
|
9052
|
+
RULE_NAME11 = "no-physical-properties";
|
|
9053
|
+
rule11 = createRule({
|
|
9054
|
+
name: RULE_NAME11,
|
|
8957
9055
|
meta: {
|
|
8958
9056
|
docs: {
|
|
8959
9057
|
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."
|
|
@@ -8969,21 +9067,23 @@ var init_no_physical_properties = __esm({
|
|
|
8969
9067
|
defaultOptions: [],
|
|
8970
9068
|
create(context) {
|
|
8971
9069
|
const getLonghand = (name2) => resolveLonghand(name2, context) ?? name2;
|
|
8972
|
-
const sendReport = (node
|
|
8973
|
-
|
|
8974
|
-
|
|
9070
|
+
const sendReport = (node) => {
|
|
9071
|
+
if (!(getLonghand(node.name) in physicalProperties))
|
|
9072
|
+
return;
|
|
9073
|
+
const logical = physicalProperties[getLonghand(node.name)];
|
|
9074
|
+
const longhand = resolveLonghand(node.name, context);
|
|
8975
9075
|
return context.report({
|
|
8976
9076
|
node,
|
|
8977
9077
|
messageId: "physical",
|
|
8978
9078
|
data: {
|
|
8979
|
-
physical: `\`${
|
|
9079
|
+
physical: `\`${node.name}\`${longhand ? ` - \`${longhand}\`` : ""}`,
|
|
8980
9080
|
logical
|
|
8981
9081
|
},
|
|
8982
9082
|
suggest: [
|
|
8983
9083
|
{
|
|
8984
9084
|
messageId: "replace",
|
|
8985
9085
|
data: {
|
|
8986
|
-
physical:
|
|
9086
|
+
physical: node.name,
|
|
8987
9087
|
logical
|
|
8988
9088
|
},
|
|
8989
9089
|
fix: (fixer) => {
|
|
@@ -8999,28 +9099,24 @@ var init_no_physical_properties = __esm({
|
|
|
8999
9099
|
return;
|
|
9000
9100
|
if (!isPandaProp(node, context))
|
|
9001
9101
|
return;
|
|
9002
|
-
|
|
9003
|
-
sendReport(node.name, node.name.name);
|
|
9004
|
-
}
|
|
9102
|
+
sendReport(node.name);
|
|
9005
9103
|
},
|
|
9006
9104
|
Property(node) {
|
|
9007
9105
|
if (!isIdentifier(node.key))
|
|
9008
9106
|
return;
|
|
9009
9107
|
if (!isPandaAttribute(node, context))
|
|
9010
9108
|
return;
|
|
9011
|
-
|
|
9012
|
-
sendReport(node.key, node.key.name);
|
|
9013
|
-
}
|
|
9109
|
+
sendReport(node.key);
|
|
9014
9110
|
}
|
|
9015
9111
|
};
|
|
9016
9112
|
}
|
|
9017
9113
|
});
|
|
9018
|
-
no_physical_properties_default =
|
|
9114
|
+
no_physical_properties_default = rule11;
|
|
9019
9115
|
}
|
|
9020
9116
|
});
|
|
9021
9117
|
|
|
9022
9118
|
// src/rules/no-property-renaming.ts
|
|
9023
|
-
var
|
|
9119
|
+
var RULE_NAME12, rule12, no_property_renaming_default;
|
|
9024
9120
|
var init_no_property_renaming = __esm({
|
|
9025
9121
|
"src/rules/no-property-renaming.ts"() {
|
|
9026
9122
|
"use strict";
|
|
@@ -9028,9 +9124,9 @@ var init_no_property_renaming = __esm({
|
|
|
9028
9124
|
init_utils();
|
|
9029
9125
|
init_helpers();
|
|
9030
9126
|
init_nodes();
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
name:
|
|
9127
|
+
RULE_NAME12 = "no-property-renaming";
|
|
9128
|
+
rule12 = createRule({
|
|
9129
|
+
name: RULE_NAME12,
|
|
9034
9130
|
meta: {
|
|
9035
9131
|
docs: {
|
|
9036
9132
|
description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
|
|
@@ -9053,6 +9149,14 @@ var init_no_property_renaming = __esm({
|
|
|
9053
9149
|
}
|
|
9054
9150
|
});
|
|
9055
9151
|
};
|
|
9152
|
+
const handleReport = (node, value, attr) => {
|
|
9153
|
+
if (isIdentifier(value) && attr !== value.name) {
|
|
9154
|
+
return sendReport(node, attr, value.name);
|
|
9155
|
+
}
|
|
9156
|
+
if (isMemberExpression(value) && isIdentifier(value.property) && attr !== value.property.name) {
|
|
9157
|
+
return sendReport(node, attr, value.property.name);
|
|
9158
|
+
}
|
|
9159
|
+
};
|
|
9056
9160
|
return {
|
|
9057
9161
|
JSXAttribute(node) {
|
|
9058
9162
|
if (!node.value)
|
|
@@ -9063,12 +9167,7 @@ var init_no_property_renaming = __esm({
|
|
|
9063
9167
|
return;
|
|
9064
9168
|
const attr = node.name.name.toString();
|
|
9065
9169
|
const expression = node.value.expression;
|
|
9066
|
-
|
|
9067
|
-
return sendReport(node, attr, expression.name);
|
|
9068
|
-
}
|
|
9069
|
-
if (isMemberExpression(expression) && isIdentifier(expression.property) && attr !== expression.property.name) {
|
|
9070
|
-
return sendReport(node, attr, expression.property.name);
|
|
9071
|
-
}
|
|
9170
|
+
handleReport(node, expression, attr);
|
|
9072
9171
|
},
|
|
9073
9172
|
Property(node) {
|
|
9074
9173
|
if (!isIdentifier(node.key))
|
|
@@ -9079,24 +9178,19 @@ var init_no_property_renaming = __esm({
|
|
|
9079
9178
|
return;
|
|
9080
9179
|
const attr = node.key.name.toString();
|
|
9081
9180
|
const value = node.value;
|
|
9082
|
-
|
|
9083
|
-
return sendReport(node, attr, value.name);
|
|
9084
|
-
}
|
|
9085
|
-
if (isMemberExpression(value) && isIdentifier(value.property) && attr !== value.property.name) {
|
|
9086
|
-
return sendReport(node, attr, value.property.name);
|
|
9087
|
-
}
|
|
9181
|
+
handleReport(node, value, attr);
|
|
9088
9182
|
}
|
|
9089
9183
|
};
|
|
9090
9184
|
}
|
|
9091
9185
|
});
|
|
9092
|
-
no_property_renaming_default =
|
|
9186
|
+
no_property_renaming_default = rule12;
|
|
9093
9187
|
}
|
|
9094
9188
|
});
|
|
9095
9189
|
|
|
9096
9190
|
// src/rules/no-unsafe-token-fn-usage.ts
|
|
9097
9191
|
import "@typescript-eslint/utils";
|
|
9098
9192
|
import { getArbitraryValue as getArbitraryValue3 } from "@pandacss/shared";
|
|
9099
|
-
var
|
|
9193
|
+
var RULE_NAME13, rule13, no_unsafe_token_fn_usage_default;
|
|
9100
9194
|
var init_no_unsafe_token_fn_usage = __esm({
|
|
9101
9195
|
"src/rules/no-unsafe-token-fn-usage.ts"() {
|
|
9102
9196
|
"use strict";
|
|
@@ -9104,9 +9198,9 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
9104
9198
|
init_helpers();
|
|
9105
9199
|
init_utils();
|
|
9106
9200
|
init_nodes();
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
name:
|
|
9201
|
+
RULE_NAME13 = "no-unsafe-token-fn-usage";
|
|
9202
|
+
rule13 = createRule({
|
|
9203
|
+
name: RULE_NAME13,
|
|
9110
9204
|
meta: {
|
|
9111
9205
|
docs: {
|
|
9112
9206
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
@@ -9202,12 +9296,12 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
9202
9296
|
};
|
|
9203
9297
|
}
|
|
9204
9298
|
});
|
|
9205
|
-
no_unsafe_token_fn_usage_default =
|
|
9299
|
+
no_unsafe_token_fn_usage_default = rule13;
|
|
9206
9300
|
}
|
|
9207
9301
|
});
|
|
9208
9302
|
|
|
9209
9303
|
// src/rules/prefer-longhand-properties.ts
|
|
9210
|
-
var
|
|
9304
|
+
var RULE_NAME14, rule14, prefer_longhand_properties_default;
|
|
9211
9305
|
var init_prefer_longhand_properties = __esm({
|
|
9212
9306
|
"src/rules/prefer-longhand-properties.ts"() {
|
|
9213
9307
|
"use strict";
|
|
@@ -9215,9 +9309,9 @@ var init_prefer_longhand_properties = __esm({
|
|
|
9215
9309
|
init_helpers();
|
|
9216
9310
|
init_utils();
|
|
9217
9311
|
init_nodes();
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
name:
|
|
9312
|
+
RULE_NAME14 = "prefer-longhand-properties";
|
|
9313
|
+
rule14 = createRule({
|
|
9314
|
+
name: RULE_NAME14,
|
|
9221
9315
|
meta: {
|
|
9222
9316
|
docs: {
|
|
9223
9317
|
description: "Discourage the use of shorthand properties and promote the preference for longhand properties in the codebase."
|
|
@@ -9232,10 +9326,12 @@ var init_prefer_longhand_properties = __esm({
|
|
|
9232
9326
|
},
|
|
9233
9327
|
defaultOptions: [],
|
|
9234
9328
|
create(context) {
|
|
9235
|
-
const sendReport = (node
|
|
9236
|
-
const longhand = resolveLonghand(
|
|
9329
|
+
const sendReport = (node) => {
|
|
9330
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9331
|
+
if (!longhand)
|
|
9332
|
+
return;
|
|
9237
9333
|
const data = {
|
|
9238
|
-
shorthand:
|
|
9334
|
+
shorthand: node.name,
|
|
9239
9335
|
longhand
|
|
9240
9336
|
};
|
|
9241
9337
|
return context.report({
|
|
@@ -9259,30 +9355,24 @@ var init_prefer_longhand_properties = __esm({
|
|
|
9259
9355
|
return;
|
|
9260
9356
|
if (!isPandaProp(node, context))
|
|
9261
9357
|
return;
|
|
9262
|
-
|
|
9263
|
-
if (!longhand)
|
|
9264
|
-
return;
|
|
9265
|
-
sendReport(node.name, node.name.name);
|
|
9358
|
+
sendReport(node.name);
|
|
9266
9359
|
},
|
|
9267
9360
|
Property(node) {
|
|
9268
9361
|
if (!isIdentifier(node.key))
|
|
9269
9362
|
return;
|
|
9270
9363
|
if (!isPandaAttribute(node, context))
|
|
9271
9364
|
return;
|
|
9272
|
-
|
|
9273
|
-
if (!longhand)
|
|
9274
|
-
return;
|
|
9275
|
-
sendReport(node.key, node.key.name);
|
|
9365
|
+
sendReport(node.key);
|
|
9276
9366
|
}
|
|
9277
9367
|
};
|
|
9278
9368
|
}
|
|
9279
9369
|
});
|
|
9280
|
-
prefer_longhand_properties_default =
|
|
9370
|
+
prefer_longhand_properties_default = rule14;
|
|
9281
9371
|
}
|
|
9282
9372
|
});
|
|
9283
9373
|
|
|
9284
9374
|
// src/rules/prefer-shorthand-properties.ts
|
|
9285
|
-
var
|
|
9375
|
+
var RULE_NAME15, rule15, prefer_shorthand_properties_default;
|
|
9286
9376
|
var init_prefer_shorthand_properties = __esm({
|
|
9287
9377
|
"src/rules/prefer-shorthand-properties.ts"() {
|
|
9288
9378
|
"use strict";
|
|
@@ -9290,9 +9380,9 @@ var init_prefer_shorthand_properties = __esm({
|
|
|
9290
9380
|
init_helpers();
|
|
9291
9381
|
init_utils();
|
|
9292
9382
|
init_nodes();
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
name:
|
|
9383
|
+
RULE_NAME15 = "prefer-shorthand-properties";
|
|
9384
|
+
rule15 = createRule({
|
|
9385
|
+
name: RULE_NAME15,
|
|
9296
9386
|
meta: {
|
|
9297
9387
|
docs: {
|
|
9298
9388
|
description: "Discourage the use of longhand properties and promote the preference for shorthand properties in the codebase."
|
|
@@ -9307,13 +9397,16 @@ var init_prefer_shorthand_properties = __esm({
|
|
|
9307
9397
|
},
|
|
9308
9398
|
defaultOptions: [],
|
|
9309
9399
|
create(context) {
|
|
9310
|
-
const sendReport = (node
|
|
9311
|
-
const
|
|
9400
|
+
const sendReport = (node) => {
|
|
9401
|
+
const longhand = resolveLonghand(node.name, context);
|
|
9402
|
+
if (longhand)
|
|
9403
|
+
return;
|
|
9404
|
+
const shorthands = resolveShorthands(node.name, context);
|
|
9312
9405
|
if (!shorthands)
|
|
9313
9406
|
return;
|
|
9314
9407
|
const shorthand = shorthands.map((s) => `\`${s}\``)?.join(", ");
|
|
9315
9408
|
const data = {
|
|
9316
|
-
longhand:
|
|
9409
|
+
longhand: node.name,
|
|
9317
9410
|
shorthand
|
|
9318
9411
|
};
|
|
9319
9412
|
return context.report({
|
|
@@ -9337,25 +9430,19 @@ var init_prefer_shorthand_properties = __esm({
|
|
|
9337
9430
|
return;
|
|
9338
9431
|
if (!isPandaProp(node, context))
|
|
9339
9432
|
return;
|
|
9340
|
-
|
|
9341
|
-
if (longhand)
|
|
9342
|
-
return;
|
|
9343
|
-
sendReport(node.name, node.name.name);
|
|
9433
|
+
sendReport(node.name);
|
|
9344
9434
|
},
|
|
9345
9435
|
Property(node) {
|
|
9346
9436
|
if (!isIdentifier(node.key))
|
|
9347
9437
|
return;
|
|
9348
9438
|
if (!isPandaAttribute(node, context))
|
|
9349
9439
|
return;
|
|
9350
|
-
|
|
9351
|
-
if (longhand)
|
|
9352
|
-
return;
|
|
9353
|
-
sendReport(node.key, node.key.name);
|
|
9440
|
+
sendReport(node.key);
|
|
9354
9441
|
}
|
|
9355
9442
|
};
|
|
9356
9443
|
}
|
|
9357
9444
|
});
|
|
9358
|
-
prefer_shorthand_properties_default =
|
|
9445
|
+
prefer_shorthand_properties_default = rule15;
|
|
9359
9446
|
}
|
|
9360
9447
|
});
|
|
9361
9448
|
|
|
@@ -9480,7 +9567,7 @@ var init_composite_properties = __esm({
|
|
|
9480
9567
|
});
|
|
9481
9568
|
|
|
9482
9569
|
// src/rules/prefer-atomic-properties.ts
|
|
9483
|
-
var
|
|
9570
|
+
var RULE_NAME16, rule16, prefer_atomic_properties_default;
|
|
9484
9571
|
var init_prefer_atomic_properties = __esm({
|
|
9485
9572
|
"src/rules/prefer-atomic-properties.ts"() {
|
|
9486
9573
|
"use strict";
|
|
@@ -9489,9 +9576,9 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9489
9576
|
init_utils();
|
|
9490
9577
|
init_composite_properties();
|
|
9491
9578
|
init_nodes();
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
name:
|
|
9579
|
+
RULE_NAME16 = "prefer-atomic-properties";
|
|
9580
|
+
rule16 = createRule({
|
|
9581
|
+
name: RULE_NAME16,
|
|
9495
9582
|
meta: {
|
|
9496
9583
|
docs: {
|
|
9497
9584
|
description: "Encourage the use of atomic properties instead of composite properties in the codebase."
|
|
@@ -9511,14 +9598,16 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9511
9598
|
if (isValidProperty(longhand, context) && Object.hasOwn(compositeProperties, longhand))
|
|
9512
9599
|
return longhand;
|
|
9513
9600
|
};
|
|
9514
|
-
const sendReport = (node
|
|
9515
|
-
const cmp = resolveCompositeProperty(
|
|
9516
|
-
|
|
9601
|
+
const sendReport = (node) => {
|
|
9602
|
+
const cmp = resolveCompositeProperty(node.name);
|
|
9603
|
+
if (!cmp)
|
|
9604
|
+
return;
|
|
9605
|
+
const atomics = compositeProperties[cmp].map((name2) => `\`${name2}\``).join(",\n");
|
|
9517
9606
|
return context.report({
|
|
9518
9607
|
node,
|
|
9519
9608
|
messageId: "atomic",
|
|
9520
9609
|
data: {
|
|
9521
|
-
composite:
|
|
9610
|
+
composite: node.name,
|
|
9522
9611
|
atomics
|
|
9523
9612
|
}
|
|
9524
9613
|
});
|
|
@@ -9529,30 +9618,24 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9529
9618
|
return;
|
|
9530
9619
|
if (!isPandaProp(node, context))
|
|
9531
9620
|
return;
|
|
9532
|
-
|
|
9533
|
-
if (!cmp)
|
|
9534
|
-
return;
|
|
9535
|
-
sendReport(node, node.name.name);
|
|
9621
|
+
sendReport(node.name);
|
|
9536
9622
|
},
|
|
9537
9623
|
Property(node) {
|
|
9538
9624
|
if (!isIdentifier(node.key))
|
|
9539
9625
|
return;
|
|
9540
9626
|
if (!isPandaAttribute(node, context))
|
|
9541
9627
|
return;
|
|
9542
|
-
|
|
9543
|
-
if (!cmp)
|
|
9544
|
-
return;
|
|
9545
|
-
sendReport(node.key, node.key.name);
|
|
9628
|
+
sendReport(node.key);
|
|
9546
9629
|
}
|
|
9547
9630
|
};
|
|
9548
9631
|
}
|
|
9549
9632
|
});
|
|
9550
|
-
prefer_atomic_properties_default =
|
|
9633
|
+
prefer_atomic_properties_default = rule16;
|
|
9551
9634
|
}
|
|
9552
9635
|
});
|
|
9553
9636
|
|
|
9554
9637
|
// src/rules/prefer-composite-properties.ts
|
|
9555
|
-
var
|
|
9638
|
+
var RULE_NAME17, rule17, prefer_composite_properties_default;
|
|
9556
9639
|
var init_prefer_composite_properties = __esm({
|
|
9557
9640
|
"src/rules/prefer-composite-properties.ts"() {
|
|
9558
9641
|
"use strict";
|
|
@@ -9561,9 +9644,9 @@ var init_prefer_composite_properties = __esm({
|
|
|
9561
9644
|
init_utils();
|
|
9562
9645
|
init_composite_properties();
|
|
9563
9646
|
init_nodes();
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
name:
|
|
9647
|
+
RULE_NAME17 = "prefer-composite-properties";
|
|
9648
|
+
rule17 = createRule({
|
|
9649
|
+
name: RULE_NAME17,
|
|
9567
9650
|
meta: {
|
|
9568
9651
|
docs: {
|
|
9569
9652
|
description: "Encourage the use of composite properties instead of atomic properties in the codebase."
|
|
@@ -9582,14 +9665,16 @@ var init_prefer_composite_properties = __esm({
|
|
|
9582
9665
|
return;
|
|
9583
9666
|
return Object.keys(compositeProperties).find((cpd) => compositeProperties[cpd].includes(longhand));
|
|
9584
9667
|
};
|
|
9585
|
-
const sendReport = (node
|
|
9586
|
-
const cmp = resolveCompositeProperty(
|
|
9668
|
+
const sendReport = (node) => {
|
|
9669
|
+
const cmp = resolveCompositeProperty(node.name);
|
|
9670
|
+
if (!cmp)
|
|
9671
|
+
return;
|
|
9587
9672
|
return context.report({
|
|
9588
9673
|
node,
|
|
9589
9674
|
messageId: "composite",
|
|
9590
9675
|
data: {
|
|
9591
9676
|
composite: cmp,
|
|
9592
|
-
atomic:
|
|
9677
|
+
atomic: node.name
|
|
9593
9678
|
}
|
|
9594
9679
|
});
|
|
9595
9680
|
};
|
|
@@ -9599,30 +9684,24 @@ var init_prefer_composite_properties = __esm({
|
|
|
9599
9684
|
return;
|
|
9600
9685
|
if (!isPandaProp(node, context))
|
|
9601
9686
|
return;
|
|
9602
|
-
|
|
9603
|
-
if (!atm)
|
|
9604
|
-
return;
|
|
9605
|
-
sendReport(node, node.name.name);
|
|
9687
|
+
sendReport(node.name);
|
|
9606
9688
|
},
|
|
9607
9689
|
Property(node) {
|
|
9608
9690
|
if (!isIdentifier(node.key))
|
|
9609
9691
|
return;
|
|
9610
9692
|
if (!isPandaAttribute(node, context))
|
|
9611
9693
|
return;
|
|
9612
|
-
|
|
9613
|
-
if (!atm)
|
|
9614
|
-
return;
|
|
9615
|
-
sendReport(node.key, node.key.name);
|
|
9694
|
+
sendReport(node.key);
|
|
9616
9695
|
}
|
|
9617
9696
|
};
|
|
9618
9697
|
}
|
|
9619
9698
|
});
|
|
9620
|
-
prefer_composite_properties_default =
|
|
9699
|
+
prefer_composite_properties_default = rule17;
|
|
9621
9700
|
}
|
|
9622
9701
|
});
|
|
9623
9702
|
|
|
9624
9703
|
// src/rules/prefer-unified-property-style.ts
|
|
9625
|
-
var
|
|
9704
|
+
var RULE_NAME18, rule18, prefer_unified_property_style_default;
|
|
9626
9705
|
var init_prefer_unified_property_style = __esm({
|
|
9627
9706
|
"src/rules/prefer-unified-property-style.ts"() {
|
|
9628
9707
|
"use strict";
|
|
@@ -9631,9 +9710,9 @@ var init_prefer_unified_property_style = __esm({
|
|
|
9631
9710
|
init_utils();
|
|
9632
9711
|
init_composite_properties();
|
|
9633
9712
|
init_nodes();
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
name:
|
|
9713
|
+
RULE_NAME18 = "prefer-unified-property-style";
|
|
9714
|
+
rule18 = createRule({
|
|
9715
|
+
name: RULE_NAME18,
|
|
9637
9716
|
meta: {
|
|
9638
9717
|
docs: {
|
|
9639
9718
|
description: "Discourage against mixing atomic and composite forms of the same property in a style declaration. Atomic styles give more consistent results"
|
|
@@ -9700,7 +9779,7 @@ var init_prefer_unified_property_style = __esm({
|
|
|
9700
9779
|
};
|
|
9701
9780
|
}
|
|
9702
9781
|
});
|
|
9703
|
-
prefer_unified_property_style_default =
|
|
9782
|
+
prefer_unified_property_style_default = rule18;
|
|
9704
9783
|
}
|
|
9705
9784
|
});
|
|
9706
9785
|
|
|
@@ -9719,6 +9798,7 @@ var init_rules = __esm({
|
|
|
9719
9798
|
init_no_important();
|
|
9720
9799
|
init_no_invalid_nesting();
|
|
9721
9800
|
init_no_invalid_token_paths();
|
|
9801
|
+
init_no_margin_properties();
|
|
9722
9802
|
init_no_physical_properties();
|
|
9723
9803
|
init_no_property_renaming();
|
|
9724
9804
|
init_no_unsafe_token_fn_usage();
|
|
@@ -9737,14 +9817,15 @@ var init_rules = __esm({
|
|
|
9737
9817
|
[RULE_NAME7]: no_important_default,
|
|
9738
9818
|
[RULE_NAME9]: no_invalid_token_paths_default,
|
|
9739
9819
|
[RULE_NAME8]: no_invalid_nesting_default,
|
|
9740
|
-
[
|
|
9741
|
-
[
|
|
9742
|
-
[RULE_NAME12]:
|
|
9743
|
-
[RULE_NAME13]:
|
|
9744
|
-
[RULE_NAME14]:
|
|
9745
|
-
[RULE_NAME15]:
|
|
9746
|
-
[RULE_NAME16]:
|
|
9747
|
-
[RULE_NAME17]:
|
|
9820
|
+
[RULE_NAME10]: no_margin_properties_default,
|
|
9821
|
+
[RULE_NAME11]: no_physical_properties_default,
|
|
9822
|
+
[RULE_NAME12]: no_property_renaming_default,
|
|
9823
|
+
[RULE_NAME13]: no_unsafe_token_fn_usage_default,
|
|
9824
|
+
[RULE_NAME14]: prefer_longhand_properties_default,
|
|
9825
|
+
[RULE_NAME15]: prefer_shorthand_properties_default,
|
|
9826
|
+
[RULE_NAME16]: prefer_atomic_properties_default,
|
|
9827
|
+
[RULE_NAME17]: prefer_composite_properties_default,
|
|
9828
|
+
[RULE_NAME18]: prefer_unified_property_style_default
|
|
9748
9829
|
};
|
|
9749
9830
|
}
|
|
9750
9831
|
});
|
package/package.json
CHANGED