@pandacss/eslint-plugin 0.0.0-dev-20240130040821 → 0.0.5
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 +63 -115
- package/dist/index.mjs +64 -116
- package/dist/utils/worker.js +2 -44
- package/dist/utils/worker.mjs +3 -45
- 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.5";
|
|
7961
7961
|
|
|
7962
7962
|
// src/configs/all.ts
|
|
7963
7963
|
init_cjs_shims();
|
|
@@ -8099,14 +8099,17 @@ var isLocalStyledFactory = (node, context) => {
|
|
|
8099
8099
|
var isValidFile = (context) => {
|
|
8100
8100
|
return syncAction("isValidFile", getSyncOpts(context));
|
|
8101
8101
|
};
|
|
8102
|
-
var isValidProperty = (name2, context
|
|
8103
|
-
return syncAction("isValidProperty", getSyncOpts(context), name2
|
|
8102
|
+
var isValidProperty = (name2, context) => {
|
|
8103
|
+
return syncAction("isValidProperty", getSyncOpts(context), name2);
|
|
8104
8104
|
};
|
|
8105
8105
|
var isPandaImport = (node, context) => {
|
|
8106
8106
|
const imports = getImports(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;
|
|
@@ -8116,46 +8119,33 @@ var isPandaProp = (node, context) => {
|
|
|
8116
8119
|
return;
|
|
8117
8120
|
if (!isPandaIsh(jsxAncestor.name.name, context) && !isLocalStyledFactory(jsxAncestor, context))
|
|
8118
8121
|
return;
|
|
8119
|
-
const prop = node.name.name;
|
|
8120
|
-
if (typeof prop !== "string" || !isValidProperty(prop, context, jsxAncestor.name.name))
|
|
8121
|
-
return;
|
|
8122
8122
|
return true;
|
|
8123
8123
|
};
|
|
8124
|
-
var
|
|
8124
|
+
var isPandaAttribute = (node, context) => {
|
|
8125
8125
|
const callAncestor = getAncestor(isCallExpression, node);
|
|
8126
|
-
if (!callAncestor)
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8126
|
+
if (!callAncestor) {
|
|
8127
|
+
const jsxExprAncestor = getAncestor(isJSXExpressionContainer, node);
|
|
8128
|
+
const jsxAttrAncestor = getAncestor(isJSXAttribute, node);
|
|
8129
|
+
if (!jsxExprAncestor || !jsxAttrAncestor)
|
|
8130
|
+
return;
|
|
8131
|
+
if (!isPandaProp(jsxAttrAncestor, context))
|
|
8132
|
+
return;
|
|
8133
|
+
if (!isValidStyledProp(jsxAttrAncestor.name, context))
|
|
8134
|
+
return;
|
|
8135
|
+
return true;
|
|
8134
8136
|
}
|
|
8135
|
-
if (!calleeName)
|
|
8136
|
-
return;
|
|
8137
|
-
if (!isPandaIsh(calleeName, context))
|
|
8138
|
-
return;
|
|
8139
8137
|
if (!isIdentifier(node.key))
|
|
8140
8138
|
return;
|
|
8141
8139
|
const attr = node.key.name;
|
|
8142
|
-
if (!isValidProperty(attr, context
|
|
8140
|
+
if (!isValidProperty(attr, context))
|
|
8143
8141
|
return;
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
const jsxAttrAncestor = getAncestor(isJSXAttribute, node);
|
|
8152
|
-
if (!jsxExprAncestor || !jsxAttrAncestor)
|
|
8153
|
-
return;
|
|
8154
|
-
if (!isPandaProp(jsxAttrAncestor, context))
|
|
8155
|
-
return;
|
|
8156
|
-
if (!isValidStyledProp(jsxAttrAncestor.name, context))
|
|
8157
|
-
return;
|
|
8158
|
-
return true;
|
|
8142
|
+
if (isIdentifier(callAncestor.callee)) {
|
|
8143
|
+
return isPandaIsh(callAncestor.callee.name, context);
|
|
8144
|
+
}
|
|
8145
|
+
if (isMemberExpression(callAncestor.callee) && isIdentifier(callAncestor.callee.object)) {
|
|
8146
|
+
return isPandaIsh(callAncestor.callee.object.name, context);
|
|
8147
|
+
}
|
|
8148
|
+
return;
|
|
8159
8149
|
};
|
|
8160
8150
|
var resolveLonghand = (name2, context) => {
|
|
8161
8151
|
return syncAction("resolveLongHand", getSyncOpts(context), name2);
|
|
@@ -8240,11 +8230,10 @@ var rule2 = createRule({
|
|
|
8240
8230
|
description: "Prohibit the use of config functions outside the Panda config."
|
|
8241
8231
|
},
|
|
8242
8232
|
messages: {
|
|
8243
|
-
configFunction: "
|
|
8244
|
-
delete: "Delete `{{name}}` call."
|
|
8233
|
+
configFunction: "Remove `{{name}}` usage. Config functions should only be used in panda config"
|
|
8245
8234
|
},
|
|
8246
8235
|
type: "suggestion",
|
|
8247
|
-
|
|
8236
|
+
fixable: "code",
|
|
8248
8237
|
schema: []
|
|
8249
8238
|
},
|
|
8250
8239
|
defaultOptions: [],
|
|
@@ -8263,24 +8252,16 @@ var rule2 = createRule({
|
|
|
8263
8252
|
data: {
|
|
8264
8253
|
name: node.callee.name
|
|
8265
8254
|
},
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
);
|
|
8277
|
-
return [
|
|
8278
|
-
fixer.remove(declaration ?? node),
|
|
8279
|
-
importSpec?.specifier ? fixer.remove(importSpec?.specifier) : {}
|
|
8280
|
-
];
|
|
8281
|
-
}
|
|
8282
|
-
}
|
|
8283
|
-
]
|
|
8255
|
+
fix(fixer) {
|
|
8256
|
+
const declaration = getAncestor(isVariableDeclaration, node);
|
|
8257
|
+
const importSpec = getImportSpecifiers(context).find(
|
|
8258
|
+
(s) => isIdentifier(node.callee) && s.specifier.local.name === node.callee.name
|
|
8259
|
+
);
|
|
8260
|
+
return [
|
|
8261
|
+
fixer.remove(declaration ?? node),
|
|
8262
|
+
importSpec?.specifier ? fixer.remove(importSpec?.specifier) : {}
|
|
8263
|
+
];
|
|
8264
|
+
}
|
|
8284
8265
|
});
|
|
8285
8266
|
}
|
|
8286
8267
|
};
|
|
@@ -8314,12 +8295,10 @@ var rule3 = createRule({
|
|
|
8314
8295
|
description: "Disallow the inclusion of the debug attribute when shipping code to the production environment."
|
|
8315
8296
|
},
|
|
8316
8297
|
messages: {
|
|
8317
|
-
debug: "
|
|
8318
|
-
prop: "Remove the debug prop.",
|
|
8319
|
-
property: "Remove the debug property."
|
|
8298
|
+
debug: "Remove the debug utility."
|
|
8320
8299
|
},
|
|
8321
8300
|
type: "suggestion",
|
|
8322
|
-
|
|
8301
|
+
fixable: "code",
|
|
8323
8302
|
schema: []
|
|
8324
8303
|
},
|
|
8325
8304
|
defaultOptions: [],
|
|
@@ -8333,12 +8312,7 @@ var rule3 = createRule({
|
|
|
8333
8312
|
context.report({
|
|
8334
8313
|
node,
|
|
8335
8314
|
messageId: "debug",
|
|
8336
|
-
|
|
8337
|
-
{
|
|
8338
|
-
messageId: "prop",
|
|
8339
|
-
fix: (fixer) => fixer.remove(node)
|
|
8340
|
-
}
|
|
8341
|
-
]
|
|
8315
|
+
fix: (fixer) => fixer.remove(node)
|
|
8342
8316
|
});
|
|
8343
8317
|
},
|
|
8344
8318
|
Property(node) {
|
|
@@ -8349,12 +8323,7 @@ var rule3 = createRule({
|
|
|
8349
8323
|
context.report({
|
|
8350
8324
|
node: node.key,
|
|
8351
8325
|
messageId: "debug",
|
|
8352
|
-
|
|
8353
|
-
{
|
|
8354
|
-
messageId: "property",
|
|
8355
|
-
fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1])
|
|
8356
|
-
}
|
|
8357
|
-
]
|
|
8326
|
+
fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1])
|
|
8358
8327
|
});
|
|
8359
8328
|
}
|
|
8360
8329
|
};
|
|
@@ -8369,7 +8338,7 @@ var rule4 = createRule({
|
|
|
8369
8338
|
name: RULE_NAME4,
|
|
8370
8339
|
meta: {
|
|
8371
8340
|
docs: {
|
|
8372
|
-
description: "Ensure user doesn't use dynamic styling at any point.
|
|
8341
|
+
description: "Ensure user doesn't use dynamic styling at any point. Prefer to use static styles, leverage css variables or recipes for known dynamic styles."
|
|
8373
8342
|
},
|
|
8374
8343
|
messages: {
|
|
8375
8344
|
dynamic: "Remove dynamic value. Prefer static styles"
|
|
@@ -8426,11 +8395,10 @@ var rule5 = createRule({
|
|
|
8426
8395
|
description: "Prohibit the use of escape hatch syntax in the code."
|
|
8427
8396
|
},
|
|
8428
8397
|
messages: {
|
|
8429
|
-
escapeHatch: "Avoid using the escape hatch [value] for undefined tokens.
|
|
8430
|
-
remove: "Remove the square brackets (`[]`)."
|
|
8398
|
+
escapeHatch: "Avoid using the escape hatch [value] for undefined tokens. Define a corresponding token in your design system for better consistency and maintainability."
|
|
8431
8399
|
},
|
|
8432
8400
|
type: "suggestion",
|
|
8433
|
-
|
|
8401
|
+
fixable: "code",
|
|
8434
8402
|
schema: []
|
|
8435
8403
|
},
|
|
8436
8404
|
defaultOptions: [],
|
|
@@ -8462,14 +8430,9 @@ var rule5 = createRule({
|
|
|
8462
8430
|
return context.report({
|
|
8463
8431
|
node,
|
|
8464
8432
|
messageId: "escapeHatch",
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
fix: (fixer) => {
|
|
8469
|
-
return fixer.replaceTextRange(removeQuotes(node.range), (0, import_shared.getArbitraryValue)(value));
|
|
8470
|
-
}
|
|
8471
|
-
}
|
|
8472
|
-
]
|
|
8433
|
+
fix: (fixer) => {
|
|
8434
|
+
return fixer.replaceTextRange(removeQuotes(node.range), (0, import_shared.getArbitraryValue)(value));
|
|
8435
|
+
}
|
|
8473
8436
|
});
|
|
8474
8437
|
};
|
|
8475
8438
|
return {
|
|
@@ -8690,7 +8653,7 @@ var rule8 = createRule({
|
|
|
8690
8653
|
name: RULE_NAME8,
|
|
8691
8654
|
meta: {
|
|
8692
8655
|
docs: {
|
|
8693
|
-
description: "Ensure user does not rename a property for a pattern or style prop.
|
|
8656
|
+
description: "Ensure user does not rename a property for a pattern or style prop. It doesn't get tracked."
|
|
8694
8657
|
},
|
|
8695
8658
|
messages: {
|
|
8696
8659
|
noRenaming: "Incoming `{{prop}}` prop is different from the expected `{{expected}}` attribute. Panada will not track this prop."
|
|
@@ -8716,7 +8679,7 @@ var rule8 = createRule({
|
|
|
8716
8679
|
return;
|
|
8717
8680
|
if (!isJSXExpressionContainer(node.value))
|
|
8718
8681
|
return;
|
|
8719
|
-
if (!isPandaProp(node, context))
|
|
8682
|
+
if (!isPandaProp(node.name, context))
|
|
8720
8683
|
return;
|
|
8721
8684
|
const attr = node.name.name.toString();
|
|
8722
8685
|
const expression = node.value.expression;
|
|
@@ -8758,34 +8721,26 @@ var rule9 = createRule({
|
|
|
8758
8721
|
description: "Discourage the use of shorthand properties and promote the preference for longhand CSS properties in the codebase."
|
|
8759
8722
|
},
|
|
8760
8723
|
messages: {
|
|
8761
|
-
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`"
|
|
8762
|
-
replace: "Replace `{{shorthand}}` with `{{longhand}}`"
|
|
8724
|
+
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`"
|
|
8763
8725
|
},
|
|
8764
8726
|
type: "suggestion",
|
|
8765
|
-
|
|
8727
|
+
fixable: "code",
|
|
8766
8728
|
schema: []
|
|
8767
8729
|
},
|
|
8768
8730
|
defaultOptions: [],
|
|
8769
8731
|
create(context) {
|
|
8770
8732
|
const sendReport = (node, name2) => {
|
|
8771
8733
|
const longhand = resolveLonghand(name2, context);
|
|
8772
|
-
const data = {
|
|
8773
|
-
shorthand: name2,
|
|
8774
|
-
longhand
|
|
8775
|
-
};
|
|
8776
8734
|
return context.report({
|
|
8777
8735
|
node,
|
|
8778
8736
|
messageId: "longhand",
|
|
8779
|
-
data
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
}
|
|
8787
|
-
}
|
|
8788
|
-
]
|
|
8737
|
+
data: {
|
|
8738
|
+
shorthand: name2,
|
|
8739
|
+
longhand
|
|
8740
|
+
},
|
|
8741
|
+
fix: (fixer) => {
|
|
8742
|
+
return fixer.replaceTextRange(node.range, longhand);
|
|
8743
|
+
}
|
|
8789
8744
|
});
|
|
8790
8745
|
};
|
|
8791
8746
|
return {
|
|
@@ -8825,11 +8780,10 @@ var rule10 = createRule({
|
|
|
8825
8780
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
8826
8781
|
},
|
|
8827
8782
|
messages: {
|
|
8828
|
-
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token"
|
|
8829
|
-
replace: "Replace token function with `{{safe}}`"
|
|
8783
|
+
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token"
|
|
8830
8784
|
},
|
|
8831
8785
|
type: "suggestion",
|
|
8832
|
-
|
|
8786
|
+
fixable: "code",
|
|
8833
8787
|
schema: []
|
|
8834
8788
|
},
|
|
8835
8789
|
defaultOptions: [],
|
|
@@ -8879,15 +8833,9 @@ var rule10 = createRule({
|
|
|
8879
8833
|
return context.report({
|
|
8880
8834
|
node,
|
|
8881
8835
|
messageId: "noUnsafeTokenFnUsage",
|
|
8882
|
-
|
|
8883
|
-
{
|
|
8884
|
-
|
|
8885
|
-
data: { safe: token },
|
|
8886
|
-
fix: (fixer) => {
|
|
8887
|
-
return fixer.replaceTextRange(node.range, `'${token}'`);
|
|
8888
|
-
}
|
|
8889
|
-
}
|
|
8890
|
-
]
|
|
8836
|
+
fix: (fixer) => {
|
|
8837
|
+
return fixer.replaceTextRange(node.range, `'${token}'`);
|
|
8838
|
+
}
|
|
8891
8839
|
});
|
|
8892
8840
|
};
|
|
8893
8841
|
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.5";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -7973,7 +7973,7 @@ var init_nodes = __esm({
|
|
|
7973
7973
|
});
|
|
7974
7974
|
|
|
7975
7975
|
// src/utils/helpers.ts
|
|
7976
|
-
var import_scope_manager, getAncestor, getSyncOpts, getImportSpecifiers, _getImports, getImports, isValidStyledProp, isPandaIsh, findDeclaration, isLocalStyledFactory, isValidFile, isValidProperty, isPandaImport, isPandaProp,
|
|
7976
|
+
var import_scope_manager, getAncestor, getSyncOpts, getImportSpecifiers, _getImports, getImports, isValidStyledProp, isPandaIsh, findDeclaration, isLocalStyledFactory, isValidFile, isValidProperty, isPandaImport, isPandaProp, isPandaAttribute, resolveLonghand, resolveShorthand, isColorAttribute, isColorToken, extractTokens, getInvalidTokens, getTokenImport;
|
|
7977
7977
|
var init_helpers = __esm({
|
|
7978
7978
|
"src/utils/helpers.ts"() {
|
|
7979
7979
|
"use strict";
|
|
@@ -8075,14 +8075,17 @@ var init_helpers = __esm({
|
|
|
8075
8075
|
isValidFile = (context) => {
|
|
8076
8076
|
return syncAction("isValidFile", getSyncOpts(context));
|
|
8077
8077
|
};
|
|
8078
|
-
isValidProperty = (name2, context
|
|
8079
|
-
return syncAction("isValidProperty", getSyncOpts(context), name2
|
|
8078
|
+
isValidProperty = (name2, context) => {
|
|
8079
|
+
return syncAction("isValidProperty", getSyncOpts(context), name2);
|
|
8080
8080
|
};
|
|
8081
8081
|
isPandaImport = (node, context) => {
|
|
8082
8082
|
const imports = getImports(context);
|
|
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;
|
|
@@ -8092,46 +8095,33 @@ var init_helpers = __esm({
|
|
|
8092
8095
|
return;
|
|
8093
8096
|
if (!isPandaIsh(jsxAncestor.name.name, context) && !isLocalStyledFactory(jsxAncestor, context))
|
|
8094
8097
|
return;
|
|
8095
|
-
const prop = node.name.name;
|
|
8096
|
-
if (typeof prop !== "string" || !isValidProperty(prop, context, jsxAncestor.name.name))
|
|
8097
|
-
return;
|
|
8098
8098
|
return true;
|
|
8099
8099
|
};
|
|
8100
|
-
|
|
8100
|
+
isPandaAttribute = (node, context) => {
|
|
8101
8101
|
const callAncestor = getAncestor(isCallExpression, node);
|
|
8102
|
-
if (!callAncestor)
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8102
|
+
if (!callAncestor) {
|
|
8103
|
+
const jsxExprAncestor = getAncestor(isJSXExpressionContainer, node);
|
|
8104
|
+
const jsxAttrAncestor = getAncestor(isJSXAttribute, node);
|
|
8105
|
+
if (!jsxExprAncestor || !jsxAttrAncestor)
|
|
8106
|
+
return;
|
|
8107
|
+
if (!isPandaProp(jsxAttrAncestor, context))
|
|
8108
|
+
return;
|
|
8109
|
+
if (!isValidStyledProp(jsxAttrAncestor.name, context))
|
|
8110
|
+
return;
|
|
8111
|
+
return true;
|
|
8110
8112
|
}
|
|
8111
|
-
if (!calleeName)
|
|
8112
|
-
return;
|
|
8113
|
-
if (!isPandaIsh(calleeName, context))
|
|
8114
|
-
return;
|
|
8115
8113
|
if (!isIdentifier(node.key))
|
|
8116
8114
|
return;
|
|
8117
8115
|
const attr = node.key.name;
|
|
8118
|
-
if (!isValidProperty(attr, context
|
|
8119
|
-
return;
|
|
8120
|
-
return true;
|
|
8121
|
-
};
|
|
8122
|
-
isPandaAttribute = (node, context) => {
|
|
8123
|
-
const callAncestor = getAncestor(isCallExpression, node);
|
|
8124
|
-
if (callAncestor)
|
|
8125
|
-
return isInPandaFunction(node, context);
|
|
8126
|
-
const jsxExprAncestor = getAncestor(isJSXExpressionContainer, node);
|
|
8127
|
-
const jsxAttrAncestor = getAncestor(isJSXAttribute, node);
|
|
8128
|
-
if (!jsxExprAncestor || !jsxAttrAncestor)
|
|
8129
|
-
return;
|
|
8130
|
-
if (!isPandaProp(jsxAttrAncestor, context))
|
|
8131
|
-
return;
|
|
8132
|
-
if (!isValidStyledProp(jsxAttrAncestor.name, context))
|
|
8116
|
+
if (!isValidProperty(attr, context))
|
|
8133
8117
|
return;
|
|
8134
|
-
|
|
8118
|
+
if (isIdentifier(callAncestor.callee)) {
|
|
8119
|
+
return isPandaIsh(callAncestor.callee.name, context);
|
|
8120
|
+
}
|
|
8121
|
+
if (isMemberExpression(callAncestor.callee) && isIdentifier(callAncestor.callee.object)) {
|
|
8122
|
+
return isPandaIsh(callAncestor.callee.object.name, context);
|
|
8123
|
+
}
|
|
8124
|
+
return;
|
|
8135
8125
|
};
|
|
8136
8126
|
resolveLonghand = (name2, context) => {
|
|
8137
8127
|
return syncAction("resolveLongHand", getSyncOpts(context), name2);
|
|
@@ -8234,11 +8224,10 @@ var init_no_config_function_in_source = __esm({
|
|
|
8234
8224
|
description: "Prohibit the use of config functions outside the Panda config."
|
|
8235
8225
|
},
|
|
8236
8226
|
messages: {
|
|
8237
|
-
configFunction: "
|
|
8238
|
-
delete: "Delete `{{name}}` call."
|
|
8227
|
+
configFunction: "Remove `{{name}}` usage. Config functions should only be used in panda config"
|
|
8239
8228
|
},
|
|
8240
8229
|
type: "suggestion",
|
|
8241
|
-
|
|
8230
|
+
fixable: "code",
|
|
8242
8231
|
schema: []
|
|
8243
8232
|
},
|
|
8244
8233
|
defaultOptions: [],
|
|
@@ -8257,24 +8246,16 @@ var init_no_config_function_in_source = __esm({
|
|
|
8257
8246
|
data: {
|
|
8258
8247
|
name: node.callee.name
|
|
8259
8248
|
},
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
);
|
|
8271
|
-
return [
|
|
8272
|
-
fixer.remove(declaration ?? node),
|
|
8273
|
-
importSpec?.specifier ? fixer.remove(importSpec?.specifier) : {}
|
|
8274
|
-
];
|
|
8275
|
-
}
|
|
8276
|
-
}
|
|
8277
|
-
]
|
|
8249
|
+
fix(fixer) {
|
|
8250
|
+
const declaration = getAncestor(isVariableDeclaration, node);
|
|
8251
|
+
const importSpec = getImportSpecifiers(context).find(
|
|
8252
|
+
(s) => isIdentifier(node.callee) && s.specifier.local.name === node.callee.name
|
|
8253
|
+
);
|
|
8254
|
+
return [
|
|
8255
|
+
fixer.remove(declaration ?? node),
|
|
8256
|
+
importSpec?.specifier ? fixer.remove(importSpec?.specifier) : {}
|
|
8257
|
+
];
|
|
8258
|
+
}
|
|
8278
8259
|
});
|
|
8279
8260
|
}
|
|
8280
8261
|
};
|
|
@@ -8317,12 +8298,10 @@ var init_no_debug = __esm({
|
|
|
8317
8298
|
description: "Disallow the inclusion of the debug attribute when shipping code to the production environment."
|
|
8318
8299
|
},
|
|
8319
8300
|
messages: {
|
|
8320
|
-
debug: "
|
|
8321
|
-
prop: "Remove the debug prop.",
|
|
8322
|
-
property: "Remove the debug property."
|
|
8301
|
+
debug: "Remove the debug utility."
|
|
8323
8302
|
},
|
|
8324
8303
|
type: "suggestion",
|
|
8325
|
-
|
|
8304
|
+
fixable: "code",
|
|
8326
8305
|
schema: []
|
|
8327
8306
|
},
|
|
8328
8307
|
defaultOptions: [],
|
|
@@ -8336,12 +8315,7 @@ var init_no_debug = __esm({
|
|
|
8336
8315
|
context.report({
|
|
8337
8316
|
node,
|
|
8338
8317
|
messageId: "debug",
|
|
8339
|
-
|
|
8340
|
-
{
|
|
8341
|
-
messageId: "prop",
|
|
8342
|
-
fix: (fixer) => fixer.remove(node)
|
|
8343
|
-
}
|
|
8344
|
-
]
|
|
8318
|
+
fix: (fixer) => fixer.remove(node)
|
|
8345
8319
|
});
|
|
8346
8320
|
},
|
|
8347
8321
|
Property(node) {
|
|
@@ -8352,12 +8326,7 @@ var init_no_debug = __esm({
|
|
|
8352
8326
|
context.report({
|
|
8353
8327
|
node: node.key,
|
|
8354
8328
|
messageId: "debug",
|
|
8355
|
-
|
|
8356
|
-
{
|
|
8357
|
-
messageId: "property",
|
|
8358
|
-
fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1])
|
|
8359
|
-
}
|
|
8360
|
-
]
|
|
8329
|
+
fix: (fixer) => fixer.removeRange([node.range[0], node.range[1] + 1])
|
|
8361
8330
|
});
|
|
8362
8331
|
}
|
|
8363
8332
|
};
|
|
@@ -8381,7 +8350,7 @@ var init_no_dynamic_styling = __esm({
|
|
|
8381
8350
|
name: RULE_NAME4,
|
|
8382
8351
|
meta: {
|
|
8383
8352
|
docs: {
|
|
8384
|
-
description: "Ensure user doesn't use dynamic styling at any point.
|
|
8353
|
+
description: "Ensure user doesn't use dynamic styling at any point. Prefer to use static styles, leverage css variables or recipes for known dynamic styles."
|
|
8385
8354
|
},
|
|
8386
8355
|
messages: {
|
|
8387
8356
|
dynamic: "Remove dynamic value. Prefer static styles"
|
|
@@ -8447,11 +8416,10 @@ var init_no_escape_hatch = __esm({
|
|
|
8447
8416
|
description: "Prohibit the use of escape hatch syntax in the code."
|
|
8448
8417
|
},
|
|
8449
8418
|
messages: {
|
|
8450
|
-
escapeHatch: "Avoid using the escape hatch [value] for undefined tokens.
|
|
8451
|
-
remove: "Remove the square brackets (`[]`)."
|
|
8419
|
+
escapeHatch: "Avoid using the escape hatch [value] for undefined tokens. Define a corresponding token in your design system for better consistency and maintainability."
|
|
8452
8420
|
},
|
|
8453
8421
|
type: "suggestion",
|
|
8454
|
-
|
|
8422
|
+
fixable: "code",
|
|
8455
8423
|
schema: []
|
|
8456
8424
|
},
|
|
8457
8425
|
defaultOptions: [],
|
|
@@ -8483,14 +8451,9 @@ var init_no_escape_hatch = __esm({
|
|
|
8483
8451
|
return context.report({
|
|
8484
8452
|
node,
|
|
8485
8453
|
messageId: "escapeHatch",
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
fix: (fixer) => {
|
|
8490
|
-
return fixer.replaceTextRange(removeQuotes(node.range), getArbitraryValue(value));
|
|
8491
|
-
}
|
|
8492
|
-
}
|
|
8493
|
-
]
|
|
8454
|
+
fix: (fixer) => {
|
|
8455
|
+
return fixer.replaceTextRange(removeQuotes(node.range), getArbitraryValue(value));
|
|
8456
|
+
}
|
|
8494
8457
|
});
|
|
8495
8458
|
};
|
|
8496
8459
|
return {
|
|
@@ -8738,7 +8701,7 @@ var init_no_property_renaming = __esm({
|
|
|
8738
8701
|
name: RULE_NAME8,
|
|
8739
8702
|
meta: {
|
|
8740
8703
|
docs: {
|
|
8741
|
-
description: "Ensure user does not rename a property for a pattern or style prop.
|
|
8704
|
+
description: "Ensure user does not rename a property for a pattern or style prop. It doesn't get tracked."
|
|
8742
8705
|
},
|
|
8743
8706
|
messages: {
|
|
8744
8707
|
noRenaming: "Incoming `{{prop}}` prop is different from the expected `{{expected}}` attribute. Panada will not track this prop."
|
|
@@ -8764,7 +8727,7 @@ var init_no_property_renaming = __esm({
|
|
|
8764
8727
|
return;
|
|
8765
8728
|
if (!isJSXExpressionContainer(node.value))
|
|
8766
8729
|
return;
|
|
8767
|
-
if (!isPandaProp(node, context))
|
|
8730
|
+
if (!isPandaProp(node.name, context))
|
|
8768
8731
|
return;
|
|
8769
8732
|
const attr = node.name.name.toString();
|
|
8770
8733
|
const expression = node.value.expression;
|
|
@@ -8815,34 +8778,26 @@ var init_no_shorthand_prop = __esm({
|
|
|
8815
8778
|
description: "Discourage the use of shorthand properties and promote the preference for longhand CSS properties in the codebase."
|
|
8816
8779
|
},
|
|
8817
8780
|
messages: {
|
|
8818
|
-
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`"
|
|
8819
|
-
replace: "Replace `{{shorthand}}` with `{{longhand}}`"
|
|
8781
|
+
longhand: "Use longhand property of `{{shorthand}}` instead. Prefer `{{longhand}}`"
|
|
8820
8782
|
},
|
|
8821
8783
|
type: "suggestion",
|
|
8822
|
-
|
|
8784
|
+
fixable: "code",
|
|
8823
8785
|
schema: []
|
|
8824
8786
|
},
|
|
8825
8787
|
defaultOptions: [],
|
|
8826
8788
|
create(context) {
|
|
8827
8789
|
const sendReport = (node, name2) => {
|
|
8828
8790
|
const longhand = resolveLonghand(name2, context);
|
|
8829
|
-
const data = {
|
|
8830
|
-
shorthand: name2,
|
|
8831
|
-
longhand
|
|
8832
|
-
};
|
|
8833
8791
|
return context.report({
|
|
8834
8792
|
node,
|
|
8835
8793
|
messageId: "longhand",
|
|
8836
|
-
data
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
}
|
|
8844
|
-
}
|
|
8845
|
-
]
|
|
8794
|
+
data: {
|
|
8795
|
+
shorthand: name2,
|
|
8796
|
+
longhand
|
|
8797
|
+
},
|
|
8798
|
+
fix: (fixer) => {
|
|
8799
|
+
return fixer.replaceTextRange(node.range, longhand);
|
|
8800
|
+
}
|
|
8846
8801
|
});
|
|
8847
8802
|
};
|
|
8848
8803
|
return {
|
|
@@ -8891,11 +8846,10 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8891
8846
|
description: "Prevent users from using the token function in situations where they could simply use the raw design token."
|
|
8892
8847
|
},
|
|
8893
8848
|
messages: {
|
|
8894
|
-
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token"
|
|
8895
|
-
replace: "Replace token function with `{{safe}}`"
|
|
8849
|
+
noUnsafeTokenFnUsage: "Unneccessary token function usage. Prefer design token"
|
|
8896
8850
|
},
|
|
8897
8851
|
type: "suggestion",
|
|
8898
|
-
|
|
8852
|
+
fixable: "code",
|
|
8899
8853
|
schema: []
|
|
8900
8854
|
},
|
|
8901
8855
|
defaultOptions: [],
|
|
@@ -8945,15 +8899,9 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
8945
8899
|
return context.report({
|
|
8946
8900
|
node,
|
|
8947
8901
|
messageId: "noUnsafeTokenFnUsage",
|
|
8948
|
-
|
|
8949
|
-
{
|
|
8950
|
-
|
|
8951
|
-
data: { safe: token },
|
|
8952
|
-
fix: (fixer) => {
|
|
8953
|
-
return fixer.replaceTextRange(node.range, `'${token}'`);
|
|
8954
|
-
}
|
|
8955
|
-
}
|
|
8956
|
-
]
|
|
8902
|
+
fix: (fixer) => {
|
|
8903
|
+
return fixer.replaceTextRange(node.range, `'${token}'`);
|
|
8904
|
+
}
|
|
8957
8905
|
});
|
|
8958
8906
|
};
|
|
8959
8907
|
return {
|
package/dist/utils/worker.js
CHANGED
|
@@ -3390,7 +3390,6 @@ var createContext = (userConfig) => {
|
|
|
3390
3390
|
var import_ts_path = require("@pandacss/config/ts-path");
|
|
3391
3391
|
var import_config3 = require("@pandacss/config");
|
|
3392
3392
|
var import_path = __toESM(require("path"));
|
|
3393
|
-
var import_fs = __toESM(require("fs"));
|
|
3394
3393
|
var promise;
|
|
3395
3394
|
var configPath;
|
|
3396
3395
|
async function _getContext(configPath2) {
|
|
@@ -3402,7 +3401,6 @@ async function _getContext(configPath2) {
|
|
|
3402
3401
|
}
|
|
3403
3402
|
async function getContext(opts) {
|
|
3404
3403
|
if (process.env.NODE_ENV === "test") {
|
|
3405
|
-
configPath = opts.configPath;
|
|
3406
3404
|
const ctx = createContext({ importMap: "./panda" });
|
|
3407
3405
|
ctx.getFiles = () => ["App.tsx"];
|
|
3408
3406
|
return ctx;
|
|
@@ -3412,27 +3410,6 @@ async function getContext(opts) {
|
|
|
3412
3410
|
return await promise;
|
|
3413
3411
|
}
|
|
3414
3412
|
}
|
|
3415
|
-
async function getExtendWarnings() {
|
|
3416
|
-
if (!configPath)
|
|
3417
|
-
return [];
|
|
3418
|
-
const cwd = import_path.default.dirname(configPath);
|
|
3419
|
-
const { config: config2 } = await (0, import_config3.bundleConfig)({ cwd, file: configPath });
|
|
3420
|
-
if (!config2.presets || config2.presets.length === 0)
|
|
3421
|
-
return [];
|
|
3422
|
-
if (config2.eject)
|
|
3423
|
-
return [];
|
|
3424
|
-
const warnings = /* @__PURE__ */ new Set();
|
|
3425
|
-
if (config2.theme && !config2.theme.extend) {
|
|
3426
|
-
warnings.add("theme");
|
|
3427
|
-
}
|
|
3428
|
-
if (config2.conditions && !config2.conditions.extend) {
|
|
3429
|
-
warnings.add("conditions");
|
|
3430
|
-
}
|
|
3431
|
-
if (config2.patterns && !config2.patterns.extend) {
|
|
3432
|
-
warnings.add("patterns");
|
|
3433
|
-
}
|
|
3434
|
-
return Array.from(warnings);
|
|
3435
|
-
}
|
|
3436
3413
|
async function filterInvalidTokenz(ctx, paths) {
|
|
3437
3414
|
return paths.filter((path2) => !ctx.utility.tokens.get(path2));
|
|
3438
3415
|
}
|
|
@@ -3445,14 +3422,6 @@ async function isColorAttribute(ctx, _attr) {
|
|
|
3445
3422
|
const attrConfig = ctx.utility.config[attr];
|
|
3446
3423
|
return attrConfig?.values === "colors";
|
|
3447
3424
|
}
|
|
3448
|
-
var arePathsEqual = (path1, path2) => {
|
|
3449
|
-
const stats1 = import_fs.default.statSync(path1);
|
|
3450
|
-
const stats2 = import_fs.default.statSync(path2);
|
|
3451
|
-
return stats1.dev === stats2.dev && stats1.ino === stats2.ino;
|
|
3452
|
-
};
|
|
3453
|
-
async function isConfigFile(fileName) {
|
|
3454
|
-
return arePathsEqual(configPath, fileName);
|
|
3455
|
-
}
|
|
3456
3425
|
async function isValidFile(ctx, fileName) {
|
|
3457
3426
|
return ctx.getFiles().includes(fileName);
|
|
3458
3427
|
}
|
|
@@ -3468,15 +3437,8 @@ async function resolveLongHand(ctx, name) {
|
|
|
3468
3437
|
}
|
|
3469
3438
|
return reverseShorthandsMap.get(name);
|
|
3470
3439
|
}
|
|
3471
|
-
async function isValidProperty(ctx, name
|
|
3472
|
-
|
|
3473
|
-
return true;
|
|
3474
|
-
if (!patternName)
|
|
3475
|
-
return;
|
|
3476
|
-
const pattern = ctx.patterns.details.find((p) => p.baseName === patternName || p.jsx.includes(patternName))?.config.properties;
|
|
3477
|
-
if (!pattern)
|
|
3478
|
-
return;
|
|
3479
|
-
return Object.keys(pattern).includes(name);
|
|
3440
|
+
async function isValidProperty(ctx, name) {
|
|
3441
|
+
return ctx.isValidProperty(name);
|
|
3480
3442
|
}
|
|
3481
3443
|
async function matchFile(ctx, name, imports) {
|
|
3482
3444
|
const file = ctx.imports.file(imports);
|
|
@@ -3503,8 +3465,6 @@ async function runAsync(action, opts, ...args) {
|
|
|
3503
3465
|
return resolveLongHand(ctx, ...args);
|
|
3504
3466
|
case "resolveShorthand":
|
|
3505
3467
|
return resolveShorthand(ctx, ...args);
|
|
3506
|
-
case "isConfigFile":
|
|
3507
|
-
return isConfigFile(opts.currentFile);
|
|
3508
3468
|
case "isValidFile":
|
|
3509
3469
|
return isValidFile(ctx, opts.currentFile);
|
|
3510
3470
|
case "isColorAttribute":
|
|
@@ -3513,8 +3473,6 @@ async function runAsync(action, opts, ...args) {
|
|
|
3513
3473
|
return isColorToken(ctx, ...args);
|
|
3514
3474
|
case "filterInvalidTokenz":
|
|
3515
3475
|
return filterInvalidTokenz(ctx, ...args);
|
|
3516
|
-
case "getExtendWarnings":
|
|
3517
|
-
return getExtendWarnings();
|
|
3518
3476
|
}
|
|
3519
3477
|
}
|
|
3520
3478
|
function run(action, opts, ...args) {
|
package/dist/utils/worker.mjs
CHANGED
|
@@ -3372,9 +3372,8 @@ init_esm_shims();
|
|
|
3372
3372
|
|
|
3373
3373
|
// src/utils/worker.ts
|
|
3374
3374
|
import { resolveTsPathPattern } from "@pandacss/config/ts-path";
|
|
3375
|
-
import { findConfig
|
|
3375
|
+
import { findConfig } from "@pandacss/config";
|
|
3376
3376
|
import path from "path";
|
|
3377
|
-
import fs from "fs";
|
|
3378
3377
|
var promise;
|
|
3379
3378
|
var configPath;
|
|
3380
3379
|
async function _getContext(configPath2) {
|
|
@@ -3386,7 +3385,6 @@ async function _getContext(configPath2) {
|
|
|
3386
3385
|
}
|
|
3387
3386
|
async function getContext(opts) {
|
|
3388
3387
|
if (process.env.NODE_ENV === "test") {
|
|
3389
|
-
configPath = opts.configPath;
|
|
3390
3388
|
const ctx = createContext({ importMap: "./panda" });
|
|
3391
3389
|
ctx.getFiles = () => ["App.tsx"];
|
|
3392
3390
|
return ctx;
|
|
@@ -3396,27 +3394,6 @@ async function getContext(opts) {
|
|
|
3396
3394
|
return await promise;
|
|
3397
3395
|
}
|
|
3398
3396
|
}
|
|
3399
|
-
async function getExtendWarnings() {
|
|
3400
|
-
if (!configPath)
|
|
3401
|
-
return [];
|
|
3402
|
-
const cwd = path.dirname(configPath);
|
|
3403
|
-
const { config: config2 } = await bundleConfig({ cwd, file: configPath });
|
|
3404
|
-
if (!config2.presets || config2.presets.length === 0)
|
|
3405
|
-
return [];
|
|
3406
|
-
if (config2.eject)
|
|
3407
|
-
return [];
|
|
3408
|
-
const warnings = /* @__PURE__ */ new Set();
|
|
3409
|
-
if (config2.theme && !config2.theme.extend) {
|
|
3410
|
-
warnings.add("theme");
|
|
3411
|
-
}
|
|
3412
|
-
if (config2.conditions && !config2.conditions.extend) {
|
|
3413
|
-
warnings.add("conditions");
|
|
3414
|
-
}
|
|
3415
|
-
if (config2.patterns && !config2.patterns.extend) {
|
|
3416
|
-
warnings.add("patterns");
|
|
3417
|
-
}
|
|
3418
|
-
return Array.from(warnings);
|
|
3419
|
-
}
|
|
3420
3397
|
async function filterInvalidTokenz(ctx, paths) {
|
|
3421
3398
|
return paths.filter((path2) => !ctx.utility.tokens.get(path2));
|
|
3422
3399
|
}
|
|
@@ -3429,14 +3406,6 @@ async function isColorAttribute(ctx, _attr) {
|
|
|
3429
3406
|
const attrConfig = ctx.utility.config[attr];
|
|
3430
3407
|
return attrConfig?.values === "colors";
|
|
3431
3408
|
}
|
|
3432
|
-
var arePathsEqual = (path1, path2) => {
|
|
3433
|
-
const stats1 = fs.statSync(path1);
|
|
3434
|
-
const stats2 = fs.statSync(path2);
|
|
3435
|
-
return stats1.dev === stats2.dev && stats1.ino === stats2.ino;
|
|
3436
|
-
};
|
|
3437
|
-
async function isConfigFile(fileName) {
|
|
3438
|
-
return arePathsEqual(configPath, fileName);
|
|
3439
|
-
}
|
|
3440
3409
|
async function isValidFile(ctx, fileName) {
|
|
3441
3410
|
return ctx.getFiles().includes(fileName);
|
|
3442
3411
|
}
|
|
@@ -3452,15 +3421,8 @@ async function resolveLongHand(ctx, name) {
|
|
|
3452
3421
|
}
|
|
3453
3422
|
return reverseShorthandsMap.get(name);
|
|
3454
3423
|
}
|
|
3455
|
-
async function isValidProperty(ctx, name
|
|
3456
|
-
|
|
3457
|
-
return true;
|
|
3458
|
-
if (!patternName)
|
|
3459
|
-
return;
|
|
3460
|
-
const pattern = ctx.patterns.details.find((p) => p.baseName === patternName || p.jsx.includes(patternName))?.config.properties;
|
|
3461
|
-
if (!pattern)
|
|
3462
|
-
return;
|
|
3463
|
-
return Object.keys(pattern).includes(name);
|
|
3424
|
+
async function isValidProperty(ctx, name) {
|
|
3425
|
+
return ctx.isValidProperty(name);
|
|
3464
3426
|
}
|
|
3465
3427
|
async function matchFile(ctx, name, imports) {
|
|
3466
3428
|
const file = ctx.imports.file(imports);
|
|
@@ -3487,8 +3449,6 @@ async function runAsync(action, opts, ...args) {
|
|
|
3487
3449
|
return resolveLongHand(ctx, ...args);
|
|
3488
3450
|
case "resolveShorthand":
|
|
3489
3451
|
return resolveShorthand(ctx, ...args);
|
|
3490
|
-
case "isConfigFile":
|
|
3491
|
-
return isConfigFile(opts.currentFile);
|
|
3492
3452
|
case "isValidFile":
|
|
3493
3453
|
return isValidFile(ctx, opts.currentFile);
|
|
3494
3454
|
case "isColorAttribute":
|
|
@@ -3497,8 +3457,6 @@ async function runAsync(action, opts, ...args) {
|
|
|
3497
3457
|
return isColorToken(ctx, ...args);
|
|
3498
3458
|
case "filterInvalidTokenz":
|
|
3499
3459
|
return filterInvalidTokenz(ctx, ...args);
|
|
3500
|
-
case "getExtendWarnings":
|
|
3501
|
-
return getExtendWarnings();
|
|
3502
3460
|
}
|
|
3503
3461
|
}
|
|
3504
3462
|
function run(action, opts, ...args) {
|