pasika 0.10.25 → 0.10.27
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/dist/eslint/pasika/index.js +52 -10
- package/package.json +6 -3
|
@@ -729,6 +729,7 @@ var noArbitraryTailwindRule = {
|
|
|
729
729
|
|
|
730
730
|
// eslint/rules/unknown-utility.ts
|
|
731
731
|
import { existsSync, readdirSync, readFileSync as readFileSync2, statSync } from "fs";
|
|
732
|
+
import { createRequire as createRequire2 } from "module";
|
|
732
733
|
import path5 from "path";
|
|
733
734
|
var PREFIX_NAMESPACES = {
|
|
734
735
|
bg: ["color"],
|
|
@@ -935,6 +936,31 @@ var STATIC_COLOR_SPECIALS = /* @__PURE__ */ new Set(["transparent", "current", "
|
|
|
935
936
|
var NUMERIC_TOKEN_RE = /^-?(?:\d+\.?\d*|\.\d+)(?:%|px|rem|em)?$/;
|
|
936
937
|
var SIDE_WIDTH_TOKEN_RE = /^(?:x|y|t|r|b|l|s|e)-(?:\d+\.?\d*|\.\d+)(?:%|px|rem|em)?$/;
|
|
937
938
|
var OFFSET_TOKEN_RE = /^offset-(?:\d+\.?\d*|\.\d+)(?:%|px|rem|em)?$/;
|
|
939
|
+
var require2 = createRequire2(import.meta.url);
|
|
940
|
+
var tailwindMerge;
|
|
941
|
+
function getTailwindMerge() {
|
|
942
|
+
if (tailwindMerge !== void 0) return tailwindMerge ?? void 0;
|
|
943
|
+
try {
|
|
944
|
+
const moduleValue = require2("tailwind-merge");
|
|
945
|
+
if (typeof moduleValue === "object" && moduleValue !== null && "twMerge" in moduleValue && typeof moduleValue.twMerge === "function") {
|
|
946
|
+
const merge = moduleValue.twMerge;
|
|
947
|
+
tailwindMerge = (...classLists) => {
|
|
948
|
+
const result = Reflect.apply(merge, void 0, classLists);
|
|
949
|
+
return typeof result === "string" ? result : classLists.join(" ");
|
|
950
|
+
};
|
|
951
|
+
} else {
|
|
952
|
+
tailwindMerge = null;
|
|
953
|
+
}
|
|
954
|
+
} catch {
|
|
955
|
+
tailwindMerge = null;
|
|
956
|
+
}
|
|
957
|
+
return tailwindMerge ?? void 0;
|
|
958
|
+
}
|
|
959
|
+
function isBuiltInTailwindUtility(utility) {
|
|
960
|
+
const twMerge = getTailwindMerge();
|
|
961
|
+
if (!twMerge) return void 0;
|
|
962
|
+
return twMerge(utility, utility) === utility;
|
|
963
|
+
}
|
|
938
964
|
function stylesheetFiles(dir) {
|
|
939
965
|
let entries;
|
|
940
966
|
try {
|
|
@@ -1124,7 +1150,7 @@ function isKnown(className, inventory) {
|
|
|
1124
1150
|
if (!inventory.defaultsReset && DEFAULT_TOKENS[prefix]?.includes(token)) return true;
|
|
1125
1151
|
return false;
|
|
1126
1152
|
}
|
|
1127
|
-
return !inventory.utilityPrefixes.has(prefix);
|
|
1153
|
+
return isBuiltInTailwindUtility(utility) ?? !inventory.utilityPrefixes.has(prefix);
|
|
1128
1154
|
}
|
|
1129
1155
|
if (NUMERIC_TOKEN_RE.test(token) || SIDE_WIDTH_TOKEN_RE.test(token) || OFFSET_TOKEN_RE.test(token)) return true;
|
|
1130
1156
|
if (PREFIX_BUILTINS[prefix]?.includes(token)) return true;
|
|
@@ -1184,7 +1210,13 @@ var unknownUtilityRule = {
|
|
|
1184
1210
|
return;
|
|
1185
1211
|
}
|
|
1186
1212
|
if (expression.type === "TemplateLiteral") {
|
|
1187
|
-
|
|
1213
|
+
const lastQuasi = expression.quasis.length - 1;
|
|
1214
|
+
for (const [index, quasi] of expression.quasis.entries()) {
|
|
1215
|
+
let value = quasi.value.raw;
|
|
1216
|
+
if (index > 0) value = value.replace(/^\S*/, "");
|
|
1217
|
+
if (index < lastQuasi) value = value.replace(/\S*$/, "");
|
|
1218
|
+
reportUnknownClasses(node, value);
|
|
1219
|
+
}
|
|
1188
1220
|
return;
|
|
1189
1221
|
}
|
|
1190
1222
|
if (expression.type === "LogicalExpression") {
|
|
@@ -7276,6 +7308,7 @@ function stringValues(value) {
|
|
|
7276
7308
|
return value.elements.flatMap((element) => element.value.type === "String" ? [element.value.value] : []);
|
|
7277
7309
|
}
|
|
7278
7310
|
var SOURCE_GLOB_PATTERN = /(?:^|[^a-z])(?:[cm]?[jt]sx?)(?:[^a-z]|$)/i;
|
|
7311
|
+
var REQUIRED_NON_SOURCE_EXTENSIONS = ["css", "json", "md"];
|
|
7279
7312
|
var DIRECT_ESLINT_PATTERN = /(?:^|&&|\|\||;)\s*(?:npx\s+)?eslint(?:\s|$)/;
|
|
7280
7313
|
var REPOSITORY_ARGUMENT_PATTERN = /(?:^|\s)\.(?=\s|$)/;
|
|
7281
7314
|
var PRETTIER_PATTERN = /\bprettier\b/;
|
|
@@ -7289,6 +7322,9 @@ function runsPrettier(command) {
|
|
|
7289
7322
|
function runsNamedScript(command, name) {
|
|
7290
7323
|
return command.includes(`npm run ${name}`);
|
|
7291
7324
|
}
|
|
7325
|
+
function globIncludesExtension(glob, extension) {
|
|
7326
|
+
return new RegExp(`(?:^|[^a-z])${extension}(?:[^a-z]|$)`, "i").test(glob);
|
|
7327
|
+
}
|
|
7292
7328
|
var lintSetupRule = {
|
|
7293
7329
|
meta: {
|
|
7294
7330
|
schema: [],
|
|
@@ -7338,22 +7374,28 @@ var lintSetupRule = {
|
|
|
7338
7374
|
});
|
|
7339
7375
|
}
|
|
7340
7376
|
const lintStagedConfig = root.members.find((member) => memberName2(member) === "lint-staged");
|
|
7341
|
-
const
|
|
7342
|
-
|
|
7377
|
+
const stagedMembers = lintStagedConfig?.value.type === "Object" ? lintStagedConfig.value.members : [];
|
|
7378
|
+
const runsStagedScriptForGlob = (name, matchesGlob) => stagedMembers.some(
|
|
7379
|
+
(member) => matchesGlob(memberName2(member)) && stringValues(member.value).some((command) => runsNamedScript(command, name))
|
|
7343
7380
|
);
|
|
7344
|
-
const
|
|
7345
|
-
|
|
7381
|
+
const runsStagedScriptForExtension = (name, extension) => runsStagedScriptForGlob(name, (glob) => globIncludesExtension(glob, extension));
|
|
7382
|
+
const hasStagedSourceLint = runsStagedScriptForGlob("lint:staged", (glob) => SOURCE_GLOB_PATTERN.test(glob));
|
|
7383
|
+
const hasStagedNonSourceLint = REQUIRED_NON_SOURCE_EXTENSIONS.every(
|
|
7384
|
+
(extension) => runsStagedScriptForExtension("lint:staged", extension)
|
|
7346
7385
|
);
|
|
7347
|
-
if (!
|
|
7386
|
+
if (!hasStagedSourceLint || !hasStagedNonSourceLint) {
|
|
7348
7387
|
context.report({
|
|
7349
7388
|
node: lintStagedConfig ?? node,
|
|
7350
|
-
message: 'package.json lint-staged must run "npm run lint:staged --" for staged JavaScript
|
|
7389
|
+
message: 'package.json lint-staged must run "npm run lint:staged --" for staged JavaScript, TypeScript, CSS, Markdown, and JSON files.'
|
|
7351
7390
|
});
|
|
7352
7391
|
}
|
|
7353
|
-
|
|
7392
|
+
const hasStagedNonSourceFormat = REQUIRED_NON_SOURCE_EXTENSIONS.every(
|
|
7393
|
+
(extension) => runsStagedScriptForExtension("format:staged", extension)
|
|
7394
|
+
);
|
|
7395
|
+
if (!hasStagedNonSourceFormat) {
|
|
7354
7396
|
context.report({
|
|
7355
7397
|
node: lintStagedConfig ?? node,
|
|
7356
|
-
message: 'package.json lint-staged must run "npm run format:staged --" for staged
|
|
7398
|
+
message: 'package.json lint-staged must run "npm run format:staged --" for staged CSS, Markdown, and JSON files.'
|
|
7357
7399
|
});
|
|
7358
7400
|
}
|
|
7359
7401
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pasika",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.27",
|
|
4
4
|
"description": "Reusable agent setup package",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,10 +54,13 @@
|
|
|
54
54
|
"typecheck": "tsc --noEmit"
|
|
55
55
|
},
|
|
56
56
|
"lint-staged": {
|
|
57
|
-
"
|
|
58
|
-
"*.ts|*.mts|*.cts|*.tsx|*.js|*.cjs|*.mjs|*.jsx": [
|
|
57
|
+
"*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}": [
|
|
59
58
|
"npm run lint:staged --",
|
|
60
59
|
"npm run test:unit:staged --"
|
|
60
|
+
],
|
|
61
|
+
"*.{css,json,md}": [
|
|
62
|
+
"npm run lint:staged --",
|
|
63
|
+
"npm run format:staged --"
|
|
61
64
|
]
|
|
62
65
|
},
|
|
63
66
|
"dependencies": {
|