@pandacss/eslint-plugin 0.2.9 → 0.2.10

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.
@@ -3814,6 +3814,125 @@ var import_config = require("@pandacss/config");
3814
3814
  var import_generator = require("@pandacss/generator");
3815
3815
  var import_node = require("@pandacss/node");
3816
3816
  var import_shared = require("@pandacss/shared");
3817
+
3818
+ // ../node_modules/.pnpm/@pandacss+dev@0.40.1_typescript@5.7.3/node_modules/@pandacss/dev/dist/index.mjs
3819
+ function defineConfig(config2) {
3820
+ return config2;
3821
+ }
3822
+
3823
+ // ../sandbox/v9/panda.config.ts
3824
+ var panda_config_default = defineConfig({
3825
+ preflight: true,
3826
+ include: ["./src/**/*.{tsx,jsx}", "./pages/**/*.{jsx,tsx}"],
3827
+ exclude: [],
3828
+ outdir: "styled-system",
3829
+ jsxFactory: "panda",
3830
+ jsxFramework: "react",
3831
+ theme: {
3832
+ extend: {
3833
+ tokens: {
3834
+ colors: {
3835
+ red: {
3836
+ 400: {
3837
+ value: "#ff0000",
3838
+ description: "red color",
3839
+ deprecated: true
3840
+ }
3841
+ }
3842
+ }
3843
+ },
3844
+ semanticTokens: {
3845
+ colors: {
3846
+ text: { value: { base: "{colors.gray.600}", _osDark: "{colors.gray.400}" } },
3847
+ bg: { value: { base: "{colors.gray.600}", _osDark: "{colors.gray.400}" } }
3848
+ }
3849
+ },
3850
+ recipes: {
3851
+ button: {
3852
+ className: "button",
3853
+ jsx: ["Button", "ListedButton", /WithRegex$/, "PrimaryButtonLike"],
3854
+ description: "A button styles",
3855
+ base: {
3856
+ fontSize: "lg"
3857
+ },
3858
+ variants: {
3859
+ size: {
3860
+ sm: {
3861
+ padding: "2",
3862
+ borderRadius: "sm"
3863
+ },
3864
+ md: {
3865
+ padding: "4",
3866
+ borderRadius: "md"
3867
+ }
3868
+ },
3869
+ variant: {
3870
+ primary: {
3871
+ color: "white",
3872
+ backgroundColor: "blue.500"
3873
+ },
3874
+ danger: {
3875
+ color: "white",
3876
+ backgroundColor: "red.500"
3877
+ },
3878
+ secondary: {
3879
+ color: "pink.300",
3880
+ backgroundColor: "green.500"
3881
+ },
3882
+ purple: {
3883
+ color: "amber.300",
3884
+ backgroundColor: "purple.500"
3885
+ }
3886
+ },
3887
+ state: {
3888
+ focused: {
3889
+ color: "green"
3890
+ },
3891
+ hovered: {
3892
+ color: "pink.400"
3893
+ }
3894
+ },
3895
+ rounded: {
3896
+ true: {
3897
+ borderRadius: "md"
3898
+ }
3899
+ }
3900
+ },
3901
+ compoundVariants: [
3902
+ {
3903
+ size: "sm",
3904
+ variant: "primary",
3905
+ css: {
3906
+ fontSize: "12px"
3907
+ }
3908
+ },
3909
+ {
3910
+ variant: ["primary", "danger"],
3911
+ state: "focused",
3912
+ css: {
3913
+ padding: 4,
3914
+ fontWeight: "bold",
3915
+ fontSize: "24px"
3916
+ }
3917
+ }
3918
+ ]
3919
+ }
3920
+ }
3921
+ }
3922
+ },
3923
+ globalCss: {
3924
+ "*": {
3925
+ fontFamily: "Inter",
3926
+ margin: "0"
3927
+ },
3928
+ a: {
3929
+ color: "inherit",
3930
+ textDecoration: "none"
3931
+ }
3932
+ }
3933
+ });
3934
+
3935
+ // ../fixture/src/create-context.ts
3817
3936
  var config = {
3818
3937
  ...fixturePreset,
3819
3938
  optimize: true,
@@ -3833,7 +3952,7 @@ var fixtureDefaults = {
3833
3952
  deserialize: () => (0, import_shared.parseJson)((0, import_shared.stringifyJson)(config))
3834
3953
  };
3835
3954
  var createContext = (userConfig) => {
3836
- const resolvedConfig = userConfig ? (0, import_config.mergeConfigs)([fixtureDefaults.config, userConfig]) : fixtureDefaults.config;
3955
+ const resolvedConfig = (0, import_config.mergeConfigs)([fixtureDefaults.config, panda_config_default, { importMap: "./panda" }]);
3837
3956
  return new import_node.PandaContext({
3838
3957
  ...fixtureDefaults,
3839
3958
  config: resolvedConfig,
@@ -3859,7 +3978,7 @@ async function _getContext(configPath2) {
3859
3978
  async function getContext(opts) {
3860
3979
  if (process.env.NODE_ENV === "test") {
3861
3980
  configPath = opts.configPath;
3862
- const ctx = createContext({ importMap: "./panda" });
3981
+ const ctx = createContext();
3863
3982
  ctx.getFiles = () => ["App.tsx"];
3864
3983
  return ctx;
3865
3984
  } else {
@@ -3873,14 +3992,24 @@ async function getContext(opts) {
3873
3992
  async function filterInvalidTokens(ctx, paths) {
3874
3993
  return paths.filter((path2) => !ctx.utility.tokens.view.get(path2));
3875
3994
  }
3995
+ async function filterDeprecatedTokens(ctx, tokens3) {
3996
+ return tokens3.filter((token) => {
3997
+ const value = typeof token === "string" ? token : token.category + "." + token.value;
3998
+ return ctx.utility.tokens.isDeprecated(value);
3999
+ });
4000
+ }
3876
4001
  async function isColorToken(ctx, value) {
3877
4002
  return !!ctx.utility.tokens.view.categoryMap.get("colors")?.get(value);
3878
4003
  }
3879
- async function isColorAttribute(ctx, _attr) {
4004
+ async function getPropCategory(ctx, _attr) {
3880
4005
  const longhand = await resolveLongHand(ctx, _attr);
3881
4006
  const attr = longhand || _attr;
3882
4007
  const attrConfig = ctx.utility.config[attr];
3883
- return attrConfig?.values === "colors";
4008
+ return typeof attrConfig?.values === "string" ? attrConfig.values : void 0;
4009
+ }
4010
+ async function isColorAttribute(ctx, _attr) {
4011
+ const category = await getPropCategory(ctx, _attr);
4012
+ return category === "colors";
3884
4013
  }
3885
4014
  var arePathsEqual = (path1, path2) => {
3886
4015
  const normalizedPath1 = import_path.default.resolve(path1);
@@ -3941,6 +4070,10 @@ async function runAsync(action, opts, ...args) {
3941
4070
  return isColorToken(ctx, ...args);
3942
4071
  case "filterInvalidTokens":
3943
4072
  return filterInvalidTokens(ctx, ...args);
4073
+ case "getPropCategory":
4074
+ return getPropCategory(ctx, ...args);
4075
+ case "filterDeprecatedTokens":
4076
+ return filterDeprecatedTokens(ctx, ...args);
3944
4077
  }
3945
4078
  }
3946
4079
  function run(action, opts, ...args) {
@@ -3795,6 +3795,129 @@ import { mergeConfigs } from "@pandacss/config";
3795
3795
  import { Generator } from "@pandacss/generator";
3796
3796
  import { PandaContext } from "@pandacss/node";
3797
3797
  import { stringifyJson, parseJson } from "@pandacss/shared";
3798
+
3799
+ // ../sandbox/v9/panda.config.ts
3800
+ init_esm_shims();
3801
+
3802
+ // ../node_modules/.pnpm/@pandacss+dev@0.40.1_typescript@5.7.3/node_modules/@pandacss/dev/dist/index.mjs
3803
+ init_esm_shims();
3804
+ function defineConfig(config2) {
3805
+ return config2;
3806
+ }
3807
+
3808
+ // ../sandbox/v9/panda.config.ts
3809
+ var panda_config_default = defineConfig({
3810
+ preflight: true,
3811
+ include: ["./src/**/*.{tsx,jsx}", "./pages/**/*.{jsx,tsx}"],
3812
+ exclude: [],
3813
+ outdir: "styled-system",
3814
+ jsxFactory: "panda",
3815
+ jsxFramework: "react",
3816
+ theme: {
3817
+ extend: {
3818
+ tokens: {
3819
+ colors: {
3820
+ red: {
3821
+ 400: {
3822
+ value: "#ff0000",
3823
+ description: "red color",
3824
+ deprecated: true
3825
+ }
3826
+ }
3827
+ }
3828
+ },
3829
+ semanticTokens: {
3830
+ colors: {
3831
+ text: { value: { base: "{colors.gray.600}", _osDark: "{colors.gray.400}" } },
3832
+ bg: { value: { base: "{colors.gray.600}", _osDark: "{colors.gray.400}" } }
3833
+ }
3834
+ },
3835
+ recipes: {
3836
+ button: {
3837
+ className: "button",
3838
+ jsx: ["Button", "ListedButton", /WithRegex$/, "PrimaryButtonLike"],
3839
+ description: "A button styles",
3840
+ base: {
3841
+ fontSize: "lg"
3842
+ },
3843
+ variants: {
3844
+ size: {
3845
+ sm: {
3846
+ padding: "2",
3847
+ borderRadius: "sm"
3848
+ },
3849
+ md: {
3850
+ padding: "4",
3851
+ borderRadius: "md"
3852
+ }
3853
+ },
3854
+ variant: {
3855
+ primary: {
3856
+ color: "white",
3857
+ backgroundColor: "blue.500"
3858
+ },
3859
+ danger: {
3860
+ color: "white",
3861
+ backgroundColor: "red.500"
3862
+ },
3863
+ secondary: {
3864
+ color: "pink.300",
3865
+ backgroundColor: "green.500"
3866
+ },
3867
+ purple: {
3868
+ color: "amber.300",
3869
+ backgroundColor: "purple.500"
3870
+ }
3871
+ },
3872
+ state: {
3873
+ focused: {
3874
+ color: "green"
3875
+ },
3876
+ hovered: {
3877
+ color: "pink.400"
3878
+ }
3879
+ },
3880
+ rounded: {
3881
+ true: {
3882
+ borderRadius: "md"
3883
+ }
3884
+ }
3885
+ },
3886
+ compoundVariants: [
3887
+ {
3888
+ size: "sm",
3889
+ variant: "primary",
3890
+ css: {
3891
+ fontSize: "12px"
3892
+ }
3893
+ },
3894
+ {
3895
+ variant: ["primary", "danger"],
3896
+ state: "focused",
3897
+ css: {
3898
+ padding: 4,
3899
+ fontWeight: "bold",
3900
+ fontSize: "24px"
3901
+ }
3902
+ }
3903
+ ]
3904
+ }
3905
+ }
3906
+ }
3907
+ },
3908
+ globalCss: {
3909
+ "*": {
3910
+ fontFamily: "Inter",
3911
+ margin: "0"
3912
+ },
3913
+ a: {
3914
+ color: "inherit",
3915
+ textDecoration: "none"
3916
+ }
3917
+ }
3918
+ });
3919
+
3920
+ // ../fixture/src/create-context.ts
3798
3921
  var config = {
3799
3922
  ...fixturePreset,
3800
3923
  optimize: true,
@@ -3814,7 +3937,7 @@ var fixtureDefaults = {
3814
3937
  deserialize: () => parseJson(stringifyJson(config))
3815
3938
  };
3816
3939
  var createContext = (userConfig) => {
3817
- const resolvedConfig = userConfig ? mergeConfigs([fixtureDefaults.config, userConfig]) : fixtureDefaults.config;
3940
+ const resolvedConfig = mergeConfigs([fixtureDefaults.config, panda_config_default, { importMap: "./panda" }]);
3818
3941
  return new PandaContext({
3819
3942
  ...fixtureDefaults,
3820
3943
  config: resolvedConfig,
@@ -3843,7 +3966,7 @@ async function _getContext(configPath2) {
3843
3966
  async function getContext(opts) {
3844
3967
  if (process.env.NODE_ENV === "test") {
3845
3968
  configPath = opts.configPath;
3846
- const ctx = createContext({ importMap: "./panda" });
3969
+ const ctx = createContext();
3847
3970
  ctx.getFiles = () => ["App.tsx"];
3848
3971
  return ctx;
3849
3972
  } else {
@@ -3857,14 +3980,24 @@ async function getContext(opts) {
3857
3980
  async function filterInvalidTokens(ctx, paths) {
3858
3981
  return paths.filter((path2) => !ctx.utility.tokens.view.get(path2));
3859
3982
  }
3983
+ async function filterDeprecatedTokens(ctx, tokens3) {
3984
+ return tokens3.filter((token) => {
3985
+ const value = typeof token === "string" ? token : token.category + "." + token.value;
3986
+ return ctx.utility.tokens.isDeprecated(value);
3987
+ });
3988
+ }
3860
3989
  async function isColorToken(ctx, value) {
3861
3990
  return !!ctx.utility.tokens.view.categoryMap.get("colors")?.get(value);
3862
3991
  }
3863
- async function isColorAttribute(ctx, _attr) {
3992
+ async function getPropCategory(ctx, _attr) {
3864
3993
  const longhand = await resolveLongHand(ctx, _attr);
3865
3994
  const attr = longhand || _attr;
3866
3995
  const attrConfig = ctx.utility.config[attr];
3867
- return attrConfig?.values === "colors";
3996
+ return typeof attrConfig?.values === "string" ? attrConfig.values : void 0;
3997
+ }
3998
+ async function isColorAttribute(ctx, _attr) {
3999
+ const category = await getPropCategory(ctx, _attr);
4000
+ return category === "colors";
3868
4001
  }
3869
4002
  var arePathsEqual = (path1, path2) => {
3870
4003
  const normalizedPath1 = path.resolve(path1);
@@ -3925,6 +4058,10 @@ async function runAsync(action, opts, ...args) {
3925
4058
  return isColorToken(ctx, ...args);
3926
4059
  case "filterInvalidTokens":
3927
4060
  return filterInvalidTokens(ctx, ...args);
4061
+ case "getPropCategory":
4062
+ return getPropCategory(ctx, ...args);
4063
+ case "filterDeprecatedTokens":
4064
+ return filterDeprecatedTokens(ctx, ...args);
3928
4065
  }
3929
4066
  }
3930
4067
  function run(action, opts, ...args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/eslint-plugin",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Eslint plugin for Panda CSS",
5
5
  "author": "Abraham Aremu <anubra266@gmail.com>",
6
6
  "main": "dist/index.js",