@pandacss/eslint-plugin 0.0.4 → 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/{chunk-2OH4QDKP.mjs → chunk-6BVJTDXV.mjs} +2 -2
- package/dist/index.js +107 -53
- package/dist/index.mjs +106 -52
- package/dist/utils/worker.mjs +1 -1
- package/package.json +1 -1
|
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
|
|
30
|
-
// ../node_modules/.pnpm/tsup@8.0.
|
|
30
|
+
// ../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
|
|
31
31
|
var init_esm_shims = __esm({
|
|
32
|
-
"../node_modules/.pnpm/tsup@8.0.
|
|
32
|
+
"../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
33
33
|
"use strict";
|
|
34
34
|
}
|
|
35
35
|
});
|
package/dist/index.js
CHANGED
|
@@ -28,10 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
mod
|
|
29
29
|
));
|
|
30
30
|
|
|
31
|
-
// ../node_modules/.pnpm/tsup@8.0.
|
|
31
|
+
// ../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
|
|
32
32
|
var getImportMetaUrl, importMetaUrl;
|
|
33
33
|
var init_cjs_shims = __esm({
|
|
34
|
-
"../node_modules/.pnpm/tsup@8.0.
|
|
34
|
+
"../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.33_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
|
|
35
35
|
"use strict";
|
|
36
36
|
getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
37
37
|
importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
@@ -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();
|
|
@@ -8107,6 +8107,9 @@ var isPandaImport = (node, context) => {
|
|
|
8107
8107
|
return imports.some((imp) => imp.mod === node.source.value);
|
|
8108
8108
|
};
|
|
8109
8109
|
var isPandaProp = (node, context) => {
|
|
8110
|
+
const prop = node.name.name;
|
|
8111
|
+
if (typeof prop !== "string" || !isValidProperty(prop, context))
|
|
8112
|
+
return;
|
|
8110
8113
|
const jsxAncestor = getAncestor(isJSXOpeningElement, node);
|
|
8111
8114
|
if (!jsxAncestor)
|
|
8112
8115
|
return;
|
|
@@ -8125,12 +8128,17 @@ var isPandaAttribute = (node, context) => {
|
|
|
8125
8128
|
const jsxAttrAncestor = getAncestor(isJSXAttribute, node);
|
|
8126
8129
|
if (!jsxExprAncestor || !jsxAttrAncestor)
|
|
8127
8130
|
return;
|
|
8128
|
-
if (!isPandaProp(jsxAttrAncestor
|
|
8131
|
+
if (!isPandaProp(jsxAttrAncestor, context))
|
|
8129
8132
|
return;
|
|
8130
8133
|
if (!isValidStyledProp(jsxAttrAncestor.name, context))
|
|
8131
8134
|
return;
|
|
8132
8135
|
return true;
|
|
8133
8136
|
}
|
|
8137
|
+
if (!isIdentifier(node.key))
|
|
8138
|
+
return;
|
|
8139
|
+
const attr = node.key.name;
|
|
8140
|
+
if (!isValidProperty(attr, context))
|
|
8141
|
+
return;
|
|
8134
8142
|
if (isIdentifier(callAncestor.callee)) {
|
|
8135
8143
|
return isPandaIsh(callAncestor.callee.name, context);
|
|
8136
8144
|
}
|
|
@@ -8222,38 +8230,47 @@ var rule2 = createRule({
|
|
|
8222
8230
|
description: "Prohibit the use of config functions outside the Panda config."
|
|
8223
8231
|
},
|
|
8224
8232
|
messages: {
|
|
8225
|
-
configFunction: "
|
|
8233
|
+
configFunction: "Unnecessary`{{name}}` call. \nConfig functions should only be used in panda config.",
|
|
8234
|
+
delete: "Delete `{{name}}` call."
|
|
8226
8235
|
},
|
|
8227
8236
|
type: "suggestion",
|
|
8228
|
-
|
|
8237
|
+
hasSuggestions: true,
|
|
8229
8238
|
schema: []
|
|
8230
8239
|
},
|
|
8231
8240
|
defaultOptions: [],
|
|
8232
8241
|
create(context) {
|
|
8233
8242
|
return {
|
|
8234
8243
|
CallExpression(node) {
|
|
8244
|
+
if (!isValidFile(context))
|
|
8245
|
+
return;
|
|
8235
8246
|
if (!isIdentifier(node.callee))
|
|
8236
8247
|
return;
|
|
8237
8248
|
if (!CONFIG_FUNCTIONS.includes(node.callee.name))
|
|
8238
8249
|
return;
|
|
8239
|
-
if (!isValidFile(context))
|
|
8240
|
-
return;
|
|
8241
8250
|
context.report({
|
|
8242
8251
|
node,
|
|
8243
8252
|
messageId: "configFunction",
|
|
8244
8253
|
data: {
|
|
8245
8254
|
name: node.callee.name
|
|
8246
8255
|
},
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
fixer
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
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
|
+
]
|
|
8257
8274
|
});
|
|
8258
8275
|
}
|
|
8259
8276
|
};
|
|
@@ -8287,24 +8304,31 @@ var rule3 = createRule({
|
|
|
8287
8304
|
description: "Disallow the inclusion of the debug attribute when shipping code to the production environment."
|
|
8288
8305
|
},
|
|
8289
8306
|
messages: {
|
|
8290
|
-
debug: "
|
|
8307
|
+
debug: "Unnecessary debug utility.",
|
|
8308
|
+
prop: "Remove the debug prop.",
|
|
8309
|
+
property: "Remove the debug property."
|
|
8291
8310
|
},
|
|
8292
8311
|
type: "suggestion",
|
|
8293
|
-
|
|
8312
|
+
hasSuggestions: true,
|
|
8294
8313
|
schema: []
|
|
8295
8314
|
},
|
|
8296
8315
|
defaultOptions: [],
|
|
8297
8316
|
create(context) {
|
|
8298
8317
|
return {
|
|
8299
|
-
|
|
8300
|
-
if (node.name !== "debug")
|
|
8318
|
+
JSXAttribute(node) {
|
|
8319
|
+
if (!isJSXIdentifier(node.name) || node.name.name !== "debug")
|
|
8301
8320
|
return;
|
|
8302
8321
|
if (!isPandaProp(node, context))
|
|
8303
8322
|
return;
|
|
8304
8323
|
context.report({
|
|
8305
8324
|
node,
|
|
8306
8325
|
messageId: "debug",
|
|
8307
|
-
|
|
8326
|
+
suggest: [
|
|
8327
|
+
{
|
|
8328
|
+
messageId: "prop",
|
|
8329
|
+
fix: (fixer) => fixer.remove(node)
|
|
8330
|
+
}
|
|
8331
|
+
]
|
|
8308
8332
|
});
|
|
8309
8333
|
},
|
|
8310
8334
|
Property(node) {
|
|
@@ -8315,7 +8339,12 @@ var rule3 = createRule({
|
|
|
8315
8339
|
context.report({
|
|
8316
8340
|
node: node.key,
|
|
8317
8341
|
messageId: "debug",
|
|
8318
|
-
|
|
8342
|
+
suggest: [
|
|
8343
|
+
{
|
|
8344
|
+
messageId: "property",
|
|
8345
|
+
fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1])
|
|
8346
|
+
}
|
|
8347
|
+
]
|
|
8319
8348
|
});
|
|
8320
8349
|
}
|
|
8321
8350
|
};
|
|
@@ -8330,7 +8359,7 @@ var rule4 = createRule({
|
|
|
8330
8359
|
name: RULE_NAME4,
|
|
8331
8360
|
meta: {
|
|
8332
8361
|
docs: {
|
|
8333
|
-
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."
|
|
8334
8363
|
},
|
|
8335
8364
|
messages: {
|
|
8336
8365
|
dynamic: "Remove dynamic value. Prefer static styles"
|
|
@@ -8350,7 +8379,7 @@ var rule4 = createRule({
|
|
|
8350
8379
|
return;
|
|
8351
8380
|
if (isJSXExpressionContainer(node.value) && isTemplateLiteral(node.value.expression) && node.value.expression.expressions.length === 0)
|
|
8352
8381
|
return;
|
|
8353
|
-
if (!isPandaProp(node
|
|
8382
|
+
if (!isPandaProp(node, context))
|
|
8354
8383
|
return;
|
|
8355
8384
|
context.report({
|
|
8356
8385
|
node: node.value,
|
|
@@ -8387,10 +8416,11 @@ var rule5 = createRule({
|
|
|
8387
8416
|
description: "Prohibit the use of escape hatch syntax in the code."
|
|
8388
8417
|
},
|
|
8389
8418
|
messages: {
|
|
8390
|
-
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 (`[]`)."
|
|
8391
8421
|
},
|
|
8392
8422
|
type: "suggestion",
|
|
8393
|
-
|
|
8423
|
+
hasSuggestions: true,
|
|
8394
8424
|
schema: []
|
|
8395
8425
|
},
|
|
8396
8426
|
defaultOptions: [],
|
|
@@ -8422,9 +8452,14 @@ var rule5 = createRule({
|
|
|
8422
8452
|
return context.report({
|
|
8423
8453
|
node,
|
|
8424
8454
|
messageId: "escapeHatch",
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8455
|
+
suggest: [
|
|
8456
|
+
{
|
|
8457
|
+
messageId: "remove",
|
|
8458
|
+
fix: (fixer) => {
|
|
8459
|
+
return fixer.replaceTextRange(removeQuotes(node.range), (0, import_shared.getArbitraryValue)(value));
|
|
8460
|
+
}
|
|
8461
|
+
}
|
|
8462
|
+
]
|
|
8428
8463
|
});
|
|
8429
8464
|
};
|
|
8430
8465
|
return {
|
|
@@ -8645,7 +8680,7 @@ var rule8 = createRule({
|
|
|
8645
8680
|
name: RULE_NAME8,
|
|
8646
8681
|
meta: {
|
|
8647
8682
|
docs: {
|
|
8648
|
-
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."
|
|
8649
8684
|
},
|
|
8650
8685
|
messages: {
|
|
8651
8686
|
noRenaming: "Incoming `{{prop}}` prop is different from the expected `{{expected}}` attribute. Panada will not track this prop."
|
|
@@ -8671,7 +8706,7 @@ var rule8 = createRule({
|
|
|
8671
8706
|
return;
|
|
8672
8707
|
if (!isJSXExpressionContainer(node.value))
|
|
8673
8708
|
return;
|
|
8674
|
-
if (!isPandaProp(node
|
|
8709
|
+
if (!isPandaProp(node, context))
|
|
8675
8710
|
return;
|
|
8676
8711
|
const attr = node.name.name.toString();
|
|
8677
8712
|
const expression = node.value.expression;
|
|
@@ -8713,36 +8748,46 @@ var rule9 = createRule({
|
|
|
8713
8748
|
description: "Discourage the use of shorthand properties and promote the preference for longhand CSS properties in the codebase."
|
|
8714
8749
|
},
|
|
8715
8750
|
messages: {
|
|
8716
|
-
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}}`"
|
|
8717
8753
|
},
|
|
8718
8754
|
type: "suggestion",
|
|
8719
|
-
|
|
8755
|
+
hasSuggestions: true,
|
|
8720
8756
|
schema: []
|
|
8721
8757
|
},
|
|
8722
8758
|
defaultOptions: [],
|
|
8723
8759
|
create(context) {
|
|
8724
8760
|
const sendReport = (node, name2) => {
|
|
8725
8761
|
const longhand = resolveLonghand(name2, context);
|
|
8762
|
+
const data = {
|
|
8763
|
+
shorthand: name2,
|
|
8764
|
+
longhand
|
|
8765
|
+
};
|
|
8726
8766
|
return context.report({
|
|
8727
8767
|
node,
|
|
8728
8768
|
messageId: "longhand",
|
|
8729
|
-
data
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8769
|
+
data,
|
|
8770
|
+
suggest: [
|
|
8771
|
+
{
|
|
8772
|
+
messageId: "replace",
|
|
8773
|
+
data,
|
|
8774
|
+
fix: (fixer) => {
|
|
8775
|
+
return fixer.replaceTextRange(node.range, longhand);
|
|
8776
|
+
}
|
|
8777
|
+
}
|
|
8778
|
+
]
|
|
8736
8779
|
});
|
|
8737
8780
|
};
|
|
8738
8781
|
return {
|
|
8739
|
-
|
|
8782
|
+
JSXAttribute(node) {
|
|
8783
|
+
if (!isJSXIdentifier(node.name))
|
|
8784
|
+
return;
|
|
8740
8785
|
if (!isPandaProp(node, context))
|
|
8741
8786
|
return;
|
|
8742
|
-
const longhand = resolveLonghand(node.name, context);
|
|
8787
|
+
const longhand = resolveLonghand(node.name.name, context);
|
|
8743
8788
|
if (!longhand)
|
|
8744
8789
|
return;
|
|
8745
|
-
sendReport(node, node.name);
|
|
8790
|
+
sendReport(node.name, node.name.name);
|
|
8746
8791
|
},
|
|
8747
8792
|
Property(node) {
|
|
8748
8793
|
if (!isIdentifier(node.key))
|
|
@@ -8770,10 +8815,11 @@ var rule10 = createRule({
|
|
|
8770
8815
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
8771
8816
|
},
|
|
8772
8817
|
messages: {
|
|
8773
|
-
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token"
|
|
8818
|
+
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
|
|
8819
|
+
replace: "Replace token function with `{{safe}}`"
|
|
8774
8820
|
},
|
|
8775
8821
|
type: "suggestion",
|
|
8776
|
-
|
|
8822
|
+
hasSuggestions: true,
|
|
8777
8823
|
schema: []
|
|
8778
8824
|
},
|
|
8779
8825
|
defaultOptions: [],
|
|
@@ -8823,9 +8869,15 @@ var rule10 = createRule({
|
|
|
8823
8869
|
return context.report({
|
|
8824
8870
|
node,
|
|
8825
8871
|
messageId: "noUnsafeTokenFnUsage",
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8872
|
+
suggest: [
|
|
8873
|
+
{
|
|
8874
|
+
messageId: "replace",
|
|
8875
|
+
data: { safe: token },
|
|
8876
|
+
fix: (fixer) => {
|
|
8877
|
+
return fixer.replaceTextRange(node.range, `'${token}'`);
|
|
8878
|
+
}
|
|
8879
|
+
}
|
|
8880
|
+
]
|
|
8829
8881
|
});
|
|
8830
8882
|
};
|
|
8831
8883
|
return {
|
|
@@ -9008,13 +9060,15 @@ var rule11 = createRule({
|
|
|
9008
9060
|
});
|
|
9009
9061
|
};
|
|
9010
9062
|
return {
|
|
9011
|
-
|
|
9063
|
+
JSXAttribute(node) {
|
|
9064
|
+
if (!isJSXIdentifier(node.name))
|
|
9065
|
+
return;
|
|
9012
9066
|
if (!isPandaProp(node, context))
|
|
9013
9067
|
return;
|
|
9014
|
-
const cpd = resolveCompositeProperty(node.name);
|
|
9068
|
+
const cpd = resolveCompositeProperty(node.name.name);
|
|
9015
9069
|
if (!cpd)
|
|
9016
9070
|
return;
|
|
9017
|
-
sendReport(node, node.name);
|
|
9071
|
+
sendReport(node, node.name.name);
|
|
9018
9072
|
},
|
|
9019
9073
|
Property(node) {
|
|
9020
9074
|
if (!isIdentifier(node.key))
|
package/dist/index.mjs
CHANGED
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
__esm,
|
|
4
4
|
__toESM,
|
|
5
5
|
init_esm_shims
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6BVJTDXV.mjs";
|
|
7
7
|
|
|
8
8
|
// package.json
|
|
9
9
|
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
|
|
|
@@ -8083,6 +8083,9 @@ var init_helpers = __esm({
|
|
|
8083
8083
|
return imports.some((imp) => imp.mod === node.source.value);
|
|
8084
8084
|
};
|
|
8085
8085
|
isPandaProp = (node, context) => {
|
|
8086
|
+
const prop = node.name.name;
|
|
8087
|
+
if (typeof prop !== "string" || !isValidProperty(prop, context))
|
|
8088
|
+
return;
|
|
8086
8089
|
const jsxAncestor = getAncestor(isJSXOpeningElement, node);
|
|
8087
8090
|
if (!jsxAncestor)
|
|
8088
8091
|
return;
|
|
@@ -8101,12 +8104,17 @@ var init_helpers = __esm({
|
|
|
8101
8104
|
const jsxAttrAncestor = getAncestor(isJSXAttribute, node);
|
|
8102
8105
|
if (!jsxExprAncestor || !jsxAttrAncestor)
|
|
8103
8106
|
return;
|
|
8104
|
-
if (!isPandaProp(jsxAttrAncestor
|
|
8107
|
+
if (!isPandaProp(jsxAttrAncestor, context))
|
|
8105
8108
|
return;
|
|
8106
8109
|
if (!isValidStyledProp(jsxAttrAncestor.name, context))
|
|
8107
8110
|
return;
|
|
8108
8111
|
return true;
|
|
8109
8112
|
}
|
|
8113
|
+
if (!isIdentifier(node.key))
|
|
8114
|
+
return;
|
|
8115
|
+
const attr = node.key.name;
|
|
8116
|
+
if (!isValidProperty(attr, context))
|
|
8117
|
+
return;
|
|
8110
8118
|
if (isIdentifier(callAncestor.callee)) {
|
|
8111
8119
|
return isPandaIsh(callAncestor.callee.name, context);
|
|
8112
8120
|
}
|
|
@@ -8216,38 +8224,47 @@ var init_no_config_function_in_source = __esm({
|
|
|
8216
8224
|
description: "Prohibit the use of config functions outside the Panda config."
|
|
8217
8225
|
},
|
|
8218
8226
|
messages: {
|
|
8219
|
-
configFunction: "
|
|
8227
|
+
configFunction: "Unnecessary`{{name}}` call. \nConfig functions should only be used in panda config.",
|
|
8228
|
+
delete: "Delete `{{name}}` call."
|
|
8220
8229
|
},
|
|
8221
8230
|
type: "suggestion",
|
|
8222
|
-
|
|
8231
|
+
hasSuggestions: true,
|
|
8223
8232
|
schema: []
|
|
8224
8233
|
},
|
|
8225
8234
|
defaultOptions: [],
|
|
8226
8235
|
create(context) {
|
|
8227
8236
|
return {
|
|
8228
8237
|
CallExpression(node) {
|
|
8238
|
+
if (!isValidFile(context))
|
|
8239
|
+
return;
|
|
8229
8240
|
if (!isIdentifier(node.callee))
|
|
8230
8241
|
return;
|
|
8231
8242
|
if (!CONFIG_FUNCTIONS.includes(node.callee.name))
|
|
8232
8243
|
return;
|
|
8233
|
-
if (!isValidFile(context))
|
|
8234
|
-
return;
|
|
8235
8244
|
context.report({
|
|
8236
8245
|
node,
|
|
8237
8246
|
messageId: "configFunction",
|
|
8238
8247
|
data: {
|
|
8239
8248
|
name: node.callee.name
|
|
8240
8249
|
},
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
fixer
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
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
|
+
]
|
|
8251
8268
|
});
|
|
8252
8269
|
}
|
|
8253
8270
|
};
|
|
@@ -8290,24 +8307,31 @@ var init_no_debug = __esm({
|
|
|
8290
8307
|
description: "Disallow the inclusion of the debug attribute when shipping code to the production environment."
|
|
8291
8308
|
},
|
|
8292
8309
|
messages: {
|
|
8293
|
-
debug: "
|
|
8310
|
+
debug: "Unnecessary debug utility.",
|
|
8311
|
+
prop: "Remove the debug prop.",
|
|
8312
|
+
property: "Remove the debug property."
|
|
8294
8313
|
},
|
|
8295
8314
|
type: "suggestion",
|
|
8296
|
-
|
|
8315
|
+
hasSuggestions: true,
|
|
8297
8316
|
schema: []
|
|
8298
8317
|
},
|
|
8299
8318
|
defaultOptions: [],
|
|
8300
8319
|
create(context) {
|
|
8301
8320
|
return {
|
|
8302
|
-
|
|
8303
|
-
if (node.name !== "debug")
|
|
8321
|
+
JSXAttribute(node) {
|
|
8322
|
+
if (!isJSXIdentifier(node.name) || node.name.name !== "debug")
|
|
8304
8323
|
return;
|
|
8305
8324
|
if (!isPandaProp(node, context))
|
|
8306
8325
|
return;
|
|
8307
8326
|
context.report({
|
|
8308
8327
|
node,
|
|
8309
8328
|
messageId: "debug",
|
|
8310
|
-
|
|
8329
|
+
suggest: [
|
|
8330
|
+
{
|
|
8331
|
+
messageId: "prop",
|
|
8332
|
+
fix: (fixer) => fixer.remove(node)
|
|
8333
|
+
}
|
|
8334
|
+
]
|
|
8311
8335
|
});
|
|
8312
8336
|
},
|
|
8313
8337
|
Property(node) {
|
|
@@ -8318,7 +8342,12 @@ var init_no_debug = __esm({
|
|
|
8318
8342
|
context.report({
|
|
8319
8343
|
node: node.key,
|
|
8320
8344
|
messageId: "debug",
|
|
8321
|
-
|
|
8345
|
+
suggest: [
|
|
8346
|
+
{
|
|
8347
|
+
messageId: "property",
|
|
8348
|
+
fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1])
|
|
8349
|
+
}
|
|
8350
|
+
]
|
|
8322
8351
|
});
|
|
8323
8352
|
}
|
|
8324
8353
|
};
|
|
@@ -8342,7 +8371,7 @@ var init_no_dynamic_styling = __esm({
|
|
|
8342
8371
|
name: RULE_NAME4,
|
|
8343
8372
|
meta: {
|
|
8344
8373
|
docs: {
|
|
8345
|
-
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."
|
|
8346
8375
|
},
|
|
8347
8376
|
messages: {
|
|
8348
8377
|
dynamic: "Remove dynamic value. Prefer static styles"
|
|
@@ -8362,7 +8391,7 @@ var init_no_dynamic_styling = __esm({
|
|
|
8362
8391
|
return;
|
|
8363
8392
|
if (isJSXExpressionContainer(node.value) && isTemplateLiteral(node.value.expression) && node.value.expression.expressions.length === 0)
|
|
8364
8393
|
return;
|
|
8365
|
-
if (!isPandaProp(node
|
|
8394
|
+
if (!isPandaProp(node, context))
|
|
8366
8395
|
return;
|
|
8367
8396
|
context.report({
|
|
8368
8397
|
node: node.value,
|
|
@@ -8408,10 +8437,11 @@ var init_no_escape_hatch = __esm({
|
|
|
8408
8437
|
description: "Prohibit the use of escape hatch syntax in the code."
|
|
8409
8438
|
},
|
|
8410
8439
|
messages: {
|
|
8411
|
-
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 (`[]`)."
|
|
8412
8442
|
},
|
|
8413
8443
|
type: "suggestion",
|
|
8414
|
-
|
|
8444
|
+
hasSuggestions: true,
|
|
8415
8445
|
schema: []
|
|
8416
8446
|
},
|
|
8417
8447
|
defaultOptions: [],
|
|
@@ -8443,9 +8473,14 @@ var init_no_escape_hatch = __esm({
|
|
|
8443
8473
|
return context.report({
|
|
8444
8474
|
node,
|
|
8445
8475
|
messageId: "escapeHatch",
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8476
|
+
suggest: [
|
|
8477
|
+
{
|
|
8478
|
+
messageId: "remove",
|
|
8479
|
+
fix: (fixer) => {
|
|
8480
|
+
return fixer.replaceTextRange(removeQuotes(node.range), getArbitraryValue(value));
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8483
|
+
]
|
|
8449
8484
|
});
|
|
8450
8485
|
};
|
|
8451
8486
|
return {
|
|
@@ -8693,7 +8728,7 @@ var init_no_property_renaming = __esm({
|
|
|
8693
8728
|
name: RULE_NAME8,
|
|
8694
8729
|
meta: {
|
|
8695
8730
|
docs: {
|
|
8696
|
-
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."
|
|
8697
8732
|
},
|
|
8698
8733
|
messages: {
|
|
8699
8734
|
noRenaming: "Incoming `{{prop}}` prop is different from the expected `{{expected}}` attribute. Panada will not track this prop."
|
|
@@ -8719,7 +8754,7 @@ var init_no_property_renaming = __esm({
|
|
|
8719
8754
|
return;
|
|
8720
8755
|
if (!isJSXExpressionContainer(node.value))
|
|
8721
8756
|
return;
|
|
8722
|
-
if (!isPandaProp(node
|
|
8757
|
+
if (!isPandaProp(node, context))
|
|
8723
8758
|
return;
|
|
8724
8759
|
const attr = node.name.name.toString();
|
|
8725
8760
|
const expression = node.value.expression;
|
|
@@ -8770,36 +8805,46 @@ var init_no_shorthand_prop = __esm({
|
|
|
8770
8805
|
description: "Discourage the use of shorthand properties and promote the preference for longhand CSS properties in the codebase."
|
|
8771
8806
|
},
|
|
8772
8807
|
messages: {
|
|
8773
|
-
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}}`"
|
|
8774
8810
|
},
|
|
8775
8811
|
type: "suggestion",
|
|
8776
|
-
|
|
8812
|
+
hasSuggestions: true,
|
|
8777
8813
|
schema: []
|
|
8778
8814
|
},
|
|
8779
8815
|
defaultOptions: [],
|
|
8780
8816
|
create(context) {
|
|
8781
8817
|
const sendReport = (node, name2) => {
|
|
8782
8818
|
const longhand = resolveLonghand(name2, context);
|
|
8819
|
+
const data = {
|
|
8820
|
+
shorthand: name2,
|
|
8821
|
+
longhand
|
|
8822
|
+
};
|
|
8783
8823
|
return context.report({
|
|
8784
8824
|
node,
|
|
8785
8825
|
messageId: "longhand",
|
|
8786
|
-
data
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8826
|
+
data,
|
|
8827
|
+
suggest: [
|
|
8828
|
+
{
|
|
8829
|
+
messageId: "replace",
|
|
8830
|
+
data,
|
|
8831
|
+
fix: (fixer) => {
|
|
8832
|
+
return fixer.replaceTextRange(node.range, longhand);
|
|
8833
|
+
}
|
|
8834
|
+
}
|
|
8835
|
+
]
|
|
8793
8836
|
});
|
|
8794
8837
|
};
|
|
8795
8838
|
return {
|
|
8796
|
-
|
|
8839
|
+
JSXAttribute(node) {
|
|
8840
|
+
if (!isJSXIdentifier(node.name))
|
|
8841
|
+
return;
|
|
8797
8842
|
if (!isPandaProp(node, context))
|
|
8798
8843
|
return;
|
|
8799
|
-
const longhand = resolveLonghand(node.name, context);
|
|
8844
|
+
const longhand = resolveLonghand(node.name.name, context);
|
|
8800
8845
|
if (!longhand)
|
|
8801
8846
|
return;
|
|
8802
|
-
sendReport(node, node.name);
|
|
8847
|
+
sendReport(node.name, node.name.name);
|
|
8803
8848
|
},
|
|
8804
8849
|
Property(node) {
|
|
8805
8850
|
if (!isIdentifier(node.key))
|
|
@@ -8836,10 +8881,11 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8836
8881
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
8837
8882
|
},
|
|
8838
8883
|
messages: {
|
|
8839
|
-
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token"
|
|
8884
|
+
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token",
|
|
8885
|
+
replace: "Replace token function with `{{safe}}`"
|
|
8840
8886
|
},
|
|
8841
8887
|
type: "suggestion",
|
|
8842
|
-
|
|
8888
|
+
hasSuggestions: true,
|
|
8843
8889
|
schema: []
|
|
8844
8890
|
},
|
|
8845
8891
|
defaultOptions: [],
|
|
@@ -8889,9 +8935,15 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8889
8935
|
return context.report({
|
|
8890
8936
|
node,
|
|
8891
8937
|
messageId: "noUnsafeTokenFnUsage",
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8938
|
+
suggest: [
|
|
8939
|
+
{
|
|
8940
|
+
messageId: "replace",
|
|
8941
|
+
data: { safe: token },
|
|
8942
|
+
fix: (fixer) => {
|
|
8943
|
+
return fixer.replaceTextRange(node.range, `'${token}'`);
|
|
8944
|
+
}
|
|
8945
|
+
}
|
|
8946
|
+
]
|
|
8895
8947
|
});
|
|
8896
8948
|
};
|
|
8897
8949
|
return {
|
|
@@ -9088,13 +9140,15 @@ var init_prefer_atomic_properties = __esm({
|
|
|
9088
9140
|
});
|
|
9089
9141
|
};
|
|
9090
9142
|
return {
|
|
9091
|
-
|
|
9143
|
+
JSXAttribute(node) {
|
|
9144
|
+
if (!isJSXIdentifier(node.name))
|
|
9145
|
+
return;
|
|
9092
9146
|
if (!isPandaProp(node, context))
|
|
9093
9147
|
return;
|
|
9094
|
-
const cpd = resolveCompositeProperty(node.name);
|
|
9148
|
+
const cpd = resolveCompositeProperty(node.name.name);
|
|
9095
9149
|
if (!cpd)
|
|
9096
9150
|
return;
|
|
9097
|
-
sendReport(node, node.name);
|
|
9151
|
+
sendReport(node, node.name.name);
|
|
9098
9152
|
},
|
|
9099
9153
|
Property(node) {
|
|
9100
9154
|
if (!isIdentifier(node.key))
|
package/dist/utils/worker.mjs
CHANGED