pasika 0.10.18 → 0.10.20
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.
|
@@ -115,6 +115,8 @@ declare const tailwindRules: {
|
|
|
115
115
|
"css-entry-point": _eslint_css.CSSRuleDefinition;
|
|
116
116
|
"global-stylesheet": _eslint_css.CSSRuleDefinition;
|
|
117
117
|
"unused-utility": _eslint_css.CSSRuleDefinition;
|
|
118
|
+
"single-use-utility": _eslint_css.CSSRuleDefinition;
|
|
119
|
+
"global-selector-styling": _eslint_css.CSSRuleDefinition;
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
/** Framework-agnostic package.json rules any repository should follow. */
|
|
@@ -165,6 +167,8 @@ declare const pasikaPlugin: {
|
|
|
165
167
|
"css-entry-point": _eslint_css.CSSRuleDefinition;
|
|
166
168
|
"global-stylesheet": _eslint_css.CSSRuleDefinition;
|
|
167
169
|
"unused-utility": _eslint_css.CSSRuleDefinition;
|
|
170
|
+
"single-use-utility": _eslint_css.CSSRuleDefinition;
|
|
171
|
+
"global-selector-styling": _eslint_css.CSSRuleDefinition;
|
|
168
172
|
"doc-kind-suffix": _eslint_markdown.MarkdownRuleDefinition;
|
|
169
173
|
"title-matches-file-name": _eslint_markdown.MarkdownRuleDefinition;
|
|
170
174
|
overview: _eslint_markdown.MarkdownRuleDefinition;
|
|
@@ -6378,6 +6378,19 @@ var rootVariablesRule = {
|
|
|
6378
6378
|
};
|
|
6379
6379
|
|
|
6380
6380
|
// eslint/rules/tailwind/apply-usage.ts
|
|
6381
|
+
function reportRawDeclarations(context, rule) {
|
|
6382
|
+
for (const child of blockChildren2(rule)) {
|
|
6383
|
+
if (child.type === "Declaration") {
|
|
6384
|
+
if (child.property.startsWith("--")) continue;
|
|
6385
|
+
context.report({
|
|
6386
|
+
node: child,
|
|
6387
|
+
message: `Style declaration "${child.property}" inside a global selector must use @apply.`
|
|
6388
|
+
});
|
|
6389
|
+
continue;
|
|
6390
|
+
}
|
|
6391
|
+
if (child.type === "Rule") reportRawDeclarations(context, child);
|
|
6392
|
+
}
|
|
6393
|
+
}
|
|
6381
6394
|
var applyUsageRule = {
|
|
6382
6395
|
meta: {
|
|
6383
6396
|
schema: [],
|
|
@@ -6389,17 +6402,11 @@ var applyUsageRule = {
|
|
|
6389
6402
|
create(context) {
|
|
6390
6403
|
return {
|
|
6391
6404
|
"StyleSheet:exit"(node) {
|
|
6392
|
-
const
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
if (declaration.type !== "Declaration") continue;
|
|
6398
|
-
context.report({
|
|
6399
|
-
node: declaration,
|
|
6400
|
-
message: `Style declaration "${declaration.property}" inside a global selector must use @apply.`
|
|
6401
|
-
});
|
|
6402
|
-
}
|
|
6405
|
+
for (const child of node.children) {
|
|
6406
|
+
if (child.type === "Rule") reportRawDeclarations(context, child);
|
|
6407
|
+
if (child.type !== "Atrule" || child.name !== "layer") continue;
|
|
6408
|
+
for (const layered of blockChildren2(child)) {
|
|
6409
|
+
if (layered.type === "Rule") reportRawDeclarations(context, layered);
|
|
6403
6410
|
}
|
|
6404
6411
|
}
|
|
6405
6412
|
}
|
|
@@ -6939,6 +6946,80 @@ var unusedUtilityRule = {
|
|
|
6939
6946
|
}
|
|
6940
6947
|
};
|
|
6941
6948
|
|
|
6949
|
+
// eslint/rules/tailwind/single-use-utility.ts
|
|
6950
|
+
import { statSync as statSync8 } from "fs";
|
|
6951
|
+
function usagePattern2(name) {
|
|
6952
|
+
return new RegExp(`(?<![\\\\w-])${escapeRegExp(name)}(?![\\\\w-])`);
|
|
6953
|
+
}
|
|
6954
|
+
var singleUseUtilityRule = {
|
|
6955
|
+
meta: {
|
|
6956
|
+
schema: [],
|
|
6957
|
+
type: "problem",
|
|
6958
|
+
docs: {
|
|
6959
|
+
description: "Disallow custom utilities referenced by only one source file."
|
|
6960
|
+
}
|
|
6961
|
+
},
|
|
6962
|
+
create(context) {
|
|
6963
|
+
const sourceRoot = sourceRootOf(context);
|
|
6964
|
+
let files;
|
|
6965
|
+
try {
|
|
6966
|
+
if (!statSync8(sourceRoot).isDirectory()) return {};
|
|
6967
|
+
files = findFiles(sourceRoot, SOURCE_EXTENSIONS);
|
|
6968
|
+
} catch {
|
|
6969
|
+
return {};
|
|
6970
|
+
}
|
|
6971
|
+
const textOf = cachedTextReader();
|
|
6972
|
+
return {
|
|
6973
|
+
"StyleSheet:exit"(node) {
|
|
6974
|
+
for (const utility of atrulesNamed(node, "utility")) {
|
|
6975
|
+
const name = preludeIdentifiers(utility)[0];
|
|
6976
|
+
if (!name) continue;
|
|
6977
|
+
const pattern = usagePattern2(name);
|
|
6978
|
+
const definition = `@utility ${name}`;
|
|
6979
|
+
const consumers = files.filter((file) => pattern.test(textOf(file).replaceAll(definition, "")));
|
|
6980
|
+
if (consumers.length !== 1) continue;
|
|
6981
|
+
context.report({
|
|
6982
|
+
node: utility,
|
|
6983
|
+
message: `Custom utility "${name}" is used by only one source file; keep that styling as static Tailwind classes in its consumer.`
|
|
6984
|
+
});
|
|
6985
|
+
}
|
|
6986
|
+
}
|
|
6987
|
+
};
|
|
6988
|
+
}
|
|
6989
|
+
};
|
|
6990
|
+
|
|
6991
|
+
// eslint/rules/tailwind/global-selector-styling.ts
|
|
6992
|
+
function hasStyling(node) {
|
|
6993
|
+
for (const child of blockChildren2(node)) {
|
|
6994
|
+
if (child.type === "Declaration" && !child.property.startsWith("--")) return true;
|
|
6995
|
+
if (child.type === "Atrule" && child.name === "apply") return true;
|
|
6996
|
+
if (child.type === "Rule" && hasStyling(child)) return true;
|
|
6997
|
+
}
|
|
6998
|
+
return false;
|
|
6999
|
+
}
|
|
7000
|
+
var globalSelectorStylingRule = {
|
|
7001
|
+
meta: {
|
|
7002
|
+
schema: [],
|
|
7003
|
+
type: "problem",
|
|
7004
|
+
docs: {
|
|
7005
|
+
description: "Forbid element/component styling in global selectors outside @layer base."
|
|
7006
|
+
}
|
|
7007
|
+
},
|
|
7008
|
+
create(context) {
|
|
7009
|
+
return {
|
|
7010
|
+
"StyleSheet:exit"(node) {
|
|
7011
|
+
for (const child of node.children) {
|
|
7012
|
+
if (child.type !== "Rule" || !hasStyling(child)) continue;
|
|
7013
|
+
context.report({
|
|
7014
|
+
node: child,
|
|
7015
|
+
message: "Global selectors outside @layer base may only override CSS variables; keep element/component styling as Tailwind classes in the consumer."
|
|
7016
|
+
});
|
|
7017
|
+
}
|
|
7018
|
+
}
|
|
7019
|
+
};
|
|
7020
|
+
}
|
|
7021
|
+
};
|
|
7022
|
+
|
|
6942
7023
|
// eslint/rules/tailwind/index.ts
|
|
6943
7024
|
var tailwindRules = {
|
|
6944
7025
|
"theme-reset": themeResetRule,
|
|
@@ -6952,7 +7033,9 @@ var tailwindRules = {
|
|
|
6952
7033
|
"theme-variable-namespace": themeVariableNamespaceRule,
|
|
6953
7034
|
"css-entry-point": cssEntryPointRule,
|
|
6954
7035
|
"global-stylesheet": globalStylesheetRule,
|
|
6955
|
-
"unused-utility": unusedUtilityRule
|
|
7036
|
+
"unused-utility": unusedUtilityRule,
|
|
7037
|
+
"single-use-utility": singleUseUtilityRule,
|
|
7038
|
+
"global-selector-styling": globalSelectorStylingRule
|
|
6956
7039
|
};
|
|
6957
7040
|
|
|
6958
7041
|
// eslint/rules/package-json/exact-version.ts
|