tailwind-typescript-plugin 1.2.1-beta.1 → 1.3.1-beta.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [1.3.0](https://github.com/IvanRodriCalleja/tailwind-typescript-plugin/compare/v1.2.0...v1.3.0) (2025-11-25)
2
+
3
+ ### ✨ Features
4
+
5
+ * add quick fixes for invalid Tailwind classes ([2f96bc7](https://github.com/IvanRodriCalleja/tailwind-typescript-plugin/commit/2f96bc7c3786f6c77e7d11914e7447900d83ef35))
6
+
1
7
  ## [1.2.0](https://github.com/IvanRodriCalleja/tailwind-typescript-plugin/compare/v1.1.0...v1.2.0) (2025-11-25)
2
8
 
3
9
  ### ✨ Features
package/README.md CHANGED
@@ -234,6 +234,18 @@ Most editors that support TypeScript Language Service plugins should work automa
234
234
 
235
235
  // ✅ Non-null assertions
236
236
  <div className={className!}>Non-null assertion</div>
237
+
238
+ // ✅ Variable references (resolved to their values)
239
+ const validClass = 'flex items-center';
240
+ <div className={validClass}>Variable reference</div>
241
+
242
+ // ✅ Variables in arrays
243
+ const baseClass = 'flex';
244
+ <div className={[baseClass, 'items-center']}>Array with variable</div>
245
+
246
+ // ✅ Variables in tv() and cva()
247
+ const buttonBase = 'font-semibold text-white';
248
+ const button = tv({ base: buttonBase });
237
249
  ```
238
250
 
239
251
  **Invalid classes are flagged**:
@@ -249,6 +261,18 @@ Most editors that support TypeScript Language Service plugins should work automa
249
261
  // ❌ Invalid variant
250
262
  <div className="invalid-variant:bg-blue-500">Bad variant</div>
251
263
  // Error: The class "invalid-variant:bg-blue-500" is not a valid Tailwind class
264
+
265
+ // ❌ Invalid class in variable (error points to declaration)
266
+ const invalidClass = 'not-a-tailwind-class';
267
+ // Error: The class "not-a-tailwind-class" is not a valid Tailwind class.
268
+ // This value is used as className via variable "invalidClass" on line 5
269
+ <div className={invalidClass}>Variable with invalid class</div>
270
+
271
+ // ❌ Invalid class in variable used in array
272
+ const badClass = 'invalid-array-class';
273
+ // Error: The class "invalid-array-class" is not a valid Tailwind class.
274
+ // This value is used as className via variable "badClass" on line 8
275
+ <div className={['flex', badClass]}>Array with invalid variable</div>
252
276
  ```
253
277
 
254
278
  **Custom allowed classes**:
@@ -497,9 +521,25 @@ const invalidVariant = cva(['font-semibold'], {
497
521
  Validates CSS custom properties (variables) using arbitrary property syntax
498
522
  Example: `className="[--card-bg:#1e293b] bg-[var(--card-bg)]"`
499
523
 
500
- - [ ] **Expression Variable**
501
- Validates variable references
502
- Example: `const dynamicClass = isActive ? 'bg-blue-500' : 'bg-gray-500'; <div className={dynamicClass}>Dynamic</div>`
524
+ - [X] **Expression Variable** → [`expression-variable.tsx`](./example/src/expression-variable.tsx)
525
+ Validates variable references by resolving to their declared string values
526
+ Example: `const dynamicClass = 'invalid-class'; <div className={dynamicClass}>Dynamic</div>`
527
+
528
+ - [X] **Variable in Arrays** → [`test-variable-in-array.tsx`](./example/src/test-variable-in-array.tsx)
529
+ Validates variables used inside array expressions
530
+ Example: `const myClass = 'invalid-class'; <div className={[myClass, 'flex']}>Array</div>`
531
+
532
+ - [X] **Variable in Objects** → [`test-variable-in-object.tsx`](./example/src/test-variable-in-object.tsx)
533
+ Validates variables used in computed object property keys
534
+ Example: `const myClass = 'invalid-class'; <div className={{ [myClass]: true }}>Object</div>`
535
+
536
+ - [X] **TV Variable** → [`tv-variable.tsx`](./example/src/tv-variable.tsx)
537
+ Validates variables in tailwind-variants tv() definitions
538
+ Example: `const baseClasses = 'invalid-class'; const button = tv({ base: baseClasses })`
539
+
540
+ - [X] **CVA Variable** → [`cva-variable.tsx`](./example/src/cva-variable.tsx)
541
+ Validates variables in class-variance-authority cva() definitions
542
+ Example: `const baseClasses = 'invalid-class'; const button = cva(baseClasses)`
503
543
 
504
544
  ## How It Works
505
545
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-typescript-plugin",
3
- "version": "1.2.1-beta.1",
3
+ "version": "1.3.1-beta.1",
4
4
  "description": "TypeScript Language Service plugin that validates Tailwind CSS class names in JSX/TSX files. Catches typos and invalid classes in real-time with support for tailwind-variants and class-variance-authority.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",