@pandacss/eslint-plugin 0.0.5 → 0.0.6
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 +81 -39
- package/dist/index.mjs +81 -39
- 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.6";
|
|
7961
7961
|
|
|
7962
7962
|
// src/configs/all.ts
|
|
7963
7963
|
init_cjs_shims();
|
|
@@ -8230,10 +8230,11 @@ var rule2 = createRule({
|
|
|
8230
8230
|
description: "Prohibit the use of config functions outside the Panda config."
|
|
8231
8231
|
},
|
|
8232
8232
|
messages: {
|
|
8233
|
-
configFunction: "
|
|
8233
|
+
configFunction: "Unnecessary`{{name}}` call. \nConfig functions should only be used in panda config.",
|
|
8234
|
+
delete: "Delete `{{name}}` call."
|
|
8234
8235
|
},
|
|
8235
8236
|
type: "suggestion",
|
|
8236
|
-
|
|
8237
|
+
hasSuggestions: true,
|
|
8237
8238
|
schema: []
|
|
8238
8239
|
},
|
|
8239
8240
|
defaultOptions: [],
|
|
@@ -8252,16 +8253,24 @@ var rule2 = createRule({
|
|
|
8252
8253
|
data: {
|
|
8253
8254
|
name: node.callee.name
|
|
8254
8255
|
},
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
fixer
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8256
|
+
suggest: [
|
|
8257
|
+
{
|
|
8258
|
+
messageId: "delete",
|
|
8259
|
+
data: {
|
|
8260
|
+
name: node.callee.name
|
|
8261
|
+
},
|
|
8262
|
+
fix(fixer) {
|
|
8263
|
+
const declaration = getAncestor(isVariableDeclaration, node);
|
|
8264
|
+
const importSpec = getImportSpecifiers(context).find(
|
|
8265
|
+
(s) => isIdentifier(node.callee) && s.specifier.local.name === node.callee.name
|
|
8266
|
+
);
|
|
8267
|
+
return [
|
|
8268
|
+
fixer.remove(declaration ?? node),
|
|
8269
|
+
importSpec?.specifier ? fixer.remove(importSpec?.specifier) : {}
|
|
8270
|
+
];
|
|
8271
|
+
}
|
|
8272
|
+
}
|
|
8273
|
+
]
|
|
8265
8274
|
});
|
|
8266
8275
|
}
|
|
8267
8276
|
};
|
|
@@ -8295,10 +8304,12 @@ var rule3 = createRule({
|
|
|
8295
8304
|
description: "Disallow the inclusion of the debug attribute when shipping code to the production environment."
|
|
8296
8305
|
},
|
|
8297
8306
|
messages: {
|
|
8298
|
-
debug: "
|
|
8307
|
+
debug: "Unnecessary debug utility.",
|
|
8308
|
+
prop: "Remove the debug prop.",
|
|
8309
|
+
property: "Remove the debug property."
|
|
8299
8310
|
},
|
|
8300
8311
|
type: "suggestion",
|
|
8301
|
-
|
|
8312
|
+
hasSuggestions: true,
|
|
8302
8313
|
schema: []
|
|
8303
8314
|
},
|
|
8304
8315
|
defaultOptions: [],
|
|
@@ -8312,7 +8323,12 @@ var rule3 = createRule({
|
|
|
8312
8323
|
context.report({
|
|
8313
8324
|
node,
|
|
8314
8325
|
messageId: "debug",
|
|
8315
|
-
|
|
8326
|
+
suggest: [
|
|
8327
|
+
{
|
|
8328
|
+
messageId: "prop",
|
|
8329
|
+
fix: (fixer) => fixer.remove(node)
|
|
8330
|
+
}
|
|
8331
|
+
]
|
|
8316
8332
|
});
|
|
8317
8333
|
},
|
|
8318
8334
|
Property(node) {
|
|
@@ -8323,7 +8339,12 @@ var rule3 = createRule({
|
|
|
8323
8339
|
context.report({
|
|
8324
8340
|
node: node.key,
|
|
8325
8341
|
messageId: "debug",
|
|
8326
|
-
|
|
8342
|
+
suggest: [
|
|
8343
|
+
{
|
|
8344
|
+
messageId: "property",
|
|
8345
|
+
fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1])
|
|
8346
|
+
}
|
|
8347
|
+
]
|
|
8327
8348
|
});
|
|
8328
8349
|
}
|
|
8329
8350
|
};
|
|
@@ -8338,7 +8359,7 @@ var rule4 = createRule({
|
|
|
8338
8359
|
name: RULE_NAME4,
|
|
8339
8360
|
meta: {
|
|
8340
8361
|
docs: {
|
|
8341
|
-
description: "Ensure user doesn't use dynamic styling at any point.
|
|
8362
|
+
description: "Ensure user doesn't use dynamic styling at any point. \nPrefer to use static styles, leverage css variables or recipes for known dynamic styles."
|
|
8342
8363
|
},
|
|
8343
8364
|
messages: {
|
|
8344
8365
|
dynamic: "Remove dynamic value. Prefer static styles"
|
|
@@ -8395,10 +8416,11 @@ var rule5 = createRule({
|
|
|
8395
8416
|
description: "Prohibit the use of escape hatch syntax in the code."
|
|
8396
8417
|
},
|
|
8397
8418
|
messages: {
|
|
8398
|
-
escapeHatch: "Avoid using the escape hatch [value] for undefined tokens.
|
|
8419
|
+
escapeHatch: "Avoid using the escape hatch [value] for undefined tokens. \nDefine a corresponding token in your design system for better consistency and maintainability.",
|
|
8420
|
+
remove: "Remove the square brackets (`[]`)."
|
|
8399
8421
|
},
|
|
8400
8422
|
type: "suggestion",
|
|
8401
|
-
|
|
8423
|
+
hasSuggestions: true,
|
|
8402
8424
|
schema: []
|
|
8403
8425
|
},
|
|
8404
8426
|
defaultOptions: [],
|
|
@@ -8430,9 +8452,14 @@ var rule5 = createRule({
|
|
|
8430
8452
|
return context.report({
|
|
8431
8453
|
node,
|
|
8432
8454
|
messageId: "escapeHatch",
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8455
|
+
suggest: [
|
|
8456
|
+
{
|
|
8457
|
+
messageId: "remove",
|
|
8458
|
+
fix: (fixer) => {
|
|
8459
|
+
return fixer.replaceTextRange(removeQuotes(node.range), (0, import_shared.getArbitraryValue)(value));
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
]
|
|
8436
8463
|
});
|
|
8437
8464
|
};
|
|
8438
8465
|
return {
|
|
@@ -8653,7 +8680,7 @@ var rule8 = createRule({
|
|
|
8653
8680
|
name: RULE_NAME8,
|
|
8654
8681
|
meta: {
|
|
8655
8682
|
docs: {
|
|
8656
|
-
description: "Ensure user does not rename a property for a pattern or style prop.
|
|
8683
|
+
description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
|
|
8657
8684
|
},
|
|
8658
8685
|
messages: {
|
|
8659
8686
|
noRenaming: "Incoming `{{prop}}` prop is different from the expected `{{expected}}` attribute. Panada will not track this prop."
|
|
@@ -8679,7 +8706,7 @@ var rule8 = createRule({
|
|
|
8679
8706
|
return;
|
|
8680
8707
|
if (!isJSXExpressionContainer(node.value))
|
|
8681
8708
|
return;
|
|
8682
|
-
if (!isPandaProp(node
|
|
8709
|
+
if (!isPandaProp(node, context))
|
|
8683
8710
|
return;
|
|
8684
8711
|
const attr = node.name.name.toString();
|
|
8685
8712
|
const expression = node.value.expression;
|
|
@@ -8721,26 +8748,34 @@ var rule9 = createRule({
|
|
|
8721
8748
|
description: "Discourage the use of shorthand properties and promote the preference for longhand CSS properties in the codebase."
|
|
8722
8749
|
},
|
|
8723
8750
|
messages: {
|
|
8724
|
-
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`"
|
|
8751
|
+
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
|
|
8752
|
+
replace: "Replace `{{shorthand}}` with `{{longhand}}`"
|
|
8725
8753
|
},
|
|
8726
8754
|
type: "suggestion",
|
|
8727
|
-
|
|
8755
|
+
hasSuggestions: true,
|
|
8728
8756
|
schema: []
|
|
8729
8757
|
},
|
|
8730
8758
|
defaultOptions: [],
|
|
8731
8759
|
create(context) {
|
|
8732
8760
|
const sendReport = (node, name2) => {
|
|
8733
8761
|
const longhand = resolveLonghand(name2, context);
|
|
8762
|
+
const data = {
|
|
8763
|
+
shorthand: name2,
|
|
8764
|
+
longhand
|
|
8765
|
+
};
|
|
8734
8766
|
return context.report({
|
|
8735
8767
|
node,
|
|
8736
8768
|
messageId: "longhand",
|
|
8737
|
-
data
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8769
|
+
data,
|
|
8770
|
+
suggest: [
|
|
8771
|
+
{
|
|
8772
|
+
messageId: "replace",
|
|
8773
|
+
data,
|
|
8774
|
+
fix: (fixer) => {
|
|
8775
|
+
return fixer.replaceTextRange(node.range, longhand);
|
|
8776
|
+
}
|
|
8777
|
+
}
|
|
8778
|
+
]
|
|
8744
8779
|
});
|
|
8745
8780
|
};
|
|
8746
8781
|
return {
|
|
@@ -8780,10 +8815,11 @@ var rule10 = createRule({
|
|
|
8780
8815
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
8781
8816
|
},
|
|
8782
8817
|
messages: {
|
|
8783
|
-
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token"
|
|
8818
|
+
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
|
|
8819
|
+
replace: "Replace token function with `{{safe}}`"
|
|
8784
8820
|
},
|
|
8785
8821
|
type: "suggestion",
|
|
8786
|
-
|
|
8822
|
+
hasSuggestions: true,
|
|
8787
8823
|
schema: []
|
|
8788
8824
|
},
|
|
8789
8825
|
defaultOptions: [],
|
|
@@ -8833,9 +8869,15 @@ var rule10 = createRule({
|
|
|
8833
8869
|
return context.report({
|
|
8834
8870
|
node,
|
|
8835
8871
|
messageId: "noUnsafeTokenFnUsage",
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8872
|
+
suggest: [
|
|
8873
|
+
{
|
|
8874
|
+
messageId: "replace",
|
|
8875
|
+
data: { safe: token },
|
|
8876
|
+
fix: (fixer) => {
|
|
8877
|
+
return fixer.replaceTextRange(node.range, `'${token}'`);
|
|
8878
|
+
}
|
|
8879
|
+
}
|
|
8880
|
+
]
|
|
8839
8881
|
});
|
|
8840
8882
|
};
|
|
8841
8883
|
return {
|
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.6";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -8224,10 +8224,11 @@ var init_no_config_function_in_source = __esm({
|
|
|
8224
8224
|
description: "Prohibit the use of config functions outside the Panda config."
|
|
8225
8225
|
},
|
|
8226
8226
|
messages: {
|
|
8227
|
-
configFunction: "
|
|
8227
|
+
configFunction: "Unnecessary`{{name}}` call. \nConfig functions should only be used in panda config.",
|
|
8228
|
+
delete: "Delete `{{name}}` call."
|
|
8228
8229
|
},
|
|
8229
8230
|
type: "suggestion",
|
|
8230
|
-
|
|
8231
|
+
hasSuggestions: true,
|
|
8231
8232
|
schema: []
|
|
8232
8233
|
},
|
|
8233
8234
|
defaultOptions: [],
|
|
@@ -8246,16 +8247,24 @@ var init_no_config_function_in_source = __esm({
|
|
|
8246
8247
|
data: {
|
|
8247
8248
|
name: node.callee.name
|
|
8248
8249
|
},
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
fixer
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8250
|
+
suggest: [
|
|
8251
|
+
{
|
|
8252
|
+
messageId: "delete",
|
|
8253
|
+
data: {
|
|
8254
|
+
name: node.callee.name
|
|
8255
|
+
},
|
|
8256
|
+
fix(fixer) {
|
|
8257
|
+
const declaration = getAncestor(isVariableDeclaration, node);
|
|
8258
|
+
const importSpec = getImportSpecifiers(context).find(
|
|
8259
|
+
(s) => isIdentifier(node.callee) && s.specifier.local.name === node.callee.name
|
|
8260
|
+
);
|
|
8261
|
+
return [
|
|
8262
|
+
fixer.remove(declaration ?? node),
|
|
8263
|
+
importSpec?.specifier ? fixer.remove(importSpec?.specifier) : {}
|
|
8264
|
+
];
|
|
8265
|
+
}
|
|
8266
|
+
}
|
|
8267
|
+
]
|
|
8259
8268
|
});
|
|
8260
8269
|
}
|
|
8261
8270
|
};
|
|
@@ -8298,10 +8307,12 @@ var init_no_debug = __esm({
|
|
|
8298
8307
|
description: "Disallow the inclusion of the debug attribute when shipping code to the production environment."
|
|
8299
8308
|
},
|
|
8300
8309
|
messages: {
|
|
8301
|
-
debug: "
|
|
8310
|
+
debug: "Unnecessary debug utility.",
|
|
8311
|
+
prop: "Remove the debug prop.",
|
|
8312
|
+
property: "Remove the debug property."
|
|
8302
8313
|
},
|
|
8303
8314
|
type: "suggestion",
|
|
8304
|
-
|
|
8315
|
+
hasSuggestions: true,
|
|
8305
8316
|
schema: []
|
|
8306
8317
|
},
|
|
8307
8318
|
defaultOptions: [],
|
|
@@ -8315,7 +8326,12 @@ var init_no_debug = __esm({
|
|
|
8315
8326
|
context.report({
|
|
8316
8327
|
node,
|
|
8317
8328
|
messageId: "debug",
|
|
8318
|
-
|
|
8329
|
+
suggest: [
|
|
8330
|
+
{
|
|
8331
|
+
messageId: "prop",
|
|
8332
|
+
fix: (fixer) => fixer.remove(node)
|
|
8333
|
+
}
|
|
8334
|
+
]
|
|
8319
8335
|
});
|
|
8320
8336
|
},
|
|
8321
8337
|
Property(node) {
|
|
@@ -8326,7 +8342,12 @@ var init_no_debug = __esm({
|
|
|
8326
8342
|
context.report({
|
|
8327
8343
|
node: node.key,
|
|
8328
8344
|
messageId: "debug",
|
|
8329
|
-
|
|
8345
|
+
suggest: [
|
|
8346
|
+
{
|
|
8347
|
+
messageId: "property",
|
|
8348
|
+
fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1])
|
|
8349
|
+
}
|
|
8350
|
+
]
|
|
8330
8351
|
});
|
|
8331
8352
|
}
|
|
8332
8353
|
};
|
|
@@ -8350,7 +8371,7 @@ var init_no_dynamic_styling = __esm({
|
|
|
8350
8371
|
name: RULE_NAME4,
|
|
8351
8372
|
meta: {
|
|
8352
8373
|
docs: {
|
|
8353
|
-
description: "Ensure user doesn't use dynamic styling at any point.
|
|
8374
|
+
description: "Ensure user doesn't use dynamic styling at any point. \nPrefer to use static styles, leverage css variables or recipes for known dynamic styles."
|
|
8354
8375
|
},
|
|
8355
8376
|
messages: {
|
|
8356
8377
|
dynamic: "Remove dynamic value. Prefer static styles"
|
|
@@ -8416,10 +8437,11 @@ var init_no_escape_hatch = __esm({
|
|
|
8416
8437
|
description: "Prohibit the use of escape hatch syntax in the code."
|
|
8417
8438
|
},
|
|
8418
8439
|
messages: {
|
|
8419
|
-
escapeHatch: "Avoid using the escape hatch [value] for undefined tokens.
|
|
8440
|
+
escapeHatch: "Avoid using the escape hatch [value] for undefined tokens. \nDefine a corresponding token in your design system for better consistency and maintainability.",
|
|
8441
|
+
remove: "Remove the square brackets (`[]`)."
|
|
8420
8442
|
},
|
|
8421
8443
|
type: "suggestion",
|
|
8422
|
-
|
|
8444
|
+
hasSuggestions: true,
|
|
8423
8445
|
schema: []
|
|
8424
8446
|
},
|
|
8425
8447
|
defaultOptions: [],
|
|
@@ -8451,9 +8473,14 @@ var init_no_escape_hatch = __esm({
|
|
|
8451
8473
|
return context.report({
|
|
8452
8474
|
node,
|
|
8453
8475
|
messageId: "escapeHatch",
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8476
|
+
suggest: [
|
|
8477
|
+
{
|
|
8478
|
+
messageId: "remove",
|
|
8479
|
+
fix: (fixer) => {
|
|
8480
|
+
return fixer.replaceTextRange(removeQuotes(node.range), getArbitraryValue(value));
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8483
|
+
]
|
|
8457
8484
|
});
|
|
8458
8485
|
};
|
|
8459
8486
|
return {
|
|
@@ -8701,7 +8728,7 @@ var init_no_property_renaming = __esm({
|
|
|
8701
8728
|
name: RULE_NAME8,
|
|
8702
8729
|
meta: {
|
|
8703
8730
|
docs: {
|
|
8704
|
-
description: "Ensure user does not rename a property for a pattern or style prop.
|
|
8731
|
+
description: "Ensure user does not rename a property for a pattern or style prop. \nIt doesn't get tracked."
|
|
8705
8732
|
},
|
|
8706
8733
|
messages: {
|
|
8707
8734
|
noRenaming: "Incoming `{{prop}}` prop is different from the expected `{{expected}}` attribute. Panada will not track this prop."
|
|
@@ -8727,7 +8754,7 @@ var init_no_property_renaming = __esm({
|
|
|
8727
8754
|
return;
|
|
8728
8755
|
if (!isJSXExpressionContainer(node.value))
|
|
8729
8756
|
return;
|
|
8730
|
-
if (!isPandaProp(node
|
|
8757
|
+
if (!isPandaProp(node, context))
|
|
8731
8758
|
return;
|
|
8732
8759
|
const attr = node.name.name.toString();
|
|
8733
8760
|
const expression = node.value.expression;
|
|
@@ -8778,26 +8805,34 @@ var init_no_shorthand_prop = __esm({
|
|
|
8778
8805
|
description: "Discourage the use of shorthand properties and promote the preference for longhand CSS properties in the codebase."
|
|
8779
8806
|
},
|
|
8780
8807
|
messages: {
|
|
8781
|
-
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`"
|
|
8808
|
+
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`",
|
|
8809
|
+
replace: "Replace `{{shorthand}}` with `{{longhand}}`"
|
|
8782
8810
|
},
|
|
8783
8811
|
type: "suggestion",
|
|
8784
|
-
|
|
8812
|
+
hasSuggestions: true,
|
|
8785
8813
|
schema: []
|
|
8786
8814
|
},
|
|
8787
8815
|
defaultOptions: [],
|
|
8788
8816
|
create(context) {
|
|
8789
8817
|
const sendReport = (node, name2) => {
|
|
8790
8818
|
const longhand = resolveLonghand(name2, context);
|
|
8819
|
+
const data = {
|
|
8820
|
+
shorthand: name2,
|
|
8821
|
+
longhand
|
|
8822
|
+
};
|
|
8791
8823
|
return context.report({
|
|
8792
8824
|
node,
|
|
8793
8825
|
messageId: "longhand",
|
|
8794
|
-
data
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8826
|
+
data,
|
|
8827
|
+
suggest: [
|
|
8828
|
+
{
|
|
8829
|
+
messageId: "replace",
|
|
8830
|
+
data,
|
|
8831
|
+
fix: (fixer) => {
|
|
8832
|
+
return fixer.replaceTextRange(node.range, longhand);
|
|
8833
|
+
}
|
|
8834
|
+
}
|
|
8835
|
+
]
|
|
8801
8836
|
});
|
|
8802
8837
|
};
|
|
8803
8838
|
return {
|
|
@@ -8846,10 +8881,11 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8846
8881
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
8847
8882
|
},
|
|
8848
8883
|
messages: {
|
|
8849
|
-
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token"
|
|
8884
|
+
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
|
|
8885
|
+
replace: "Replace token function with `{{safe}}`"
|
|
8850
8886
|
},
|
|
8851
8887
|
type: "suggestion",
|
|
8852
|
-
|
|
8888
|
+
hasSuggestions: true,
|
|
8853
8889
|
schema: []
|
|
8854
8890
|
},
|
|
8855
8891
|
defaultOptions: [],
|
|
@@ -8899,9 +8935,15 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8899
8935
|
return context.report({
|
|
8900
8936
|
node,
|
|
8901
8937
|
messageId: "noUnsafeTokenFnUsage",
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8938
|
+
suggest: [
|
|
8939
|
+
{
|
|
8940
|
+
messageId: "replace",
|
|
8941
|
+
data: { safe: token },
|
|
8942
|
+
fix: (fixer) => {
|
|
8943
|
+
return fixer.replaceTextRange(node.range, `'${token}'`);
|
|
8944
|
+
}
|
|
8945
|
+
}
|
|
8946
|
+
]
|
|
8905
8947
|
});
|
|
8906
8948
|
};
|
|
8907
8949
|
return {
|