tailwind-canonical 0.7.0 → 0.8.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 +63 -6
- package/dist/cli/cli.d.ts +2 -11
- package/dist/cli/cli.js +176 -471
- package/dist/cli/format.d.ts +3 -0
- package/dist/cli/format.js +11 -0
- package/dist/cli/reporters.d.ts +69 -0
- package/dist/cli/reporters.js +333 -0
- package/dist/cli/types.d.ts +16 -0
- package/dist/cli/types.js +1 -0
- package/dist/cli/watch.d.ts +11 -0
- package/dist/cli/watch.js +33 -0
- package/dist/core/analyzer.js +3 -2
- package/dist/core/class-strings.js +13 -7
- package/dist/core/config.d.ts +1 -1
- package/dist/core/config.js +25 -42
- package/dist/core/consistency.d.ts +1 -1
- package/dist/core/deduplicator.js +110 -170
- package/dist/core/merger.js +9 -3
- package/dist/core/rules.d.ts +5 -0
- package/dist/core/rules.js +453 -62
- package/dist/core/scanner.js +23 -20
- package/dist/core/sorter.js +80 -7
- package/dist/core/suppressions.d.ts +1 -2
- package/dist/core/suppressions.js +17 -13
- package/dist/core/typos.js +3 -2
- package/dist/eslint/plugin.js +62 -28
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -140,6 +140,11 @@ npx tailwind-canonical --fix --reporter json ./src
|
|
|
140
140
|
npx tailwind-canonical --reporter sarif ./src > results.sarif
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
+
Each result's `artifactLocation.uri` is relative to the git root (falling back to the working
|
|
144
|
+
directory), with `uriBaseId: "%SRCROOT%"`, so Code Scanning maps it from any subdirectory.
|
|
145
|
+
Results also carry `level`, a full `region` (start/end column) and line-independent
|
|
146
|
+
`partialFingerprints`; `tool.driver.version` records the emitting version.
|
|
147
|
+
|
|
143
148
|
**GitHub Actions integration:**
|
|
144
149
|
```yaml
|
|
145
150
|
- run: npx tailwind-canonical --reporter sarif ./src > results.sarif
|
|
@@ -347,12 +352,42 @@ left-2 right-2 → inset-x-2
|
|
|
347
352
|
| `text-[12px]` | `text-xs` | Built-in |
|
|
348
353
|
| `text-[0.75rem]` | `text-xs` | rem values |
|
|
349
354
|
| `h-[64px]` | `h-16` | Spacing scale ÷4 |
|
|
355
|
+
| `p-[1px]` / `gap-[1px]` | `p-px` / `gap-px` | 1px spacing step |
|
|
350
356
|
| `w-[50%]` | `w-1/2` | Percentage fractions |
|
|
351
|
-
| `
|
|
352
|
-
| `
|
|
353
|
-
| `
|
|
357
|
+
| `w-[100%]` / `basis-[100%]` | `w-full` / `basis-full` | Sizing, inset, translate, basis |
|
|
358
|
+
| `h-[100vh]` / `w-[100vw]` | `h-screen` / `w-screen` | Axis-checked; `min-w-screen` is v4-only |
|
|
359
|
+
| `h-[100dvh]` / `svh` / `lvh` | `h-dvh` / `h-svh` / `h-lvh` | v4 only |
|
|
360
|
+
| `w-[auto]` / `mx-[auto]` | `w-auto` / `mx-auto` | Never negated |
|
|
361
|
+
| `w-[fit-content]` / `min-content` / `max-content` | `w-fit` / `w-min` / `w-max` | |
|
|
362
|
+
| `p-[0]` / `top-[0]` | `p-0` / `top-0` | Unitless zero |
|
|
363
|
+
| `aspect-[16/9]` / `aspect-[1/1]` | `aspect-video` / `aspect-square` | Other ratios (`aspect-4/3`) v4 only |
|
|
364
|
+
| `rounded-[9999px]` | `rounded-full` | |
|
|
365
|
+
| `opacity-[0.5]` / `opacity-[.5]` | `opacity-50` | Opacity scale |
|
|
366
|
+
| `border-[1px]` / `border-t-[1px]` | `border` / `border-t` | Bare = 1px; `[0/2/4/8px]` → `border-0/2/4/8` |
|
|
367
|
+
| `divide-x-[1px]` | `divide-x` | Same scale as `border` |
|
|
368
|
+
| `ring-[1px]` / `outline-[2px]` | `ring-1` / `outline-2` | Never bare: `ring` is 3px on v3 |
|
|
369
|
+
| `duration-[200ms]` / `delay-[0.15s]` | `duration-200` / `delay-150` | ms or s |
|
|
370
|
+
| `scale-[1.05]` / `scale-x-[95%]` | `scale-105` / `scale-x-95` | Factor or percentage |
|
|
371
|
+
| `rotate-[45deg]` | `rotate-45` | Integer degrees |
|
|
372
|
+
| `blur-[4px]` | `blur-xs` | `blur-sm` with `tailwindVersion: 3` |
|
|
373
|
+
| `z-[10]` | `z-10` | Any integer on v4 |
|
|
374
|
+
| `font-[700]` | `font-bold` | Weights 100–900 |
|
|
375
|
+
| `leading-[24px]` / `leading-[1.5rem]` | `leading-6` | Spacing scale ÷4 |
|
|
376
|
+
| `leading-[1.5]` | `leading-normal` | `none`, `tight`, `snug`, `normal`, `relaxed`, `loose` |
|
|
377
|
+
| `order-[1]` / `order-[0]` | `order-1` / `order-none` | Any integer on v4 |
|
|
378
|
+
| `grow-[1]` / `shrink-[0]` | `grow` / `shrink-0` | |
|
|
379
|
+
| `line-clamp-[3]`, `columns-[3]` | `line-clamp-3`, `columns-3` | Any integer ≥ 1 on v4 |
|
|
380
|
+
| `text-[11px]` | `text-2xs` | Requires `customTextTokens` |
|
|
381
|
+
| `text-[8px]`–`text-[10px]` | `text-3xs` | Requires `customTextTokens` |
|
|
382
|
+
| `hover:p-[16px]` | `hover:p-4` | Variants are preserved |
|
|
383
|
+
| `!p-[16px]` / `p-[16px]!` | `!p-4` / `p-4!` | Important modifier kept in place |
|
|
384
|
+
| `-mt-[8px]` / `mt-[-8px]` | `-mt-2` | Negative margin / inset / translate / space / scale / rotate / z / order only |
|
|
385
|
+
|
|
386
|
+
`text-2xs` and `text-3xs` are not stock Tailwind tokens, so they are not in the built-in text size map — without config, `text-[11px]` and `text-[8px]`–`text-[10px]` are left untouched. Enable them with `customTextTokens`:
|
|
354
387
|
|
|
355
|
-
|
|
388
|
+
```ts
|
|
389
|
+
export default { customTextTokens: { 8: '3xs', 9: '3xs', 10: '3xs', 11: '2xs' } }
|
|
390
|
+
```
|
|
356
391
|
|
|
357
392
|
Non-divisible values (`h-[22px]`, `px-[7px]`) are left untouched.
|
|
358
393
|
|
|
@@ -384,14 +419,36 @@ scale differs per utility, not just per family:
|
|
|
384
419
|
| `top-[20%]` | `top-1/5` | untouched — v3.3 stops at quarters here |
|
|
385
420
|
| `top-[25%]` | `top-1/4` | `top-1/4` |
|
|
386
421
|
| `w-[8.333333%]` | `w-1/12` | `w-1/12` — `w` carries the full set |
|
|
422
|
+
| `duration-[250ms]` | `duration-250` | untouched — not on the v3 scale |
|
|
423
|
+
| `scale-[1.15]` | `scale-115` | untouched — not on the v3 scale |
|
|
424
|
+
| `rotate-[30deg]` | `rotate-30` | untouched — not on the v3 scale |
|
|
425
|
+
| `blur-[4px]` | `blur-xs` | `blur-sm` — v3 names are one step lower |
|
|
426
|
+
| `blur-[8px]` | `blur-sm` | `blur` |
|
|
427
|
+
| `z-[15]` | `z-15` | untouched — v3 stops at `0`–`50` in tens |
|
|
428
|
+
| `leading-[44px]` | `leading-11` | untouched — v3 ships `leading-3`–`leading-10` |
|
|
429
|
+
| `order-[13]` | `order-13` | untouched — v3 ships `1`–`12` |
|
|
430
|
+
| `grow-[2]` | `grow-2` | untouched — v3 ships `grow` and `grow-0` |
|
|
431
|
+
| `line-clamp-[7]` | `line-clamp-7` | untouched — v3 ships `1`–`6` |
|
|
432
|
+
| `columns-[13]` | `columns-13` | untouched — v3 ships `1`–`12` |
|
|
387
433
|
|
|
388
434
|
Spacing steps: `size-*` has no numeric scale in v3.3, and `min-w-*`, `max-w-*`
|
|
389
435
|
and `min-h-*` only ship the zero step — they gained the scale afterwards.
|
|
390
436
|
Fractions: `w` carries all thirteen, `h` stops at sixths, `inset`/`top`/`left`/
|
|
391
437
|
`right`/`bottom`/`translate-x`/`translate-y` only have halves, thirds and
|
|
392
438
|
quarters, and `min-w`/`max-w`/`min-h`/`max-h` have none.
|
|
393
|
-
|
|
394
|
-
`
|
|
439
|
+
`duration-*`/`delay-*` stop at 0, 75, 100, 150, 200, 300, 500, 700 and 1000;
|
|
440
|
+
`scale-*` at 0, 50, 75, 90, 95, 100, 105, 110, 125 and 150; `rotate-*` at 0, 1,
|
|
441
|
+
2, 3, 6, 12, 45, 90 and 180. v4 accepts any integer for all four.
|
|
442
|
+
|
|
443
|
+
`*-px` follows the same per-utility gating: `size-px`, `min-w-px`, `max-w-px`
|
|
444
|
+
and `min-h-px` are left untouched on v3.
|
|
445
|
+
|
|
446
|
+
`rounded-*` follows each major's radius scale: v4 renamed the small end, so
|
|
447
|
+
`rounded-[2px]` → `rounded-xs` and `rounded-[4px]` → `rounded-sm` on v4, but
|
|
448
|
+
`rounded-sm` and bare `rounded` on v3; `rounded-[32px]` → `rounded-4xl` is
|
|
449
|
+
v4-only. `text-*`, `opacity-*`, `font-*` weights, the `leading-*`
|
|
450
|
+
keywords and the `border`/`divide`/`ring`/`outline`
|
|
451
|
+
widths are identical in both majors and are
|
|
395
452
|
never gated. `customSpacingTokens` stays your decision and is applied in both
|
|
396
453
|
modes. All of the above was measured against `tailwindcss@3.3.7`, the
|
|
397
454
|
advertised floor.
|
package/dist/cli/cli.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
error: (s: string) => void;
|
|
4
|
-
write: (s: string) => void;
|
|
5
|
-
};
|
|
6
|
-
export type RunResult = {
|
|
7
|
-
exitCode: number;
|
|
8
|
-
watching?: boolean;
|
|
9
|
-
};
|
|
10
|
-
type Reporter = 'text' | 'json' | 'sarif';
|
|
1
|
+
import type { Reporter, RunResult, Sink } from './types.js';
|
|
2
|
+
export type { RunResult, Sink } from './types.js';
|
|
11
3
|
type Flags = {
|
|
12
4
|
fix: boolean;
|
|
13
5
|
merge: boolean;
|
|
@@ -37,4 +29,3 @@ export declare function parseArgs(argv: string[]): Flags;
|
|
|
37
29
|
*/
|
|
38
30
|
export declare function flagWarnings(flags: Flags): string[];
|
|
39
31
|
export declare function run(argv: string[], cwd: string, sink?: Sink): Promise<RunResult>;
|
|
40
|
-
export {};
|