@pandacss/eslint-plugin 2.0.0-beta.8 → 2.0.0-beta.9

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/README.md CHANGED
@@ -147,6 +147,8 @@ The rest are off by default. Turn them on per project:
147
147
  - `consistent-property-style` — enforce one property style: Panda shorthand aliases (`ml`) or longhand canonical names
148
148
  (`marginLeft`). Autofixable. Takes `style: 'shorthand' | 'longhand'` (default `longhand`) and `ignore`.
149
149
  - `prefer-text-style` — a style object setting two or more typography properties that should be one `textStyle` token.
150
+ - `no-primitive-token` — a primitive/core token where a semantic token exists for that category. Takes `categories` and
151
+ `allow`.
150
152
 
151
153
  Enable an opt-in rule like any other:
152
154
 
@@ -190,6 +192,17 @@ Quick-fixes apply to each offending leaf — flat literals (`color: '#f00'`), va
190
192
  (`color: { base: '#f00' }`), and responsive-array elements (`color: ['#f00', ...]`). Coverage spans `css()`, style
191
193
  props, and recipe styles in `cva()` / `sva()` / `styled('div', { ... })` (`base`, `variants`, `compoundVariants`).
192
194
 
195
+ `no-primitive-token` takes `categories` (which token categories to enforce; defaults to categories with semantic tokens)
196
+ and `allow` (primitive token paths to permit):
197
+
198
+ ```js
199
+ { rules: { '@pandacss/no-primitive-token': ['error', { categories: ['colors'], allow: ['red.500'] }] } }
200
+ ```
201
+
202
+ This complements `prefer-token`: `prefer-token` maps hardcoded CSS values to tokens; `no-primitive-token` maps primitive
203
+ tokens to semantic tokens. Categories without semantic tokens are skipped, so spacing primitives are allowed unless you
204
+ define semantic spacing tokens.
205
+
193
206
  ### Migrating from `no-hardcoded-color`
194
207
 
195
208
  `no-hardcoded-color` is now `prefer-token` scoped to colors. Replace it with:
@@ -174,65 +174,21 @@ function reportToken(context, token, range) {
174
174
  }
175
175
 
176
176
  // src/core/inspector.ts
177
- var Inspector = class {
178
- #entries = /* @__PURE__ */ new WeakMap();
179
- inspect(compiler, path, source) {
180
- let byPath = this.#entries.get(compiler);
181
- if (!byPath) {
182
- byPath = /* @__PURE__ */ new Map();
183
- this.#entries.set(compiler, byPath);
184
- }
185
- const sourceKey = sourceCacheKey(source);
186
- const cached = byPath.get(path);
187
- if (cached?.sourceKey === sourceKey) return cached.result;
188
- const result = compiler.inspectFile({ path, source });
189
- byPath.set(path, { sourceKey, result });
190
- return result;
191
- }
192
- clear(compiler) {
193
- if (compiler) {
194
- this.#entries.delete(compiler);
195
- return;
196
- }
197
- this.#entries = /* @__PURE__ */ new WeakMap();
198
- }
199
- };
200
- function sourceCacheKey(source) {
201
- let hash = 2166136261;
202
- for (let i = 0; i < source.length; i++) {
203
- hash ^= source.charCodeAt(i);
204
- hash = Math.imul(hash, 16777619);
205
- }
206
- return `${source.length}:${hash >>> 0}`;
207
- }
177
+ import { FileInspector, sourceCacheKey } from "@pandacss/compiler/tooling";
208
178
 
209
179
  // src/core/project-cache.ts
210
- import { createCompilerFromSnapshot } from "@pandacss/compiler";
211
- import { loadConfig } from "@pandacss/config";
180
+ import { createProjectFromConfig } from "@pandacss/compiler/tooling";
212
181
  var ProjectCache = class {
213
182
  #projects = /* @__PURE__ */ new Map();
214
- #load;
215
- #createCompiler;
183
+ #createProject;
216
184
  constructor(options = {}) {
217
- this.#load = options.load ?? ((settings) => loadConfig({
218
- cwd: settings.cwd,
219
- ...settings.configPath ? { file: settings.configPath } : {}
220
- }));
221
- this.#createCompiler = options.createCompiler ?? createCompilerFromSnapshot;
185
+ this.#createProject = options.createProject ?? ((settings) => createProjectFromConfig({ cwd: settings.cwd, configPath: settings.configPath }));
222
186
  }
223
187
  get(settings) {
224
188
  const key = projectCacheKey(settings);
225
189
  const cached = this.#projects.get(key);
226
190
  if (cached) return cached;
227
- const project = this.#load(settings).then((result) => ({
228
- compiler: this.#createCompiler({
229
- config: result.config,
230
- callbacks: result.callbacks,
231
- ...result.hooks ? { hooks: result.hooks } : {}
232
- }),
233
- configPath: result.path,
234
- dependencies: result.dependencies
235
- }));
191
+ const project = this.#createProject(settings);
236
192
  this.#projects.set(key, project);
237
193
  return project;
238
194
  }
@@ -268,7 +224,7 @@ var Linter = class {
268
224
  #inspector;
269
225
  constructor(options = {}) {
270
226
  this.#projectCache = options.projectCache ?? new ProjectCache();
271
- this.#inspector = options.inspector ?? new Inspector();
227
+ this.#inspector = options.inspector ?? new FileInspector();
272
228
  }
273
229
  getProject(context) {
274
230
  return this.#projectCache.get(resolvePandaSettings(context));
@@ -558,6 +514,141 @@ function createNoInvalidNestingRule(options) {
558
514
  };
559
515
  }
560
516
 
517
+ // src/rules/no-primitive-token.ts
518
+ var noPrimitiveTokenRuleName = "no-primitive-token";
519
+ var MAX_SUGGESTIONS = 3;
520
+ function isAllowed(token, allow) {
521
+ if (allow.size === 0) return false;
522
+ return allow.has(token.path) || allow.has(token.categoryPath);
523
+ }
524
+ function modifierSuffix(token, sourcePath) {
525
+ if (sourcePath?.startsWith(`${token.path}/`)) return sourcePath.slice(token.path.length);
526
+ return token.modifier ? `/${token.modifier}` : "";
527
+ }
528
+ function shouldReport(token, config) {
529
+ if (token.semantic || !token.semanticCategory) return false;
530
+ if (config.categories && !config.categories.has(token.category)) return false;
531
+ return !isAllowed(token, config.allow);
532
+ }
533
+ function replacementForRange(source, range, value) {
534
+ const current = source.slice(range[0], range[1]);
535
+ const quote = current[0];
536
+ return quote === '"' || quote === "'" || quote === "`" ? `${quote}${value}${quote}` : value;
537
+ }
538
+ function tokenRefFixRange(source, span, token) {
539
+ const outerStart = byteToIndex(source, span.start);
540
+ const outerEnd = byteToIndex(source, span.end);
541
+ const text = source.slice(outerStart, outerEnd);
542
+ for (const quote of ["'", '"', "`"]) {
543
+ const needle = `${quote}${token}${quote}`;
544
+ const index2 = text.indexOf(needle);
545
+ if (index2 >= 0) return [outerStart + index2, outerStart + index2 + needle.length];
546
+ }
547
+ const index = text.indexOf(token);
548
+ return index >= 0 ? [outerStart + index, outerStart + index + token.length] : void 0;
549
+ }
550
+ function tokenRefSourcePath(source, span, path) {
551
+ const outerStart = byteToIndex(source, span.start);
552
+ const outerEnd = byteToIndex(source, span.end);
553
+ const text = source.slice(outerStart, outerEnd);
554
+ const index = text.indexOf(path);
555
+ if (index < 0) return path;
556
+ let end = index + path.length;
557
+ if (text[end] === "/") {
558
+ end += 1;
559
+ while (end < text.length && !["'", '"', "`", ",", ")", " ", "\n", "\r", " "].includes(text[end])) end += 1;
560
+ }
561
+ return text.slice(index, end);
562
+ }
563
+ function reportPrimitiveToken(context, source, config, token, loc, fixRange, replacementPath, sourcePath) {
564
+ if (!shouldReport(token, config)) return;
565
+ const suffix = modifierSuffix(token, sourcePath);
566
+ const suggestions = config.suggestSemanticTokens(token.path).slice(0, MAX_SUGGESTIONS);
567
+ const descriptor = {
568
+ messageId: "primitive",
569
+ data: { category: token.category, token: token.categoryPath },
570
+ loc: toEslintLoc(loc)
571
+ };
572
+ if (source && fixRange && suggestions.length > 0) {
573
+ descriptor.suggest = suggestions.map((suggestion) => {
574
+ const replacement = replacementPath(suggestion, suffix);
575
+ return {
576
+ desc: `Use the semantic token "${replacement}"`,
577
+ fix: (fixer) => fixer.replaceTextRange(fixRange, replacementForRange(source, fixRange, replacement))
578
+ };
579
+ });
580
+ }
581
+ context.report(descriptor);
582
+ }
583
+ function reportStyleEntries(context, inspection, config, source) {
584
+ for (const entry of inspection.styleEntries) {
585
+ if (entry.kind !== "utility") continue;
586
+ for (const leaf of entry.valueSpans ?? []) {
587
+ if (!leaf.token) continue;
588
+ const fixRange = source ? [byteToIndex(source, leaf.span.start), byteToIndex(source, leaf.span.end)] : void 0;
589
+ reportPrimitiveToken(context, source, config, leaf.token, entry.range, fixRange, (suggestion, suffix) => {
590
+ return `${suggestion.token}${suffix}`;
591
+ });
592
+ }
593
+ }
594
+ }
595
+ function reportTokenRefs(context, inspection, config, source) {
596
+ for (const tokenRef of inspection.tokenRefs) {
597
+ if (!tokenRef.resolved || !tokenRef.token) continue;
598
+ const sourcePath = source ? tokenRefSourcePath(source, tokenRef.span, tokenRef.path) : tokenRef.path;
599
+ const fixRange = source ? tokenRefFixRange(source, tokenRef.span, sourcePath) : void 0;
600
+ reportPrimitiveToken(
601
+ context,
602
+ source,
603
+ config,
604
+ tokenRef.token,
605
+ tokenRef.range,
606
+ fixRange,
607
+ (suggestion, suffix) => `${tokenRef.token?.category}.${suggestion.token}${suffix}`,
608
+ sourcePath
609
+ );
610
+ }
611
+ }
612
+ function reportPrimitiveTokenViolations(context, inspection, config) {
613
+ const source = getSourceText(context);
614
+ reportStyleEntries(context, inspection, config, source);
615
+ reportTokenRefs(context, inspection, config, source);
616
+ }
617
+ function createNoPrimitiveTokenRule(options) {
618
+ return {
619
+ meta: {
620
+ type: "suggestion",
621
+ docs: { description: "Prefer semantic tokens over primitive tokens when semantic tokens exist for a category." },
622
+ schema: [
623
+ {
624
+ type: "object",
625
+ properties: {
626
+ categories: { type: "array", items: { type: "string" }, uniqueItems: true },
627
+ allow: { type: "array", items: { type: "string" }, uniqueItems: true }
628
+ },
629
+ additionalProperties: false
630
+ }
631
+ ],
632
+ messages: {
633
+ primitive: 'Use a semantic {{category}} token instead of the primitive token "{{token}}".'
634
+ },
635
+ hasSuggestions: true
636
+ },
637
+ create(context) {
638
+ const configured = context.options?.[0];
639
+ const categories = configured?.categories ? new Set(configured.categories) : void 0;
640
+ const allow = new Set(configured?.allow ?? []);
641
+ return {
642
+ Program() {
643
+ const inspection = options.inspect(context);
644
+ if (!inspection) return;
645
+ reportPrimitiveTokenViolations(context, inspection, { ...options, categories, allow });
646
+ }
647
+ };
648
+ }
649
+ };
650
+ }
651
+
561
652
  // src/rules/no-margin-properties.ts
562
653
  var noMarginPropertiesRuleName = "no-margin-properties";
563
654
  var MESSAGE4 = "Avoid margin properties; prefer `gap` or a layout pattern for spacing.";
@@ -947,10 +1038,13 @@ function createPreferTextStyleRule(options) {
947
1038
  };
948
1039
  }
949
1040
 
1041
+ // src/plugin.ts
1042
+ import { SpecIndex } from "@pandacss/compiler/tooling";
1043
+
950
1044
  // package.json
951
1045
  var package_default = {
952
1046
  name: "@pandacss/eslint-plugin",
953
- version: "2.0.0-beta.8",
1047
+ version: "2.0.0-beta.9",
954
1048
  description: "ESLint rules for Panda CSS",
955
1049
  keywords: [
956
1050
  "eslint",
@@ -1025,17 +1119,6 @@ async function loadPandaProject(options = {}) {
1025
1119
  });
1026
1120
  return { linter, project };
1027
1121
  }
1028
- function tokenCategoryByProperty(spec) {
1029
- const map = /* @__PURE__ */ new Map();
1030
- for (const [name, property] of Object.entries(spec.utilities.properties)) {
1031
- if (property.tokenCategory) map.set(name, property.tokenCategory);
1032
- }
1033
- for (const [shorthand, canonical] of Object.entries(spec.utilities.shorthands)) {
1034
- const category = map.get(canonical);
1035
- if (category) map.set(shorthand, category);
1036
- }
1037
- return map;
1038
- }
1039
1122
  var RAW_VALUE_KEYWORDS = /* @__PURE__ */ new Set([
1040
1123
  "inherit",
1041
1124
  "initial",
@@ -1081,10 +1164,11 @@ function patternDeprecations(spec) {
1081
1164
  }
1082
1165
  function bindRules(linter, project) {
1083
1166
  const spec = project.compiler.spec();
1084
- const categoryByProperty = tokenCategoryByProperty(spec);
1085
- const categoryOf = (prop) => categoryByProperty.get(prop);
1167
+ const specIndex = new SpecIndex(spec);
1168
+ const categoryOf = (prop) => specIndex.resolveTokenCategoryForProperty(prop);
1086
1169
  const isHardcodedValue = hardcodedValueClassifier(project.compiler);
1087
1170
  const suggest = (prop, value) => project.compiler.suggestTokens(prop, value);
1171
+ const suggestSemanticTokens = (path) => project.compiler.suggestSemanticTokens(path);
1088
1172
  const inspect = (context) => linter.inspectProject(project, getContextFilename(context), getContextSource(context));
1089
1173
  const rules = {
1090
1174
  [extractionDiagnosticsRuleName]: createExtractionDiagnosticsRule({ inspect }),
@@ -1104,6 +1188,7 @@ function bindRules(linter, project) {
1104
1188
  [noDebugRuleName]: createNoDebugRule({ inspect }),
1105
1189
  // `recommended` scopes prefer-token to colors (the old `no-hardcoded-color`).
1106
1190
  [preferTokenRuleName]: createPreferTokenRule({ inspect, categoryOf, isHardcodedValue, suggest }),
1191
+ [noPrimitiveTokenRuleName]: createNoPrimitiveTokenRule({ inspect, suggestSemanticTokens }),
1107
1192
  // Opt-in style/enforcement rules (not in `recommended`).
1108
1193
  [noImportantRuleName]: createNoImportantRule({ inspect }),
1109
1194
  [noMarginPropertiesRuleName]: createNoMarginPropertiesRule({ inspect }),
@@ -1136,7 +1221,7 @@ export {
1136
1221
  reportDiagnostics,
1137
1222
  noInvalidTokenPathsRuleName,
1138
1223
  createNoInvalidTokenPathsRule,
1139
- Inspector,
1224
+ FileInspector,
1140
1225
  sourceCacheKey,
1141
1226
  ProjectCache,
1142
1227
  projectCacheKey,
@@ -1154,6 +1239,9 @@ export {
1154
1239
  createNoImportantRule,
1155
1240
  noInvalidNestingRuleName,
1156
1241
  createNoInvalidNestingRule,
1242
+ noPrimitiveTokenRuleName,
1243
+ reportPrimitiveTokenViolations,
1244
+ createNoPrimitiveTokenRule,
1157
1245
  noMarginPropertiesRuleName,
1158
1246
  createNoMarginPropertiesRule,
1159
1247
  noPhysicalPropertiesRuleName,
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { L as Linter, P as ProjectContext, R as RuleModuleLike, I as Inspect, a as RuleContextWithReport } from './shared-B-c4H6nv.js';
2
- export { b as InspectionCacheEntry, c as Inspector, e as LintInspection, d as LintRuleContextLike, f as LinterOptions, k as PandaLintSettings, j as ProjectCache, i as ProjectCacheOptions, o as ReportDescriptor, l as RuleContextLike, m as RuleFixer, S as SourceCodeLike, n as SuggestionDescriptor, t as byteToIndex, g as getContextFilename, h as getContextSource, q as getSourceText, p as projectCacheKey, r as resolvePandaSettings, s as sourceCacheKey, u as toEslintLoc } from './shared-B-c4H6nv.js';
1
+ import { L as Linter, R as RuleModuleLike, I as Inspect, a as RuleContextWithReport } from './shared-BdjJwg93.js';
2
+ export { c as LintInspection, b as LintRuleContextLike, d as LinterOptions, h as PandaLintSettings, f as ProjectCache, P as ProjectCacheOptions, l as ReportDescriptor, i as RuleContextLike, j as RuleFixer, S as SourceCodeLike, k as SuggestionDescriptor, n as byteToIndex, g as getContextFilename, e as getContextSource, m as getSourceText, p as projectCacheKey, r as resolvePandaSettings, t as toEslintLoc } from './shared-BdjJwg93.js';
3
+ import { Project } from '@pandacss/compiler/tooling';
4
+ export { FileInspectionCacheEntry as InspectionCacheEntry, FileInspector as Inspector, sourceCacheKey } from '@pandacss/compiler/tooling';
3
5
  import { Span, Diagnostic, Deprecation, TokenSuggestion, FileInspectionResult } from '@pandacss/compiler';
4
- import '@pandacss/config';
5
6
 
6
7
  interface RangeLike {
7
8
  span: Span;
@@ -27,7 +28,7 @@ interface PandaPluginOptions {
27
28
  }
28
29
  interface PandaProject {
29
30
  linter: Linter;
30
- project: ProjectContext;
31
+ project: Project;
31
32
  }
32
33
  interface PandaPlugin {
33
34
  rules: Record<string, RuleModuleLike>;
@@ -35,7 +36,7 @@ interface PandaPlugin {
35
36
  /** Preload one Panda project (config load + compiler) for a `(cwd, configPath)`. */
36
37
  declare function loadPandaProject(options?: PandaPluginOptions): Promise<PandaProject>;
37
38
  /** Bind every rule to an already-loaded project so rule visitors stay synchronous. */
38
- declare function bindRules(linter: Linter, project: ProjectContext): Record<string, RuleModuleLike>;
39
+ declare function bindRules(linter: Linter, project: Project): Record<string, RuleModuleLike>;
39
40
  declare function createPandaPlugin(options?: PandaPluginOptions): Promise<PandaPlugin>;
40
41
 
41
42
  /** Flat-config plugin key; rule ids are `@pandacss/<rule>`. */
@@ -141,6 +142,20 @@ declare function createNoInvalidNestingRule(options: {
141
142
  inspect: Inspect;
142
143
  }): RuleModuleLike;
143
144
 
145
+ declare const noPrimitiveTokenRuleName = "no-primitive-token";
146
+ interface NoPrimitiveTokenRuleOptions {
147
+ inspect: Inspect;
148
+ /** Semantic tokens that carry the same value as a full token path. */
149
+ suggestSemanticTokens: (path: string) => TokenSuggestion[];
150
+ }
151
+ interface ReportConfig$1 extends NoPrimitiveTokenRuleOptions {
152
+ /** Categories to enforce; `undefined` means every category with semantic tokens. */
153
+ categories?: ReadonlySet<string>;
154
+ allow: ReadonlySet<string>;
155
+ }
156
+ declare function reportPrimitiveTokenViolations(context: RuleContextWithReport, inspection: FileInspectionResult, config: ReportConfig$1): void;
157
+ declare function createNoPrimitiveTokenRule(options: NoPrimitiveTokenRuleOptions): RuleModuleLike;
158
+
144
159
  declare const noMarginPropertiesRuleName = "no-margin-properties";
145
160
  declare function createNoMarginPropertiesRule(options: {
146
161
  inspect: Inspect;
@@ -196,4 +211,4 @@ declare const _default: {
196
211
  };
197
212
  };
198
213
 
199
- export { type ConsistentPropertyStyleRuleOptions, type DeprecationKind, type ExtractionDiagnosticsRuleOptions, type FileNotIncludedRuleOptions, Inspect, Linter, type NoDebugRuleOptions, type NoDeprecatedRuleOptions, PLUGIN_NAMESPACE, type PandaFlatConfig, type PandaPlugin, type PandaPluginOptions, type PandaProject, type PreferTokenRuleOptions, ProjectContext, RangeIndex, type RangeLike, type RecommendedOptions, RuleContextWithReport, RuleModuleLike, type SuggestTokens, type TokenRuleOptions, bindRules, collectStrings, configs, consistentPropertyStyleRuleName, createConsistentPropertyStyleRule, createExtractionDiagnosticsRule, createFileNotIncludedRule, createNoDebugRule, createNoDeprecatedRule, createNoImportantRule, createNoInvalidNestingRule, createNoInvalidTokenPathsRule, createNoMarginPropertiesRule, createNoPhysicalPropertiesRule, createNoShorthandLonghandMixRule, createPandaPlugin, createPreferTextStyleRule, createPreferTokenRule, _default as default, extractionDiagnosticsRuleName, fileNotIncludedRuleName, loadPandaProject, noDebugRuleName, noDeprecatedRuleName, noImportantRuleName, noInvalidNestingRuleName, noInvalidTokenPathsRuleName, noMarginPropertiesRuleName, noPhysicalPropertiesRuleName, noShorthandLonghandMixRuleName, pluginMeta, preferTextStyleRuleName, preferTokenRuleName, recommended, reportDiagnostics, reportTokenViolations };
214
+ export { type ConsistentPropertyStyleRuleOptions, type DeprecationKind, type ExtractionDiagnosticsRuleOptions, type FileNotIncludedRuleOptions, Inspect, Linter, type NoDebugRuleOptions, type NoDeprecatedRuleOptions, type NoPrimitiveTokenRuleOptions, PLUGIN_NAMESPACE, type PandaFlatConfig, type PandaPlugin, type PandaPluginOptions, type PandaProject, type PreferTokenRuleOptions, RangeIndex, type RangeLike, type RecommendedOptions, RuleContextWithReport, RuleModuleLike, type SuggestTokens, type TokenRuleOptions, bindRules, collectStrings, configs, consistentPropertyStyleRuleName, createConsistentPropertyStyleRule, createExtractionDiagnosticsRule, createFileNotIncludedRule, createNoDebugRule, createNoDeprecatedRule, createNoImportantRule, createNoInvalidNestingRule, createNoInvalidTokenPathsRule, createNoMarginPropertiesRule, createNoPhysicalPropertiesRule, createNoPrimitiveTokenRule, createNoShorthandLonghandMixRule, createPandaPlugin, createPreferTextStyleRule, createPreferTokenRule, _default as default, extractionDiagnosticsRuleName, fileNotIncludedRuleName, loadPandaProject, noDebugRuleName, noDeprecatedRuleName, noImportantRuleName, noInvalidNestingRuleName, noInvalidTokenPathsRuleName, noMarginPropertiesRuleName, noPhysicalPropertiesRuleName, noPrimitiveTokenRuleName, noShorthandLonghandMixRuleName, pluginMeta, preferTextStyleRuleName, preferTokenRuleName, recommended, reportDiagnostics, reportPrimitiveTokenViolations, reportTokenViolations };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {
2
- Inspector,
2
+ FileInspector,
3
3
  Linter,
4
4
  ProjectCache,
5
5
  bindRules,
@@ -16,6 +16,7 @@ import {
16
16
  createNoInvalidTokenPathsRule,
17
17
  createNoMarginPropertiesRule,
18
18
  createNoPhysicalPropertiesRule,
19
+ createNoPrimitiveTokenRule,
19
20
  createNoShorthandLonghandMixRule,
20
21
  createPandaPlugin,
21
22
  createPreferTextStyleRule,
@@ -33,17 +34,19 @@ import {
33
34
  noInvalidTokenPathsRuleName,
34
35
  noMarginPropertiesRuleName,
35
36
  noPhysicalPropertiesRuleName,
37
+ noPrimitiveTokenRuleName,
36
38
  noShorthandLonghandMixRuleName,
37
39
  pluginMeta,
38
40
  preferTextStyleRuleName,
39
41
  preferTokenRuleName,
40
42
  projectCacheKey,
41
43
  reportDiagnostics,
44
+ reportPrimitiveTokenViolations,
42
45
  reportTokenViolations,
43
46
  resolvePandaSettings,
44
47
  sourceCacheKey,
45
48
  toEslintLoc
46
- } from "./chunk-3ZHMGIZ2.js";
49
+ } from "./chunk-EWTOUA37.js";
47
50
 
48
51
  // src/core/range-index.ts
49
52
  var RangeIndex = class {
@@ -97,7 +100,7 @@ var configs = { recommended };
97
100
  // src/index.ts
98
101
  var index_default = { meta: pluginMeta, configs };
99
102
  export {
100
- Inspector,
103
+ FileInspector as Inspector,
101
104
  Linter,
102
105
  PLUGIN_NAMESPACE,
103
106
  ProjectCache,
@@ -117,6 +120,7 @@ export {
117
120
  createNoInvalidTokenPathsRule,
118
121
  createNoMarginPropertiesRule,
119
122
  createNoPhysicalPropertiesRule,
123
+ createNoPrimitiveTokenRule,
120
124
  createNoShorthandLonghandMixRule,
121
125
  createPandaPlugin,
122
126
  createPreferTextStyleRule,
@@ -135,6 +139,7 @@ export {
135
139
  noInvalidTokenPathsRuleName,
136
140
  noMarginPropertiesRuleName,
137
141
  noPhysicalPropertiesRuleName,
142
+ noPrimitiveTokenRuleName,
138
143
  noShorthandLonghandMixRuleName,
139
144
  pluginMeta,
140
145
  preferTextStyleRuleName,
@@ -142,6 +147,7 @@ export {
142
147
  projectCacheKey,
143
148
  recommended,
144
149
  reportDiagnostics,
150
+ reportPrimitiveTokenViolations,
145
151
  reportTokenViolations,
146
152
  resolvePandaSettings,
147
153
  sourceCacheKey,
package/dist/oxlint.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { R as RuleModuleLike } from './shared-B-c4H6nv.js';
1
+ import { R as RuleModuleLike } from './shared-BdjJwg93.js';
2
2
  import '@pandacss/compiler';
3
- import '@pandacss/config';
3
+ import '@pandacss/compiler/tooling';
4
4
 
5
5
  declare const _default: {
6
6
  meta: {
package/dist/oxlint.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPandaPlugin
3
- } from "./chunk-3ZHMGIZ2.js";
3
+ } from "./chunk-EWTOUA37.js";
4
4
 
5
5
  // src/oxlint.ts
6
6
  var configPath = process.env.PANDA_CONFIG_PATH;
@@ -1,16 +1,5 @@
1
- import { Compiler, FileInspectionResult, createCompilerFromSnapshot, SourceRange } from '@pandacss/compiler';
2
- import { LoadConfigResult } from '@pandacss/config';
3
-
4
- interface InspectionCacheEntry {
5
- sourceKey: string;
6
- result: FileInspectionResult;
7
- }
8
- declare class Inspector {
9
- #private;
10
- inspect(compiler: Compiler, path: string, source: string): FileInspectionResult;
11
- clear(compiler?: Compiler): void;
12
- }
13
- declare function sourceCacheKey(source: string): string;
1
+ import { FileInspectionResult, SourceRange } from '@pandacss/compiler';
2
+ import { Project, FileInspector } from '@pandacss/compiler/tooling';
14
3
 
15
4
  interface PandaLintSettings {
16
5
  configPath?: string;
@@ -23,19 +12,13 @@ interface RuleContextLike {
23
12
  }
24
13
  declare function resolvePandaSettings(context: RuleContextLike): PandaLintSettings;
25
14
 
26
- interface ProjectContext {
27
- compiler: Compiler;
28
- configPath: string;
29
- dependencies: string[];
30
- }
31
15
  interface ProjectCacheOptions {
32
- load?: (settings: PandaLintSettings) => Promise<LoadConfigResult>;
33
- createCompiler?: typeof createCompilerFromSnapshot;
16
+ createProject?: (settings: PandaLintSettings) => Promise<Project>;
34
17
  }
35
18
  declare class ProjectCache {
36
19
  #private;
37
20
  constructor(options?: ProjectCacheOptions);
38
- get(settings: PandaLintSettings): Promise<ProjectContext>;
21
+ get(settings: PandaLintSettings): Promise<Project>;
39
22
  clear(): void;
40
23
  }
41
24
  declare function projectCacheKey(settings: PandaLintSettings): string;
@@ -53,7 +36,7 @@ interface LintRuleContextLike extends RuleContextLike {
53
36
  getSourceCode?: () => SourceCodeLike;
54
37
  }
55
38
  interface LintInspection {
56
- project: ProjectContext;
39
+ project: Project;
57
40
  settings: PandaLintSettings;
58
41
  path: string;
59
42
  source: string;
@@ -61,14 +44,14 @@ interface LintInspection {
61
44
  }
62
45
  interface LinterOptions {
63
46
  projectCache?: ProjectCache;
64
- inspector?: Inspector;
47
+ inspector?: FileInspector;
65
48
  }
66
49
  declare class Linter {
67
50
  #private;
68
51
  constructor(options?: LinterOptions);
69
- getProject(context: LintRuleContextLike): Promise<ProjectContext>;
52
+ getProject(context: LintRuleContextLike): Promise<Project>;
70
53
  inspect(context: LintRuleContextLike): Promise<LintInspection>;
71
- inspectProject(project: ProjectContext, path: string, source: string): FileInspectionResult;
54
+ inspectProject(project: Project, path: string, source: string): FileInspectionResult;
72
55
  clear(): void;
73
56
  }
74
57
  declare function getContextFilename(context: LintRuleContextLike): string;
@@ -123,4 +106,4 @@ declare function byteToIndex(text: string, byteOffset: number): number;
123
106
  /** ESLint columns are 0-based; Panda source ranges are 1-based. */
124
107
  declare function toEslintLoc(range: SourceRange): ReportDescriptor['loc'];
125
108
 
126
- export { type Inspect as I, Linter as L, type ProjectContext as P, type RuleModuleLike as R, type SourceCodeLike as S, type RuleContextWithReport as a, type InspectionCacheEntry as b, Inspector as c, type LintRuleContextLike as d, type LintInspection as e, type LinterOptions as f, getContextFilename as g, getContextSource as h, type ProjectCacheOptions as i, ProjectCache as j, type PandaLintSettings as k, type RuleContextLike as l, type RuleFixer as m, type SuggestionDescriptor as n, type ReportDescriptor as o, projectCacheKey as p, getSourceText as q, resolvePandaSettings as r, sourceCacheKey as s, byteToIndex as t, toEslintLoc as u };
109
+ export { type Inspect as I, Linter as L, type ProjectCacheOptions as P, type RuleModuleLike as R, type SourceCodeLike as S, type RuleContextWithReport as a, type LintRuleContextLike as b, type LintInspection as c, type LinterOptions as d, getContextSource as e, ProjectCache as f, getContextFilename as g, type PandaLintSettings as h, type RuleContextLike as i, type RuleFixer as j, type SuggestionDescriptor as k, type ReportDescriptor as l, getSourceText as m, byteToIndex as n, projectCacheKey as p, resolvePandaSettings as r, toEslintLoc as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/eslint-plugin",
3
- "version": "2.0.0-beta.8",
3
+ "version": "2.0.0-beta.9",
4
4
  "description": "ESLint rules for Panda CSS",
5
5
  "keywords": [
6
6
  "eslint",
@@ -42,9 +42,9 @@
42
42
  "dist"
43
43
  ],
44
44
  "dependencies": {
45
- "@pandacss/compiler": "2.0.0-beta.8",
46
- "@pandacss/compiler-shared": "2.0.0-beta.8",
47
- "@pandacss/config": "2.0.0-beta.8"
45
+ "@pandacss/compiler": "2.0.0-beta.9",
46
+ "@pandacss/compiler-shared": "2.0.0-beta.9",
47
+ "@pandacss/config": "2.0.0-beta.9"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@typescript-eslint/parser": "8.58.2",