@pandacss/eslint-plugin 0.1.6 → 0.1.7
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 +15 -15
- package/dist/index.mjs +17 -17
- package/dist/utils/worker.js +0 -23
- package/dist/utils/worker.mjs +1 -24
- 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.1.
|
|
7960
|
+
var version = "0.1.7";
|
|
7961
7961
|
|
|
7962
7962
|
// src/configs/all.ts
|
|
7963
7963
|
init_cjs_shims();
|
|
@@ -7979,7 +7979,14 @@ var createRule = import_utils.ESLintUtils.RuleCreator(
|
|
|
7979
7979
|
);
|
|
7980
7980
|
var isBase = process.env.NODE_ENV !== "test" || importMetaUrl.endsWith("dist/index.js");
|
|
7981
7981
|
var distDir = (0, import_node_url.fileURLToPath)(new URL(isBase ? "./" : "../../dist", importMetaUrl));
|
|
7982
|
-
var
|
|
7982
|
+
var _syncAction = (0, import_synckit.createSyncFn)((0, import_node_path.join)(distDir, "utils/worker.mjs"));
|
|
7983
|
+
var syncAction = (...args) => {
|
|
7984
|
+
try {
|
|
7985
|
+
return _syncAction(...args);
|
|
7986
|
+
} catch (error) {
|
|
7987
|
+
return;
|
|
7988
|
+
}
|
|
7989
|
+
};
|
|
7983
7990
|
|
|
7984
7991
|
// src/utils/helpers.ts
|
|
7985
7992
|
init_cjs_shims();
|
|
@@ -8057,11 +8064,7 @@ var _getImports = (context) => {
|
|
|
8057
8064
|
};
|
|
8058
8065
|
var getImports = (context) => {
|
|
8059
8066
|
const imports = _getImports(context);
|
|
8060
|
-
|
|
8061
|
-
return imports.filter((imp) => syncAction("matchImports", getSyncOpts(context), imp));
|
|
8062
|
-
} catch (error) {
|
|
8063
|
-
return [];
|
|
8064
|
-
}
|
|
8067
|
+
return imports.filter((imp) => syncAction("matchImports", getSyncOpts(context), imp));
|
|
8065
8068
|
};
|
|
8066
8069
|
var isValidStyledProp = (node, context) => {
|
|
8067
8070
|
if (typeof node === "string")
|
|
@@ -8120,7 +8123,7 @@ var isPandaProp = (node, context) => {
|
|
|
8120
8123
|
return;
|
|
8121
8124
|
return true;
|
|
8122
8125
|
};
|
|
8123
|
-
var
|
|
8126
|
+
var isStyledProperty = (node, context, calleeName) => {
|
|
8124
8127
|
if (!isIdentifier(node.key) && !isLiteral(node.key) && !isTemplateLiteral(node.key))
|
|
8125
8128
|
return;
|
|
8126
8129
|
if (isIdentifier(node.key) && !isValidProperty(node.key.name, context, calleeName))
|
|
@@ -8131,13 +8134,6 @@ var isStyledNode = (node, context, calleeName) => {
|
|
|
8131
8134
|
return;
|
|
8132
8135
|
return true;
|
|
8133
8136
|
};
|
|
8134
|
-
var isStyledProperty = (node, context, calleeName) => {
|
|
8135
|
-
const ancestor = node.parent.parent;
|
|
8136
|
-
const isValidFuncAncestor = isCallExpression(ancestor) && isIdentifier(ancestor.callee) && isPandaIsh(ancestor.callee.name, context);
|
|
8137
|
-
if (isValidFuncAncestor)
|
|
8138
|
-
return isStyledNode(node, context, calleeName);
|
|
8139
|
-
return isStyledNode(ancestor, context, calleeName) && isStyledNode(node, context, calleeName);
|
|
8140
|
-
};
|
|
8141
8137
|
var isInPandaFunction = (node, context) => {
|
|
8142
8138
|
const callAncestor = getAncestor(isCallExpression, node);
|
|
8143
8139
|
if (!callAncestor)
|
|
@@ -8810,6 +8806,8 @@ var rule9 = createRule({
|
|
|
8810
8806
|
const sendReport = (node, _value) => {
|
|
8811
8807
|
const value = _value ?? node.value?.toString();
|
|
8812
8808
|
const tokens = getInvalidTokens(value, context);
|
|
8809
|
+
if (!tokens)
|
|
8810
|
+
return;
|
|
8813
8811
|
if (tokens.length > 0) {
|
|
8814
8812
|
tokens.forEach((token) => {
|
|
8815
8813
|
context.report({
|
|
@@ -8851,6 +8849,8 @@ var rule9 = createRule({
|
|
|
8851
8849
|
const quasis = node.quasi.quasis[0];
|
|
8852
8850
|
const styles = quasis.value.raw;
|
|
8853
8851
|
const tokens = getInvalidTokens(styles, context);
|
|
8852
|
+
if (!tokens)
|
|
8853
|
+
return;
|
|
8854
8854
|
tokens.forEach((token, i, arr) => {
|
|
8855
8855
|
if (arr.indexOf(token) < i)
|
|
8856
8856
|
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.1.
|
|
13
|
+
version = "0.1.7";
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
|
|
@@ -19,7 +19,7 @@ import { ESLintUtils } from "@typescript-eslint/utils";
|
|
|
19
19
|
import { createSyncFn } from "synckit";
|
|
20
20
|
import { join } from "node:path";
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
|
-
var createRule, isBase, distDir, syncAction;
|
|
22
|
+
var createRule, isBase, distDir, _syncAction, syncAction;
|
|
23
23
|
var init_utils = __esm({
|
|
24
24
|
"src/utils/index.ts"() {
|
|
25
25
|
"use strict";
|
|
@@ -29,7 +29,14 @@ var init_utils = __esm({
|
|
|
29
29
|
);
|
|
30
30
|
isBase = process.env.NODE_ENV !== "test" || import.meta.url.endsWith("dist/index.js");
|
|
31
31
|
distDir = fileURLToPath(new URL(isBase ? "./" : "../../dist", import.meta.url));
|
|
32
|
-
|
|
32
|
+
_syncAction = createSyncFn(join(distDir, "utils/worker.mjs"));
|
|
33
|
+
syncAction = (...args) => {
|
|
34
|
+
try {
|
|
35
|
+
return _syncAction(...args);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
33
40
|
}
|
|
34
41
|
});
|
|
35
42
|
|
|
@@ -7975,7 +7982,7 @@ var init_nodes = __esm({
|
|
|
7975
7982
|
});
|
|
7976
7983
|
|
|
7977
7984
|
// src/utils/helpers.ts
|
|
7978
|
-
var import_scope_manager, getAncestor, getSyncOpts, getImportSpecifiers, hasPkgImport, isPandaConfigFunction, _getImports, getImports, isValidStyledProp, isPandaIsh, findDeclaration, isLocalStyledFactory, isValidFile, isValidProperty, isPandaImport, isPandaProp,
|
|
7985
|
+
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
7986
|
var init_helpers = __esm({
|
|
7980
7987
|
"src/utils/helpers.ts"() {
|
|
7981
7988
|
"use strict";
|
|
@@ -8033,11 +8040,7 @@ var init_helpers = __esm({
|
|
|
8033
8040
|
};
|
|
8034
8041
|
getImports = (context) => {
|
|
8035
8042
|
const imports = _getImports(context);
|
|
8036
|
-
|
|
8037
|
-
return imports.filter((imp) => syncAction("matchImports", getSyncOpts(context), imp));
|
|
8038
|
-
} catch (error) {
|
|
8039
|
-
return [];
|
|
8040
|
-
}
|
|
8043
|
+
return imports.filter((imp) => syncAction("matchImports", getSyncOpts(context), imp));
|
|
8041
8044
|
};
|
|
8042
8045
|
isValidStyledProp = (node, context) => {
|
|
8043
8046
|
if (typeof node === "string")
|
|
@@ -8096,7 +8099,7 @@ var init_helpers = __esm({
|
|
|
8096
8099
|
return;
|
|
8097
8100
|
return true;
|
|
8098
8101
|
};
|
|
8099
|
-
|
|
8102
|
+
isStyledProperty = (node, context, calleeName) => {
|
|
8100
8103
|
if (!isIdentifier(node.key) && !isLiteral(node.key) && !isTemplateLiteral(node.key))
|
|
8101
8104
|
return;
|
|
8102
8105
|
if (isIdentifier(node.key) && !isValidProperty(node.key.name, context, calleeName))
|
|
@@ -8107,13 +8110,6 @@ var init_helpers = __esm({
|
|
|
8107
8110
|
return;
|
|
8108
8111
|
return true;
|
|
8109
8112
|
};
|
|
8110
|
-
isStyledProperty = (node, context, calleeName) => {
|
|
8111
|
-
const ancestor = node.parent.parent;
|
|
8112
|
-
const isValidFuncAncestor = isCallExpression(ancestor) && isIdentifier(ancestor.callee) && isPandaIsh(ancestor.callee.name, context);
|
|
8113
|
-
if (isValidFuncAncestor)
|
|
8114
|
-
return isStyledNode(node, context, calleeName);
|
|
8115
|
-
return isStyledNode(ancestor, context, calleeName) && isStyledNode(node, context, calleeName);
|
|
8116
|
-
};
|
|
8117
8113
|
isInPandaFunction = (node, context) => {
|
|
8118
8114
|
const callAncestor = getAncestor(isCallExpression, node);
|
|
8119
8115
|
if (!callAncestor)
|
|
@@ -8867,6 +8863,8 @@ var init_no_invalid_token_paths = __esm({
|
|
|
8867
8863
|
const sendReport = (node, _value) => {
|
|
8868
8864
|
const value = _value ?? node.value?.toString();
|
|
8869
8865
|
const tokens = getInvalidTokens(value, context);
|
|
8866
|
+
if (!tokens)
|
|
8867
|
+
return;
|
|
8870
8868
|
if (tokens.length > 0) {
|
|
8871
8869
|
tokens.forEach((token) => {
|
|
8872
8870
|
context.report({
|
|
@@ -8908,6 +8906,8 @@ var init_no_invalid_token_paths = __esm({
|
|
|
8908
8906
|
const quasis = node.quasi.quasis[0];
|
|
8909
8907
|
const styles = quasis.value.raw;
|
|
8910
8908
|
const tokens = getInvalidTokens(styles, context);
|
|
8909
|
+
if (!tokens)
|
|
8910
|
+
return;
|
|
8911
8911
|
tokens.forEach((token, i, arr) => {
|
|
8912
8912
|
if (arr.indexOf(token) < i)
|
|
8913
8913
|
return;
|
package/dist/utils/worker.js
CHANGED
|
@@ -3869,27 +3869,6 @@ async function getContext(opts) {
|
|
|
3869
3869
|
return await promise;
|
|
3870
3870
|
}
|
|
3871
3871
|
}
|
|
3872
|
-
async function getExtendWarnings() {
|
|
3873
|
-
if (!configPath)
|
|
3874
|
-
return [];
|
|
3875
|
-
const cwd = import_path.default.dirname(configPath);
|
|
3876
|
-
const { config: config2 } = await (0, import_config3.bundleConfig)({ cwd, file: configPath });
|
|
3877
|
-
if (!config2.presets || config2.presets.length === 0)
|
|
3878
|
-
return [];
|
|
3879
|
-
if (config2.eject)
|
|
3880
|
-
return [];
|
|
3881
|
-
const warnings = /* @__PURE__ */ new Set();
|
|
3882
|
-
if (config2.theme && !config2.theme.extend) {
|
|
3883
|
-
warnings.add("theme");
|
|
3884
|
-
}
|
|
3885
|
-
if (config2.conditions && !config2.conditions.extend) {
|
|
3886
|
-
warnings.add("conditions");
|
|
3887
|
-
}
|
|
3888
|
-
if (config2.patterns && !config2.patterns.extend) {
|
|
3889
|
-
warnings.add("patterns");
|
|
3890
|
-
}
|
|
3891
|
-
return Array.from(warnings);
|
|
3892
|
-
}
|
|
3893
3872
|
async function filterInvalidTokens(ctx, paths) {
|
|
3894
3873
|
return paths.filter((path2) => !ctx.utility.tokens.view.get(path2));
|
|
3895
3874
|
}
|
|
@@ -3970,8 +3949,6 @@ async function runAsync(action, opts, ...args) {
|
|
|
3970
3949
|
return isColorToken(ctx, ...args);
|
|
3971
3950
|
case "filterInvalidTokens":
|
|
3972
3951
|
return filterInvalidTokens(ctx, ...args);
|
|
3973
|
-
case "getExtendWarnings":
|
|
3974
|
-
return getExtendWarnings();
|
|
3975
3952
|
}
|
|
3976
3953
|
}
|
|
3977
3954
|
function run(action, opts, ...args) {
|
package/dist/utils/worker.mjs
CHANGED
|
@@ -3830,7 +3830,7 @@ init_esm_shims();
|
|
|
3830
3830
|
|
|
3831
3831
|
// src/utils/worker.ts
|
|
3832
3832
|
import { resolveTsPathPattern } from "@pandacss/config/ts-path";
|
|
3833
|
-
import { findConfig
|
|
3833
|
+
import { findConfig } from "@pandacss/config";
|
|
3834
3834
|
import path from "path";
|
|
3835
3835
|
var promise;
|
|
3836
3836
|
var configPath;
|
|
@@ -3853,27 +3853,6 @@ async function getContext(opts) {
|
|
|
3853
3853
|
return await promise;
|
|
3854
3854
|
}
|
|
3855
3855
|
}
|
|
3856
|
-
async function getExtendWarnings() {
|
|
3857
|
-
if (!configPath)
|
|
3858
|
-
return [];
|
|
3859
|
-
const cwd = path.dirname(configPath);
|
|
3860
|
-
const { config: config2 } = await bundleConfig({ cwd, file: configPath });
|
|
3861
|
-
if (!config2.presets || config2.presets.length === 0)
|
|
3862
|
-
return [];
|
|
3863
|
-
if (config2.eject)
|
|
3864
|
-
return [];
|
|
3865
|
-
const warnings = /* @__PURE__ */ new Set();
|
|
3866
|
-
if (config2.theme && !config2.theme.extend) {
|
|
3867
|
-
warnings.add("theme");
|
|
3868
|
-
}
|
|
3869
|
-
if (config2.conditions && !config2.conditions.extend) {
|
|
3870
|
-
warnings.add("conditions");
|
|
3871
|
-
}
|
|
3872
|
-
if (config2.patterns && !config2.patterns.extend) {
|
|
3873
|
-
warnings.add("patterns");
|
|
3874
|
-
}
|
|
3875
|
-
return Array.from(warnings);
|
|
3876
|
-
}
|
|
3877
3856
|
async function filterInvalidTokens(ctx, paths) {
|
|
3878
3857
|
return paths.filter((path2) => !ctx.utility.tokens.view.get(path2));
|
|
3879
3858
|
}
|
|
@@ -3954,8 +3933,6 @@ async function runAsync(action, opts, ...args) {
|
|
|
3954
3933
|
return isColorToken(ctx, ...args);
|
|
3955
3934
|
case "filterInvalidTokens":
|
|
3956
3935
|
return filterInvalidTokens(ctx, ...args);
|
|
3957
|
-
case "getExtendWarnings":
|
|
3958
|
-
return getExtendWarnings();
|
|
3959
3936
|
}
|
|
3960
3937
|
}
|
|
3961
3938
|
function run(action, opts, ...args) {
|