@pandacss/eslint-plugin 0.1.3 → 0.1.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 +41 -36
- package/dist/index.mjs +42 -37
- package/dist/utils/worker.js +2218 -1858
- package/dist/utils/worker.mjs +2218 -1858
- package/package.json +5 -5
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.1.
|
|
7960
|
+
var version = "0.1.5";
|
|
7961
7961
|
|
|
7962
7962
|
// src/configs/all.ts
|
|
7963
7963
|
init_cjs_shims();
|
|
@@ -8024,7 +8024,7 @@ var getSyncOpts = (context) => {
|
|
|
8024
8024
|
};
|
|
8025
8025
|
var getImportSpecifiers = (context) => {
|
|
8026
8026
|
const specifiers = [];
|
|
8027
|
-
context.sourceCode
|
|
8027
|
+
context.sourceCode?.ast.body.forEach((node) => {
|
|
8028
8028
|
if (!isImportDeclaration(node))
|
|
8029
8029
|
return;
|
|
8030
8030
|
const mod = node.source.value;
|
|
@@ -8205,6 +8205,21 @@ var getTokenImport = (context) => {
|
|
|
8205
8205
|
const imports = _getImports(context);
|
|
8206
8206
|
return imports.find((imp) => imp.name === "token");
|
|
8207
8207
|
};
|
|
8208
|
+
var getTaggedTemplateCaller = (node) => {
|
|
8209
|
+
if (isIdentifier(node.tag)) {
|
|
8210
|
+
return node.tag.name;
|
|
8211
|
+
}
|
|
8212
|
+
if (isMemberExpression(node.tag)) {
|
|
8213
|
+
if (!isIdentifier(node.tag.object))
|
|
8214
|
+
return;
|
|
8215
|
+
return node.tag.object.name;
|
|
8216
|
+
}
|
|
8217
|
+
if (isCallExpression(node.tag)) {
|
|
8218
|
+
if (!isIdentifier(node.tag.callee))
|
|
8219
|
+
return;
|
|
8220
|
+
return node.tag.callee.name;
|
|
8221
|
+
}
|
|
8222
|
+
};
|
|
8208
8223
|
|
|
8209
8224
|
// src/rules/file-not-included.ts
|
|
8210
8225
|
var RULE_NAME = "file-not-included";
|
|
@@ -8817,41 +8832,29 @@ var rule9 = createRule({
|
|
|
8817
8832
|
handleTemplateLiteral(node.value);
|
|
8818
8833
|
},
|
|
8819
8834
|
TaggedTemplateExpression(node) {
|
|
8820
|
-
const
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
while (index !== -1) {
|
|
8831
|
-
const start = quasis.range[0] + 1 + index;
|
|
8832
|
-
const end = start + token.length;
|
|
8833
|
-
context.report({
|
|
8834
|
-
loc: { start: context.sourceCode.getLocFromIndex(start), end: context.sourceCode.getLocFromIndex(end) },
|
|
8835
|
-
messageId: "noInvalidTokenPaths",
|
|
8836
|
-
data: { token }
|
|
8837
|
-
});
|
|
8838
|
-
index = styles.indexOf(token, index + 1);
|
|
8839
|
-
}
|
|
8840
|
-
});
|
|
8841
|
-
};
|
|
8842
|
-
if (isIdentifier(node.tag)) {
|
|
8843
|
-
handleExpression(node.tag.name);
|
|
8844
|
-
}
|
|
8845
|
-
if (isMemberExpression(node.tag)) {
|
|
8846
|
-
if (!isIdentifier(node.tag.object))
|
|
8847
|
-
return;
|
|
8848
|
-
handleExpression(node.tag.object.name);
|
|
8849
|
-
}
|
|
8850
|
-
if (isCallExpression(node.tag)) {
|
|
8851
|
-
if (!isIdentifier(node.tag.callee))
|
|
8835
|
+
const caller = getTaggedTemplateCaller(node);
|
|
8836
|
+
if (!caller)
|
|
8837
|
+
return;
|
|
8838
|
+
if (!isPandaIsh(caller, context))
|
|
8839
|
+
return;
|
|
8840
|
+
const quasis = node.quasi.quasis[0];
|
|
8841
|
+
const styles = quasis.value.raw;
|
|
8842
|
+
const tokens = getInvalidTokens(styles, context);
|
|
8843
|
+
tokens.forEach((token, i, arr) => {
|
|
8844
|
+
if (arr.indexOf(token) < i)
|
|
8852
8845
|
return;
|
|
8853
|
-
|
|
8854
|
-
|
|
8846
|
+
let index = styles.indexOf(token);
|
|
8847
|
+
while (index !== -1) {
|
|
8848
|
+
const start = quasis.range[0] + 1 + index;
|
|
8849
|
+
const end = start + token.length;
|
|
8850
|
+
context.report({
|
|
8851
|
+
loc: { start: context.sourceCode.getLocFromIndex(start), end: context.sourceCode.getLocFromIndex(end) },
|
|
8852
|
+
messageId: "noInvalidTokenPaths",
|
|
8853
|
+
data: { token }
|
|
8854
|
+
});
|
|
8855
|
+
index = styles.indexOf(token, index + 1);
|
|
8856
|
+
}
|
|
8857
|
+
});
|
|
8855
8858
|
}
|
|
8856
8859
|
};
|
|
8857
8860
|
}
|
|
@@ -9134,6 +9137,8 @@ var rule13 = createRule({
|
|
|
9134
9137
|
};
|
|
9135
9138
|
const sendReport = (node, value) => {
|
|
9136
9139
|
const tkImports = extractTokens(value);
|
|
9140
|
+
if (!tkImports.length)
|
|
9141
|
+
return;
|
|
9137
9142
|
const token = tkImports[0].replace(/^[^.]*\./, "");
|
|
9138
9143
|
return context.report({
|
|
9139
9144
|
node,
|
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.1.
|
|
13
|
+
version = "0.1.5";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -7975,7 +7975,7 @@ var init_nodes = __esm({
|
|
|
7975
7975
|
});
|
|
7976
7976
|
|
|
7977
7977
|
// src/utils/helpers.ts
|
|
7978
|
-
var import_scope_manager, getAncestor, getSyncOpts, getImportSpecifiers, hasPkgImport, isPandaConfigFunction, _getImports, getImports, isValidStyledProp, isPandaIsh, findDeclaration, isLocalStyledFactory, isValidFile, isValidProperty, isPandaImport, isPandaProp, isStyledProperty, isInPandaFunction, isInJSXProp, isPandaAttribute, resolveLonghand, resolveShorthands, isColorAttribute, isColorToken, extractTokens, getInvalidTokens, getTokenImport;
|
|
7978
|
+
var import_scope_manager, getAncestor, getSyncOpts, getImportSpecifiers, hasPkgImport, isPandaConfigFunction, _getImports, getImports, isValidStyledProp, isPandaIsh, findDeclaration, isLocalStyledFactory, isValidFile, isValidProperty, isPandaImport, isPandaProp, isStyledProperty, isInPandaFunction, isInJSXProp, isPandaAttribute, resolveLonghand, resolveShorthands, isColorAttribute, isColorToken, extractTokens, getInvalidTokens, getTokenImport, getTaggedTemplateCaller;
|
|
7979
7979
|
var init_helpers = __esm({
|
|
7980
7980
|
"src/utils/helpers.ts"() {
|
|
7981
7981
|
"use strict";
|
|
@@ -8000,7 +8000,7 @@ var init_helpers = __esm({
|
|
|
8000
8000
|
};
|
|
8001
8001
|
getImportSpecifiers = (context) => {
|
|
8002
8002
|
const specifiers = [];
|
|
8003
|
-
context.sourceCode
|
|
8003
|
+
context.sourceCode?.ast.body.forEach((node) => {
|
|
8004
8004
|
if (!isImportDeclaration(node))
|
|
8005
8005
|
return;
|
|
8006
8006
|
const mod = node.source.value;
|
|
@@ -8181,6 +8181,21 @@ var init_helpers = __esm({
|
|
|
8181
8181
|
const imports = _getImports(context);
|
|
8182
8182
|
return imports.find((imp) => imp.name === "token");
|
|
8183
8183
|
};
|
|
8184
|
+
getTaggedTemplateCaller = (node) => {
|
|
8185
|
+
if (isIdentifier(node.tag)) {
|
|
8186
|
+
return node.tag.name;
|
|
8187
|
+
}
|
|
8188
|
+
if (isMemberExpression(node.tag)) {
|
|
8189
|
+
if (!isIdentifier(node.tag.object))
|
|
8190
|
+
return;
|
|
8191
|
+
return node.tag.object.name;
|
|
8192
|
+
}
|
|
8193
|
+
if (isCallExpression(node.tag)) {
|
|
8194
|
+
if (!isIdentifier(node.tag.callee))
|
|
8195
|
+
return;
|
|
8196
|
+
return node.tag.callee.name;
|
|
8197
|
+
}
|
|
8198
|
+
};
|
|
8184
8199
|
}
|
|
8185
8200
|
});
|
|
8186
8201
|
|
|
@@ -8874,41 +8889,29 @@ var init_no_invalid_token_paths = __esm({
|
|
|
8874
8889
|
handleTemplateLiteral(node.value);
|
|
8875
8890
|
},
|
|
8876
8891
|
TaggedTemplateExpression(node) {
|
|
8877
|
-
const
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
while (index !== -1) {
|
|
8888
|
-
const start = quasis.range[0] + 1 + index;
|
|
8889
|
-
const end = start + token.length;
|
|
8890
|
-
context.report({
|
|
8891
|
-
loc: { start: context.sourceCode.getLocFromIndex(start), end: context.sourceCode.getLocFromIndex(end) },
|
|
8892
|
-
messageId: "noInvalidTokenPaths",
|
|
8893
|
-
data: { token }
|
|
8894
|
-
});
|
|
8895
|
-
index = styles.indexOf(token, index + 1);
|
|
8896
|
-
}
|
|
8897
|
-
});
|
|
8898
|
-
};
|
|
8899
|
-
if (isIdentifier(node.tag)) {
|
|
8900
|
-
handleExpression(node.tag.name);
|
|
8901
|
-
}
|
|
8902
|
-
if (isMemberExpression(node.tag)) {
|
|
8903
|
-
if (!isIdentifier(node.tag.object))
|
|
8904
|
-
return;
|
|
8905
|
-
handleExpression(node.tag.object.name);
|
|
8906
|
-
}
|
|
8907
|
-
if (isCallExpression(node.tag)) {
|
|
8908
|
-
if (!isIdentifier(node.tag.callee))
|
|
8892
|
+
const caller = getTaggedTemplateCaller(node);
|
|
8893
|
+
if (!caller)
|
|
8894
|
+
return;
|
|
8895
|
+
if (!isPandaIsh(caller, context))
|
|
8896
|
+
return;
|
|
8897
|
+
const quasis = node.quasi.quasis[0];
|
|
8898
|
+
const styles = quasis.value.raw;
|
|
8899
|
+
const tokens = getInvalidTokens(styles, context);
|
|
8900
|
+
tokens.forEach((token, i, arr) => {
|
|
8901
|
+
if (arr.indexOf(token) < i)
|
|
8909
8902
|
return;
|
|
8910
|
-
|
|
8911
|
-
|
|
8903
|
+
let index = styles.indexOf(token);
|
|
8904
|
+
while (index !== -1) {
|
|
8905
|
+
const start = quasis.range[0] + 1 + index;
|
|
8906
|
+
const end = start + token.length;
|
|
8907
|
+
context.report({
|
|
8908
|
+
loc: { start: context.sourceCode.getLocFromIndex(start), end: context.sourceCode.getLocFromIndex(end) },
|
|
8909
|
+
messageId: "noInvalidTokenPaths",
|
|
8910
|
+
data: { token }
|
|
8911
|
+
});
|
|
8912
|
+
index = styles.indexOf(token, index + 1);
|
|
8913
|
+
}
|
|
8914
|
+
});
|
|
8912
8915
|
}
|
|
8913
8916
|
};
|
|
8914
8917
|
}
|
|
@@ -9232,6 +9235,8 @@ var init_no_unsafe_token_fn_usage = __esm({
|
|
|
9232
9235
|
};
|
|
9233
9236
|
const sendReport = (node, value) => {
|
|
9234
9237
|
const tkImports = extractTokens(value);
|
|
9238
|
+
if (!tkImports.length)
|
|
9239
|
+
return;
|
|
9235
9240
|
const token = tkImports[0].replace(/^[^.]*\./, "");
|
|
9236
9241
|
return context.report({
|
|
9237
9242
|
node,
|