@pandacss/eslint-plugin 0.1.1 → 0.1.3

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.
@@ -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.1_postcss@8.4.34_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js
30
+ // ../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../node_modules/.pnpm/tsup@8.0.1_postcss@8.4.34_typescript@5.3.3/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.5/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.1_postcss@8.4.34_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js
31
+ // ../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.5/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.1_postcss@8.4.34_typescript@5.3.3/node_modules/tsup/assets/cjs_shims.js"() {
34
+ "../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.5/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.1.1";
7960
+ var version = "0.1.3";
7961
7961
 
7962
7962
  // src/configs/all.ts
7963
7963
  init_cjs_shims();
@@ -8038,29 +8038,21 @@ var getImportSpecifiers = (context) => {
8038
8038
  });
8039
8039
  return specifiers;
8040
8040
  };
8041
+ var hasPkgImport = (context) => {
8042
+ const imports = _getImports(context);
8043
+ return imports.some(({ mod }) => mod === "@pandacss/dev");
8044
+ };
8045
+ var isPandaConfigFunction = (context, name2) => {
8046
+ const imports = _getImports(context);
8047
+ return imports.some(({ alias, mod }) => alias === name2 && mod === "@pandacss/dev");
8048
+ };
8041
8049
  var _getImports = (context) => {
8042
8050
  const specifiers = getImportSpecifiers(context);
8043
- specifiers.map(({ specifier, mod }) => ({
8051
+ const imports = specifiers.map(({ specifier, mod }) => ({
8044
8052
  name: specifier.imported.name,
8045
8053
  alias: specifier.local.name,
8046
8054
  mod
8047
8055
  }));
8048
- const imports = [];
8049
- context.sourceCode.ast.body.forEach((node) => {
8050
- if (!isImportDeclaration(node))
8051
- return;
8052
- const mod = node.source.value;
8053
- if (!mod)
8054
- return;
8055
- node.specifiers.forEach((specifier) => {
8056
- if (!isImportSpecifier(specifier))
8057
- return;
8058
- const name2 = specifier.imported.name;
8059
- const alias = specifier.local.name;
8060
- const result = { name: name2, alias, mod };
8061
- imports.push(result);
8062
- });
8063
- });
8064
8056
  return imports;
8065
8057
  };
8066
8058
  var getImports = (context) => {
@@ -8074,6 +8066,8 @@ var isValidStyledProp = (node, context) => {
8074
8066
  };
8075
8067
  var isPandaIsh = (name2, context) => {
8076
8068
  const imports = getImports(context);
8069
+ if (imports.length === 0)
8070
+ return false;
8077
8071
  return syncAction("matchFile", getSyncOpts(context), name2, imports);
8078
8072
  };
8079
8073
  var findDeclaration = (name2, context) => {
@@ -8263,6 +8257,8 @@ var rule2 = createRule({
8263
8257
  },
8264
8258
  defaultOptions: [],
8265
8259
  create(context) {
8260
+ if (!hasPkgImport(context))
8261
+ return {};
8266
8262
  return {
8267
8263
  CallExpression(node) {
8268
8264
  if (!isValidFile(context))
@@ -8271,6 +8267,8 @@ var rule2 = createRule({
8271
8267
  return;
8272
8268
  if (!CONFIG_FUNCTIONS.includes(node.callee.name))
8273
8269
  return;
8270
+ if (!isPandaConfigFunction(context, node.callee.name))
8271
+ return;
8274
8272
  context.report({
8275
8273
  node,
8276
8274
  messageId: "configFunction",
package/dist/index.mjs CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  __esm,
4
4
  __toESM,
5
5
  init_esm_shims
6
- } from "./chunk-HALLAYDZ.mjs";
6
+ } from "./chunk-65XWD4AU.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.1.1";
13
+ version = "0.1.3";
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, _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;
7979
7979
  var init_helpers = __esm({
7980
7980
  "src/utils/helpers.ts"() {
7981
7981
  "use strict";
@@ -8014,29 +8014,21 @@ var init_helpers = __esm({
8014
8014
  });
8015
8015
  return specifiers;
8016
8016
  };
8017
+ hasPkgImport = (context) => {
8018
+ const imports = _getImports(context);
8019
+ return imports.some(({ mod }) => mod === "@pandacss/dev");
8020
+ };
8021
+ isPandaConfigFunction = (context, name2) => {
8022
+ const imports = _getImports(context);
8023
+ return imports.some(({ alias, mod }) => alias === name2 && mod === "@pandacss/dev");
8024
+ };
8017
8025
  _getImports = (context) => {
8018
8026
  const specifiers = getImportSpecifiers(context);
8019
- specifiers.map(({ specifier, mod }) => ({
8027
+ const imports = specifiers.map(({ specifier, mod }) => ({
8020
8028
  name: specifier.imported.name,
8021
8029
  alias: specifier.local.name,
8022
8030
  mod
8023
8031
  }));
8024
- const imports = [];
8025
- context.sourceCode.ast.body.forEach((node) => {
8026
- if (!isImportDeclaration(node))
8027
- return;
8028
- const mod = node.source.value;
8029
- if (!mod)
8030
- return;
8031
- node.specifiers.forEach((specifier) => {
8032
- if (!isImportSpecifier(specifier))
8033
- return;
8034
- const name2 = specifier.imported.name;
8035
- const alias = specifier.local.name;
8036
- const result = { name: name2, alias, mod };
8037
- imports.push(result);
8038
- });
8039
- });
8040
8032
  return imports;
8041
8033
  };
8042
8034
  getImports = (context) => {
@@ -8050,6 +8042,8 @@ var init_helpers = __esm({
8050
8042
  };
8051
8043
  isPandaIsh = (name2, context) => {
8052
8044
  const imports = getImports(context);
8045
+ if (imports.length === 0)
8046
+ return false;
8053
8047
  return syncAction("matchFile", getSyncOpts(context), name2, imports);
8054
8048
  };
8055
8049
  findDeclaration = (name2, context) => {
@@ -8257,6 +8251,8 @@ var init_no_config_function_in_source = __esm({
8257
8251
  },
8258
8252
  defaultOptions: [],
8259
8253
  create(context) {
8254
+ if (!hasPkgImport(context))
8255
+ return {};
8260
8256
  return {
8261
8257
  CallExpression(node) {
8262
8258
  if (!isValidFile(context))
@@ -8265,6 +8261,8 @@ var init_no_config_function_in_source = __esm({
8265
8261
  return;
8266
8262
  if (!CONFIG_FUNCTIONS.includes(node.callee.name))
8267
8263
  return;
8264
+ if (!isPandaConfigFunction(context, node.callee.name))
8265
+ return;
8268
8266
  context.report({
8269
8267
  node,
8270
8268
  messageId: "configFunction",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "../chunk-HALLAYDZ.mjs";
3
+ } from "../chunk-65XWD4AU.mjs";
4
4
 
5
5
  // src/utils/worker.ts
6
6
  init_esm_shims();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/eslint-plugin",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Eslint plugin for Panda CSS",
5
5
  "author": "Abraham Aremu <anubra266@gmail.com>",
6
6
  "main": "dist/index.js",