@pandacss/eslint-plugin 2.2.0 → 2.3.0

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
@@ -125,7 +125,9 @@ path, so the setup is identical.
125
125
 
126
126
  These rules are on in `recommended`:
127
127
 
128
- - `no-invalid-token-paths` (error) — a token reference that doesn't exist, e.g. `token('colors.ghost')`.
128
+ - `no-invalid-token-paths` (error) — a token reference that doesn't exist, e.g. `token('colors.ghost')` or
129
+ `'1px solid {colors.ghost}'`. A missing path is reported even with a valid fallback such as
130
+ `token(sizes.ghost, 10px)`.
129
131
  - `no-invalid-nesting` (error) — a nested selector missing `&` (`':hover'` instead of `'&:hover'`), which Panda silently
130
132
  ignores. Suggests prefixing `&`.
131
133
  - `file-not-included` (error) — a file uses Panda but sits outside your config `include`, so its styles never get
@@ -12,6 +12,7 @@ function byteToIndex(text, byteOffset) {
12
12
  }
13
13
  return text.length;
14
14
  }
15
+ var FILE_START_LOC = { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } };
15
16
  function toEslintLoc(range) {
16
17
  return {
17
18
  start: {
@@ -94,6 +95,7 @@ function createConsistentPropertyStyleRule(options) {
94
95
 
95
96
  // src/rules/extraction-diagnostics.ts
96
97
  var extractionDiagnosticsRuleName = "extraction-diagnostics";
98
+ var unknownTokenReferenceCode = "unknown_token_reference";
97
99
  function createExtractionDiagnosticsRule(options) {
98
100
  return {
99
101
  meta: {
@@ -111,7 +113,10 @@ function createExtractionDiagnosticsRule(options) {
111
113
  Program() {
112
114
  const inspection = options.inspect(context);
113
115
  if (!inspection) return;
114
- reportDiagnostics(context, inspection.diagnostics);
116
+ reportDiagnostics(
117
+ context,
118
+ inspection.diagnostics.filter((diagnostic) => diagnostic.code !== unknownTokenReferenceCode)
119
+ );
115
120
  }
116
121
  };
117
122
  }
@@ -122,7 +127,7 @@ function reportDiagnostics(context, diagnostics) {
122
127
  context.report({
123
128
  messageId: "diagnostic",
124
129
  data: { message: diagnostic.message },
125
- ...diagnostic.location ? { loc: toEslintLoc(diagnostic.location) } : {}
130
+ loc: diagnostic.location ? toEslintLoc(diagnostic.location) : FILE_START_LOC
126
131
  });
127
132
  }
128
133
  }
@@ -283,7 +288,7 @@ function createFileNotIncludedRule(options) {
283
288
  if (!usesPanda) return;
284
289
  context.report({
285
290
  messageId: "notIncluded",
286
- loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } }
291
+ loc: FILE_START_LOC
287
292
  });
288
293
  }
289
294
  };
@@ -1130,7 +1135,7 @@ import { SpecIndex } from "@pandacss/compiler/tooling";
1130
1135
  // package.json
1131
1136
  var package_default = {
1132
1137
  name: "@pandacss/eslint-plugin",
1133
- version: "2.2.0",
1138
+ version: "2.3.0",
1134
1139
  description: "ESLint rules for Panda CSS",
1135
1140
  keywords: [
1136
1141
  "eslint",
@@ -1300,6 +1305,7 @@ async function createPandaPlugin(options = {}) {
1300
1305
  export {
1301
1306
  getSourceText,
1302
1307
  byteToIndex,
1308
+ FILE_START_LOC,
1303
1309
  toEslintLoc,
1304
1310
  consistentPropertyStyleRuleName,
1305
1311
  createConsistentPropertyStyleRule,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ import { L as Linter, R as RuleModuleLike, I as Inspect, a as RuleContextWithReport } from './shared-CAk1xRZJ.js';
2
+ export { F as FILE_START_LOC, c as LintInspection, b as LintRuleContextLike, d as LinterOptions, h as PandaLintSettings, f as ProjectCache, P as ProjectCacheOptions, m as ReportDescriptor, i as RuleContextLike, k as RuleFixer, j as RuleTextEdit, S as SourceCodeLike, l as SuggestionDescriptor, o as byteToIndex, g as getContextFilename, e as getContextSource, n as getSourceText, p as projectCacheKey, r as resolvePandaSettings, t as toEslintLoc } from './shared-CAk1xRZJ.js';
3
3
  import { Project } from '@pandacss/compiler/tooling';
4
4
  export { FileInspectionCacheEntry as InspectionCacheEntry, FileInspector as Inspector, sourceCacheKey } from '@pandacss/compiler/tooling';
5
5
  import { Span, Diagnostic, Deprecation, TokenSuggestion, FileInspectionResult } from '@pandacss/compiler';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ FILE_START_LOC,
2
3
  FileInspector,
3
4
  Linter,
4
5
  ProjectCache,
@@ -48,7 +49,7 @@ import {
48
49
  resolvePandaSettings,
49
50
  sourceCacheKey,
50
51
  toEslintLoc
51
- } from "./chunk-ENKGEXOW.js";
52
+ } from "./chunk-GNPSHHZA.js";
52
53
 
53
54
  // src/core/range-index.ts
54
55
  var RangeIndex = class {
@@ -102,6 +103,7 @@ var configs = { recommended };
102
103
  // src/index.ts
103
104
  var index_default = { meta: pluginMeta, configs };
104
105
  export {
106
+ FILE_START_LOC,
105
107
  FileInspector as Inspector,
106
108
  Linter,
107
109
  PLUGIN_NAMESPACE,
package/dist/oxlint.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { R as RuleModuleLike } from './shared-BdjJwg93.js';
1
+ import { R as RuleModuleLike } from './shared-CAk1xRZJ.js';
2
2
  import '@pandacss/compiler';
3
3
  import '@pandacss/compiler/tooling';
4
4
 
package/dist/oxlint.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPandaPlugin
3
- } from "./chunk-ENKGEXOW.js";
3
+ } from "./chunk-GNPSHHZA.js";
4
4
 
5
5
  // src/oxlint.ts
6
6
  var configPath = process.env.PANDA_CONFIG_PATH;
@@ -26,6 +26,7 @@ declare function projectCacheKey(settings: PandaLintSettings): string;
26
26
  interface SourceCodeLike {
27
27
  text?: string;
28
28
  getText?: () => string;
29
+ body?: Uint8Array;
29
30
  }
30
31
  interface LintRuleContextLike extends RuleContextLike {
31
32
  filename?: string;
@@ -57,17 +58,21 @@ declare class Linter {
57
58
  declare function getContextFilename(context: LintRuleContextLike): string;
58
59
  declare function getContextSource(context: LintRuleContextLike): string;
59
60
 
61
+ interface RuleTextEdit {
62
+ range: [number, number];
63
+ text: string;
64
+ }
60
65
  interface RuleFixer {
61
- replaceTextRange(range: [number, number], text: string): unknown;
66
+ replaceTextRange(range: [number, number], text: string): RuleTextEdit;
62
67
  }
63
68
  interface SuggestionDescriptor {
64
69
  desc: string;
65
- fix: (fixer: RuleFixer) => unknown;
70
+ fix: (fixer: RuleFixer) => RuleTextEdit | null;
66
71
  }
67
72
  interface ReportDescriptor {
68
73
  messageId: string;
69
74
  data?: Record<string, string>;
70
- loc?: {
75
+ loc: {
71
76
  start: {
72
77
  line: number;
73
78
  column: number;
@@ -78,7 +83,7 @@ interface ReportDescriptor {
78
83
  };
79
84
  };
80
85
  suggest?: SuggestionDescriptor[];
81
- fix?: (fixer: RuleFixer) => unknown;
86
+ fix?: (fixer: RuleFixer) => RuleTextEdit | null;
82
87
  }
83
88
  interface RuleContextWithReport extends LintRuleContextLike {
84
89
  report: (descriptor: ReportDescriptor) => void;
@@ -103,7 +108,9 @@ type Inspect = (context: LintRuleContextLike) => FileInspectionResult | undefine
103
108
  declare function getSourceText(context: RuleContextWithReport): string;
104
109
  /** UTF-8 byte offset (Panda spans) → string index (ESLint fix ranges). */
105
110
  declare function byteToIndex(text: string, byteOffset: number): number;
111
+ /** For file-level reports with no source range. */
112
+ declare const FILE_START_LOC: ReportDescriptor['loc'];
106
113
  /** ESLint columns are 0-based; Panda source ranges are 1-based. */
107
114
  declare function toEslintLoc(range: SourceRange): ReportDescriptor['loc'];
108
115
 
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 };
116
+ export { FILE_START_LOC as F, 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 RuleTextEdit as j, type RuleFixer as k, type SuggestionDescriptor as l, type ReportDescriptor as m, getSourceText as n, byteToIndex as o, 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.2.0",
3
+ "version": "2.3.0",
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.2.0",
46
- "@pandacss/compiler-shared": "2.2.0",
47
- "@pandacss/config": "2.2.0"
45
+ "@pandacss/compiler": "2.3.0",
46
+ "@pandacss/compiler-shared": "2.3.0",
47
+ "@pandacss/config": "2.3.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@typescript-eslint/parser": "8.69.0",