pasika 0.6.1 → 0.7.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 +1 -1
- package/dist/eslint/pasika/index.d.ts +2 -2
- package/dist/eslint/pasika/index.js +31 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -191,7 +191,7 @@ Applied to `src/**/globals.css` (and other stylesheets) through `@eslint/css` wi
|
|
|
191
191
|
| `pasika/stylesheet-ordering` | Imports → `@custom-variant` → `:root` → `@theme` → `@utility` → `@layer base` |
|
|
192
192
|
| `pasika/css-variable-naming` | Background vars named `--<role>-canvas`, text vars `--<role>-ink` |
|
|
193
193
|
| `pasika/custom-utility-apply` | `@utility` blocks use `@apply` |
|
|
194
|
-
| `pasika/
|
|
194
|
+
| `pasika/skin-utility` | Repeated style combinations become a named skin utility |
|
|
195
195
|
| `pasika/theme-variable-namespace` | Utility class groups share a namespace prefix |
|
|
196
196
|
| `pasika/css-entry-point` † | One global entry, imported by one module, project CSS only in a stylesheet the entry imports directly |
|
|
197
197
|
| `pasika/unused-utility` | A custom `@utility` no source file references is reported as dead |
|
|
@@ -109,7 +109,7 @@ declare const tailwindRules: {
|
|
|
109
109
|
"stylesheet-ordering": _eslint_css.CSSRuleDefinition;
|
|
110
110
|
"css-variable-naming": _eslint_css.CSSRuleDefinition;
|
|
111
111
|
"custom-utility-apply": _eslint_css.CSSRuleDefinition;
|
|
112
|
-
"
|
|
112
|
+
"skin-utility": _eslint_css.CSSRuleDefinition;
|
|
113
113
|
"theme-variable-namespace": _eslint_css.CSSRuleDefinition;
|
|
114
114
|
"css-entry-point": _eslint_css.CSSRuleDefinition;
|
|
115
115
|
"global-stylesheet": _eslint_css.CSSRuleDefinition;
|
|
@@ -159,7 +159,7 @@ declare const pasikaPlugin: {
|
|
|
159
159
|
"stylesheet-ordering": _eslint_css.CSSRuleDefinition;
|
|
160
160
|
"css-variable-naming": _eslint_css.CSSRuleDefinition;
|
|
161
161
|
"custom-utility-apply": _eslint_css.CSSRuleDefinition;
|
|
162
|
-
"
|
|
162
|
+
"skin-utility": _eslint_css.CSSRuleDefinition;
|
|
163
163
|
"theme-variable-namespace": _eslint_css.CSSRuleDefinition;
|
|
164
164
|
"css-entry-point": _eslint_css.CSSRuleDefinition;
|
|
165
165
|
"global-stylesheet": _eslint_css.CSSRuleDefinition;
|
|
@@ -3681,11 +3681,7 @@ function combosFor(index) {
|
|
|
3681
3681
|
const files = [...index.modules.keys()].filter((file) => file.endsWith(".tsx") || file.endsWith(".jsx")).sort((left, right) => left.localeCompare(right));
|
|
3682
3682
|
let fingerprint2 = "";
|
|
3683
3683
|
for (const file of files) {
|
|
3684
|
-
|
|
3685
|
-
fingerprint2 += String(statSync3(file).mtimeMs);
|
|
3686
|
-
} catch {
|
|
3687
|
-
fingerprint2 += "0";
|
|
3688
|
-
}
|
|
3684
|
+
fingerprint2 += String(statSync3(file).mtimeMs);
|
|
3689
3685
|
}
|
|
3690
3686
|
if (comboCache?.sourceRoot === index.sourceRoot && comboCache.fingerprint === fingerprint2) {
|
|
3691
3687
|
return comboCache.combos;
|
|
@@ -3710,7 +3706,7 @@ var sharedStyleDedupRule = {
|
|
|
3710
3706
|
schema: [],
|
|
3711
3707
|
type: "problem",
|
|
3712
3708
|
docs: {
|
|
3713
|
-
description: "Require a className combination used by two or more components to become a named
|
|
3709
|
+
description: "Require a className combination used by two or more components to become a named *-skin utility."
|
|
3714
3710
|
}
|
|
3715
3711
|
},
|
|
3716
3712
|
create(context) {
|
|
@@ -3729,7 +3725,7 @@ var sharedStyleDedupRule = {
|
|
|
3729
3725
|
context.report({
|
|
3730
3726
|
node,
|
|
3731
3727
|
loc: { line: 1, column: 0 },
|
|
3732
|
-
message: `Class combination "${combo}" is used by ${String(users.size)} components and should change together; create a named
|
|
3728
|
+
message: `Class combination "${combo}" is used by ${String(users.size)} components and should change together; create a named *-skin Tailwind utility for it. See docs/next-tailwind-guide/rules/theme-and-utility-definition-rule.md`
|
|
3733
3729
|
});
|
|
3734
3730
|
}
|
|
3735
3731
|
}
|
|
@@ -5441,12 +5437,18 @@ var stylesheetOrderingRule = {
|
|
|
5441
5437
|
};
|
|
5442
5438
|
|
|
5443
5439
|
// eslint/rules/tailwind/css-variable-naming.ts
|
|
5440
|
+
var EDGE_PROPERTY_WORDS = /* @__PURE__ */ new Set(["border", "divider", "outline", "ring", "stroke"]);
|
|
5441
|
+
var NON_COLOR_WORDS = /* @__PURE__ */ new Set(["offset", "radius", "spacing", "style", "width"]);
|
|
5442
|
+
function looksLikeEdgeColor(lower) {
|
|
5443
|
+
const words = lower.slice(2).split("-");
|
|
5444
|
+
return words.some((word) => EDGE_PROPERTY_WORDS.has(word)) && !words.some((word) => NON_COLOR_WORDS.has(word));
|
|
5445
|
+
}
|
|
5444
5446
|
var cssVariableNamingRule = {
|
|
5445
5447
|
meta: {
|
|
5446
5448
|
schema: [],
|
|
5447
5449
|
type: "problem",
|
|
5448
5450
|
docs: {
|
|
5449
|
-
description: "Require
|
|
5451
|
+
description: "Require property-specific color variables to use canvas, ink, and edge role suffixes."
|
|
5450
5452
|
}
|
|
5451
5453
|
},
|
|
5452
5454
|
create(context) {
|
|
@@ -5467,6 +5469,12 @@ var cssVariableNamingRule = {
|
|
|
5467
5469
|
message: `CSS variable "${property}" looks like a text token; name it --<role>-ink instead.`
|
|
5468
5470
|
});
|
|
5469
5471
|
}
|
|
5472
|
+
if (looksLikeEdgeColor(lower) && !lower.endsWith("-edge")) {
|
|
5473
|
+
context.report({
|
|
5474
|
+
node,
|
|
5475
|
+
message: `CSS variable "${property}" looks like a boundary token; name it --<role>-edge instead.`
|
|
5476
|
+
});
|
|
5477
|
+
}
|
|
5470
5478
|
}
|
|
5471
5479
|
};
|
|
5472
5480
|
}
|
|
@@ -5514,24 +5522,31 @@ var customUtilityApplyRule = {
|
|
|
5514
5522
|
}
|
|
5515
5523
|
};
|
|
5516
5524
|
|
|
5517
|
-
// eslint/rules/tailwind/
|
|
5518
|
-
var
|
|
5525
|
+
// eslint/rules/tailwind/skin-utility.ts
|
|
5526
|
+
var skinUtilityRule = {
|
|
5519
5527
|
meta: {
|
|
5520
5528
|
schema: [],
|
|
5521
5529
|
type: "problem",
|
|
5522
5530
|
docs: {
|
|
5523
|
-
description: "Require
|
|
5531
|
+
description: "Require reusable style combinations to become *-skin utilities."
|
|
5524
5532
|
}
|
|
5525
5533
|
},
|
|
5526
5534
|
create(context) {
|
|
5527
5535
|
return {
|
|
5528
5536
|
"StyleSheet:exit"(node) {
|
|
5537
|
+
for (const utility of atrulesNamed(node, "utility")) {
|
|
5538
|
+
const name = preludeIdentifiers(utility)[0];
|
|
5539
|
+
const applied = new Set(atrulesNamed(utility, "apply").flatMap((apply) => preludeIdentifiers(apply)));
|
|
5540
|
+
if (applied.size < 2 || name?.endsWith("-skin") === true) continue;
|
|
5541
|
+
context.report({
|
|
5542
|
+
node: utility,
|
|
5543
|
+
message: `Custom utility "${name ?? "unknown"}" combines ${String(applied.size)} styles; use the *-skin suffix.`
|
|
5544
|
+
});
|
|
5545
|
+
}
|
|
5529
5546
|
const combinations = /* @__PURE__ */ new Map();
|
|
5530
5547
|
for (const apply of atrulesNamed(node, "apply")) {
|
|
5531
5548
|
const classes = preludeIdentifiers(apply);
|
|
5532
|
-
if (
|
|
5533
|
-
continue;
|
|
5534
|
-
}
|
|
5549
|
+
if (new Set(classes).size < 2) continue;
|
|
5535
5550
|
const key = [...classes].sort().join(" ");
|
|
5536
5551
|
combinations.set(key, (combinations.get(key) ?? 0) + 1);
|
|
5537
5552
|
}
|
|
@@ -5539,7 +5554,7 @@ var surfaceUtilityRule = {
|
|
|
5539
5554
|
if (count < 2) continue;
|
|
5540
5555
|
context.report({
|
|
5541
5556
|
node,
|
|
5542
|
-
message: `Combination "${combo}" appears ${String(count)} times. Create a *-
|
|
5557
|
+
message: `Combination "${combo}" appears ${String(count)} times. Create a *-skin custom Tailwind utility for it.`
|
|
5543
5558
|
});
|
|
5544
5559
|
}
|
|
5545
5560
|
}
|
|
@@ -5839,7 +5854,7 @@ var tailwindRules = {
|
|
|
5839
5854
|
"stylesheet-ordering": stylesheetOrderingRule,
|
|
5840
5855
|
"css-variable-naming": cssVariableNamingRule,
|
|
5841
5856
|
"custom-utility-apply": customUtilityApplyRule,
|
|
5842
|
-
"
|
|
5857
|
+
"skin-utility": skinUtilityRule,
|
|
5843
5858
|
"theme-variable-namespace": themeVariableNamespaceRule,
|
|
5844
5859
|
"css-entry-point": cssEntryPointRule,
|
|
5845
5860
|
"global-stylesheet": globalStylesheetRule,
|