pasika 0.10.53 → 0.10.54
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.d.ts +1 -0
- package/dist/eslint/pasika/index.js +164 -84
- package/package.json +1 -1
|
@@ -204,6 +204,7 @@ declare const pasikaPlugin: {
|
|
|
204
204
|
"no-util-barrel": eslint.Rule.RuleModule;
|
|
205
205
|
"no-redundant-alias": eslint.Rule.RuleModule;
|
|
206
206
|
"enforce-barrel-exports": eslint.Rule.RuleModule;
|
|
207
|
+
"require-barrel-star-exports": eslint.Rule.RuleModule;
|
|
207
208
|
"config-extraction": eslint.Rule.RuleModule;
|
|
208
209
|
"value-extraction": eslint.Rule.RuleModule;
|
|
209
210
|
"constant-casing": eslint.Rule.RuleModule;
|
|
@@ -5172,13 +5172,13 @@ var THRESHOLD_METRICS = ["lines", "functions", "branches", "statements"];
|
|
|
5172
5172
|
var SOURCE_GLOB_PATTERN2 = /(?:^|[^a-z])(?:[cm]?[jt]sx?)(?:[^a-z]|$)/i;
|
|
5173
5173
|
var COVERAGE_FLAG_PATTERN = /(?:^|\s)--coverage(?:[=\s]|$)/;
|
|
5174
5174
|
var RELATED_PATTERN = /\brelated\b/;
|
|
5175
|
-
var AUTO_UPDATE_PATTERN = /autoUpdate\s*:\s*
|
|
5175
|
+
var AUTO_UPDATE_PATTERN = /autoUpdate\s*:\s*\(\s*newThreshold\s*,\s*previousThreshold\s*\)\s*=>\s*Math\.max\(\s*previousThreshold\s*,\s*Math\.floor\(\s*\(\s*newThreshold\s*-\s*0\.1\s*\)\s*\*\s*10\s*\)\s*\/\s*10\s*\)/;
|
|
5176
5176
|
var vitestCoverageRule = {
|
|
5177
5177
|
meta: {
|
|
5178
5178
|
schema: [],
|
|
5179
5179
|
type: "problem",
|
|
5180
5180
|
docs: {
|
|
5181
|
-
description: "Require Vitest unit-test scripts, the V8 provider, a rising aggregate coverage threshold, and related tests via lint-staged."
|
|
5181
|
+
description: "Require Vitest unit-test scripts, the V8 provider, a platform-stable rising aggregate coverage threshold, and related tests via lint-staged."
|
|
5182
5182
|
}
|
|
5183
5183
|
},
|
|
5184
5184
|
create(context) {
|
|
@@ -5234,7 +5234,7 @@ var vitestCoverageRule = {
|
|
|
5234
5234
|
if (!AUTO_UPDATE_PATTERN.test(content)) {
|
|
5235
5235
|
context.report({
|
|
5236
5236
|
node,
|
|
5237
|
-
message: `${configName} must set coverage.thresholds.autoUpdate to
|
|
5237
|
+
message: `${configName} must set coverage.thresholds.autoUpdate to the monotonic 0.1-point buffered formatter.`
|
|
5238
5238
|
});
|
|
5239
5239
|
}
|
|
5240
5240
|
const stagedTests = scriptMembers.find((member) => memberName5(member) === "test:unit:staged");
|
|
@@ -5705,8 +5705,87 @@ var repeatedStructureRule = {
|
|
|
5705
5705
|
}
|
|
5706
5706
|
};
|
|
5707
5707
|
|
|
5708
|
-
// eslint/rules/
|
|
5708
|
+
// eslint/rules/require-barrel-star-exports.ts
|
|
5709
|
+
import fs5 from "fs";
|
|
5709
5710
|
import path43 from "path";
|
|
5711
|
+
var SUPPORT_FOLDERS3 = /* @__PURE__ */ new Set(["constants", "types", "schemas"]);
|
|
5712
|
+
var INDEX_NAMES = /* @__PURE__ */ new Set(["index.ts", "index.tsx", "index.mts", "index.cts"]);
|
|
5713
|
+
var MODULE_EXTENSIONS3 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
5714
|
+
function resolveSiblingModule(indexFile, specifier) {
|
|
5715
|
+
if (!specifier.startsWith("./")) return void 0;
|
|
5716
|
+
const relative = specifier.slice(2);
|
|
5717
|
+
if (!relative || relative.includes("/")) return void 0;
|
|
5718
|
+
const directory = path43.dirname(indexFile);
|
|
5719
|
+
const direct = path43.resolve(directory, relative);
|
|
5720
|
+
const candidates = path43.extname(direct) ? [direct] : MODULE_EXTENSIONS3.map((extension) => `${direct}${extension}`);
|
|
5721
|
+
return candidates.find((candidate) => fs5.existsSync(candidate) && fs5.statSync(candidate).isFile());
|
|
5722
|
+
}
|
|
5723
|
+
var requireBarrelStarExportsRule = {
|
|
5724
|
+
meta: {
|
|
5725
|
+
schema: [],
|
|
5726
|
+
type: "suggestion",
|
|
5727
|
+
docs: {
|
|
5728
|
+
description: "Require support-folder barrels to mirror local sibling modules through wildcard re-exports."
|
|
5729
|
+
},
|
|
5730
|
+
fixable: "code"
|
|
5731
|
+
},
|
|
5732
|
+
create(context) {
|
|
5733
|
+
const filename = path43.resolve(context.filename);
|
|
5734
|
+
if (!INDEX_NAMES.has(path43.basename(filename))) return {};
|
|
5735
|
+
if (!SUPPORT_FOLDERS3.has(path43.basename(path43.dirname(filename)))) return {};
|
|
5736
|
+
return {
|
|
5737
|
+
ExportNamedDeclaration(node) {
|
|
5738
|
+
const sourceNode = node.source;
|
|
5739
|
+
const sourceValue = sourceNode?.value;
|
|
5740
|
+
if (!sourceNode || typeof sourceValue !== "string" || node.specifiers.length === 0) return;
|
|
5741
|
+
const siblingFile = resolveSiblingModule(filename, sourceValue);
|
|
5742
|
+
if (!siblingFile) return;
|
|
5743
|
+
let replacement;
|
|
5744
|
+
try {
|
|
5745
|
+
const siblingExports = parseModule(siblingFile).exports;
|
|
5746
|
+
if (siblingExports.length > 0) {
|
|
5747
|
+
const reExportedNames = /* @__PURE__ */ new Set();
|
|
5748
|
+
let hasRename = false;
|
|
5749
|
+
for (const specifier of node.specifiers) {
|
|
5750
|
+
if (specifier.local.type !== "Identifier" || specifier.exported.type !== "Identifier") {
|
|
5751
|
+
hasRename = true;
|
|
5752
|
+
break;
|
|
5753
|
+
}
|
|
5754
|
+
if (specifier.local.name !== specifier.exported.name) {
|
|
5755
|
+
hasRename = true;
|
|
5756
|
+
break;
|
|
5757
|
+
}
|
|
5758
|
+
reExportedNames.add(specifier.local.name);
|
|
5759
|
+
}
|
|
5760
|
+
const siblingExportNames = new Set(siblingExports.map((moduleExport) => moduleExport.name));
|
|
5761
|
+
const exportsCompleteSurface = !hasRename && reExportedNames.size === siblingExportNames.size && [...siblingExportNames].every((name) => reExportedNames.has(name));
|
|
5762
|
+
if (exportsCompleteSurface) {
|
|
5763
|
+
const siblingExportsOnlyTypes = siblingExports.every((moduleExport) => moduleExport.kind === "type");
|
|
5764
|
+
const statementIsTypeOnly = context.sourceCode.getText(node).trimStart().startsWith("export type ");
|
|
5765
|
+
if (!statementIsTypeOnly || siblingExportsOnlyTypes) {
|
|
5766
|
+
const keyword = siblingExportsOnlyTypes ? "export type *" : "export *";
|
|
5767
|
+
replacement = `${keyword} from ${context.sourceCode.getText(sourceNode)};`;
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5770
|
+
}
|
|
5771
|
+
} catch {
|
|
5772
|
+
}
|
|
5773
|
+
context.report({
|
|
5774
|
+
node,
|
|
5775
|
+
message: "A support-folder barrel MUST re-export a local sibling module with export * or export type *; remove unwanted exports or rename declarations in the sibling module instead of filtering or renaming them in the barrel.",
|
|
5776
|
+
...replacement ? {
|
|
5777
|
+
fix(fixer) {
|
|
5778
|
+
return fixer.replaceText(node, replacement);
|
|
5779
|
+
}
|
|
5780
|
+
} : {}
|
|
5781
|
+
});
|
|
5782
|
+
}
|
|
5783
|
+
};
|
|
5784
|
+
}
|
|
5785
|
+
};
|
|
5786
|
+
|
|
5787
|
+
// eslint/rules/root-support-placement.ts
|
|
5788
|
+
import path44 from "path";
|
|
5710
5789
|
function isSupportFolder(value) {
|
|
5711
5790
|
return value === "utils" || value === "types" || value === "schemas" || value === "constants";
|
|
5712
5791
|
}
|
|
@@ -5739,7 +5818,7 @@ var rootSupportPlacementRule = {
|
|
|
5739
5818
|
},
|
|
5740
5819
|
create(context) {
|
|
5741
5820
|
const sourceRoot = sourceRootOf(context);
|
|
5742
|
-
const file =
|
|
5821
|
+
const file = path44.resolve(context.filename);
|
|
5743
5822
|
const segments = segmentsOf(file, sourceRoot);
|
|
5744
5823
|
const folderSegments = folderSegmentsOf(file, sourceRoot);
|
|
5745
5824
|
const supportFolder = folderSegments[folderSegments.length - 1];
|
|
@@ -5779,7 +5858,7 @@ var rootSupportPlacementRule = {
|
|
|
5779
5858
|
};
|
|
5780
5859
|
|
|
5781
5860
|
// eslint/rules/route-handler-shape.ts
|
|
5782
|
-
import
|
|
5861
|
+
import path45 from "path";
|
|
5783
5862
|
import ts7 from "typescript";
|
|
5784
5863
|
var HTTP_METHODS2 = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);
|
|
5785
5864
|
var REQUIRED_BOUNDARY = "withResponse";
|
|
@@ -5864,7 +5943,7 @@ var routeHandlerShapeRule = {
|
|
|
5864
5943
|
}
|
|
5865
5944
|
},
|
|
5866
5945
|
create(context) {
|
|
5867
|
-
if (
|
|
5946
|
+
if (path45.basename(context.filename) !== "route.ts") return {};
|
|
5868
5947
|
const sourceText = context.sourceCode.text;
|
|
5869
5948
|
function reportUnwrapped(node, name) {
|
|
5870
5949
|
context.report({
|
|
@@ -5923,7 +6002,7 @@ var routeHandlerShapeRule = {
|
|
|
5923
6002
|
};
|
|
5924
6003
|
|
|
5925
6004
|
// eslint/rules/schema-casing.ts
|
|
5926
|
-
import
|
|
6005
|
+
import path46 from "path";
|
|
5927
6006
|
function isCamelCase(name) {
|
|
5928
6007
|
return /^[a-z][a-zA-Z0-9]*$/.test(name);
|
|
5929
6008
|
}
|
|
@@ -5951,9 +6030,9 @@ var schemaCasingRule = {
|
|
|
5951
6030
|
}
|
|
5952
6031
|
},
|
|
5953
6032
|
create(context) {
|
|
5954
|
-
const filename =
|
|
6033
|
+
const filename = path46.resolve(context.filename);
|
|
5955
6034
|
const sourceRoot = sourceRootOf(context);
|
|
5956
|
-
if (!filename.startsWith(sourceRoot +
|
|
6035
|
+
if (!filename.startsWith(sourceRoot + path46.sep)) return {};
|
|
5957
6036
|
let zodLocalName;
|
|
5958
6037
|
return {
|
|
5959
6038
|
ImportDeclaration(node) {
|
|
@@ -5985,7 +6064,7 @@ var schemaCasingRule = {
|
|
|
5985
6064
|
};
|
|
5986
6065
|
|
|
5987
6066
|
// eslint/rules/sole-state-owner.ts
|
|
5988
|
-
import
|
|
6067
|
+
import path47 from "path";
|
|
5989
6068
|
import ts8 from "typescript";
|
|
5990
6069
|
function findStateHooks(node) {
|
|
5991
6070
|
const hooks = [];
|
|
@@ -6065,7 +6144,7 @@ var soleStateOwnerRule = {
|
|
|
6065
6144
|
}
|
|
6066
6145
|
},
|
|
6067
6146
|
create(context) {
|
|
6068
|
-
const filename =
|
|
6147
|
+
const filename = path47.resolve(context.filename);
|
|
6069
6148
|
if (!filename.endsWith(".tsx") && !filename.endsWith(".jsx")) return {};
|
|
6070
6149
|
const text = context.sourceCode.text;
|
|
6071
6150
|
const components = parseComponentInfo(text, filename);
|
|
@@ -6144,7 +6223,7 @@ function usesOutsideJsx(declaration, hook, children) {
|
|
|
6144
6223
|
}
|
|
6145
6224
|
|
|
6146
6225
|
// eslint/rules/source-under-src.ts
|
|
6147
|
-
import
|
|
6226
|
+
import path48 from "path";
|
|
6148
6227
|
var NON_SOURCE_ROOT_DIRS = /* @__PURE__ */ new Set([
|
|
6149
6228
|
".agents",
|
|
6150
6229
|
".cache",
|
|
@@ -6185,14 +6264,14 @@ var sourceUnderSrcRule = {
|
|
|
6185
6264
|
}
|
|
6186
6265
|
},
|
|
6187
6266
|
create(context) {
|
|
6188
|
-
const filename =
|
|
6267
|
+
const filename = path48.resolve(context.filename);
|
|
6189
6268
|
if (!MODULE_EXTENSION.test(filename)) return {};
|
|
6190
|
-
const relative =
|
|
6269
|
+
const relative = path48.relative(context.cwd, filename).replace(/\\/g, "/");
|
|
6191
6270
|
if (relative === "src" || relative.startsWith("src/")) return {};
|
|
6192
6271
|
const topLevel = relative.split("/")[0] ?? "";
|
|
6193
6272
|
if (NON_SOURCE_ROOT_DIRS.has(topLevel)) return {};
|
|
6194
6273
|
if (!relative.includes("/")) {
|
|
6195
|
-
const basename =
|
|
6274
|
+
const basename = path48.basename(filename);
|
|
6196
6275
|
if (CONFIG_FILE.test(basename) || DECLARATION_FILE.test(basename) || basename.startsWith(".")) return {};
|
|
6197
6276
|
}
|
|
6198
6277
|
return {
|
|
@@ -6208,7 +6287,7 @@ var sourceUnderSrcRule = {
|
|
|
6208
6287
|
};
|
|
6209
6288
|
|
|
6210
6289
|
// eslint/rules/stay-flat.ts
|
|
6211
|
-
import
|
|
6290
|
+
import path49 from "path";
|
|
6212
6291
|
var stayFlatRule = {
|
|
6213
6292
|
meta: {
|
|
6214
6293
|
schema: [],
|
|
@@ -6219,7 +6298,7 @@ var stayFlatRule = {
|
|
|
6219
6298
|
},
|
|
6220
6299
|
create(context) {
|
|
6221
6300
|
const sourceRoot = sourceRootOf(context);
|
|
6222
|
-
const file =
|
|
6301
|
+
const file = path49.resolve(context.filename);
|
|
6223
6302
|
const segments = segmentsOf(file, sourceRoot);
|
|
6224
6303
|
if (segments.length !== 3 || segments[0] !== "features") return {};
|
|
6225
6304
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -6259,7 +6338,7 @@ var stayFlatRule = {
|
|
|
6259
6338
|
};
|
|
6260
6339
|
|
|
6261
6340
|
// eslint/rules/support-file-placement.ts
|
|
6262
|
-
import
|
|
6341
|
+
import path50 from "path";
|
|
6263
6342
|
var CONFIG_OWNED_FOLDERS = /* @__PURE__ */ new Set(["types", "constants"]);
|
|
6264
6343
|
var EXPORT_KIND_BY_SUPPORT_FOLDER = /* @__PURE__ */ new Map([
|
|
6265
6344
|
["constants", "constant"],
|
|
@@ -6284,7 +6363,7 @@ var supportFilePlacementRule = {
|
|
|
6284
6363
|
},
|
|
6285
6364
|
create(context) {
|
|
6286
6365
|
const sourceRoot = sourceRootOf(context);
|
|
6287
|
-
const supportFile =
|
|
6366
|
+
const supportFile = path50.resolve(context.filename);
|
|
6288
6367
|
const currentFolder = folderSegmentsOf(supportFile, sourceRoot);
|
|
6289
6368
|
const supportFolder = currentFolder[currentFolder.length - 1];
|
|
6290
6369
|
if (supportFolder === void 0 || !SUPPORT_FOLDERS.has(supportFolder)) return {};
|
|
@@ -6337,10 +6416,10 @@ var supportFilePlacementRule = {
|
|
|
6337
6416
|
};
|
|
6338
6417
|
|
|
6339
6418
|
// eslint/rules/support-folder-shape.ts
|
|
6340
|
-
import
|
|
6341
|
-
import
|
|
6342
|
-
var
|
|
6343
|
-
var
|
|
6419
|
+
import fs6 from "fs";
|
|
6420
|
+
import path51 from "path";
|
|
6421
|
+
var SUPPORT_FOLDERS4 = /* @__PURE__ */ new Set(["constants", "types", "schemas"]);
|
|
6422
|
+
var INDEX_NAMES2 = /* @__PURE__ */ new Set(["index.ts", "index.tsx", "index.mts", "index.cts"]);
|
|
6344
6423
|
var supportFolderShapeRule = {
|
|
6345
6424
|
meta: {
|
|
6346
6425
|
schema: [],
|
|
@@ -6350,15 +6429,15 @@ var supportFolderShapeRule = {
|
|
|
6350
6429
|
}
|
|
6351
6430
|
},
|
|
6352
6431
|
create(context) {
|
|
6353
|
-
const filename =
|
|
6354
|
-
const baseName =
|
|
6355
|
-
if (!
|
|
6356
|
-
const folder =
|
|
6357
|
-
if (!
|
|
6358
|
-
const directory =
|
|
6432
|
+
const filename = path51.resolve(context.filename);
|
|
6433
|
+
const baseName = path51.basename(filename);
|
|
6434
|
+
if (!INDEX_NAMES2.has(baseName)) return {};
|
|
6435
|
+
const folder = path51.basename(path51.dirname(filename));
|
|
6436
|
+
if (!SUPPORT_FOLDERS4.has(folder)) return {};
|
|
6437
|
+
const directory = path51.dirname(filename);
|
|
6359
6438
|
let entries;
|
|
6360
6439
|
try {
|
|
6361
|
-
entries =
|
|
6440
|
+
entries = fs6.readdirSync(directory);
|
|
6362
6441
|
} catch {
|
|
6363
6442
|
return {};
|
|
6364
6443
|
}
|
|
@@ -6373,7 +6452,7 @@ var supportFolderShapeRule = {
|
|
|
6373
6452
|
for (const match of source.matchAll(exportPattern)) {
|
|
6374
6453
|
hasAnyReExport = true;
|
|
6375
6454
|
const specifier = match.groups?.specifier;
|
|
6376
|
-
if (specifier?.startsWith(".")) exportedFiles.add(
|
|
6455
|
+
if (specifier?.startsWith(".")) exportedFiles.add(path51.basename(specifier));
|
|
6377
6456
|
}
|
|
6378
6457
|
const guide = `docs/next-codebase-guide/rules/${folder === "constants" ? "constants" : "types-and-schemas"}-rule.md`;
|
|
6379
6458
|
if (siblingModules.length === 0) {
|
|
@@ -6552,14 +6631,14 @@ var baseLayerPairRule = {
|
|
|
6552
6631
|
|
|
6553
6632
|
// eslint/rules/tailwind/css-entry-point.ts
|
|
6554
6633
|
import { statSync as statSync4 } from "fs";
|
|
6555
|
-
import
|
|
6634
|
+
import path54 from "path";
|
|
6556
6635
|
|
|
6557
6636
|
// eslint/rules/tailwind/source-files.ts
|
|
6558
6637
|
import { readdirSync as readdirSync3, readFileSync as readFileSync9, statSync as statSync3 } from "fs";
|
|
6559
|
-
import
|
|
6638
|
+
import path52 from "path";
|
|
6560
6639
|
var CSS_EXTENSIONS = [".css"];
|
|
6561
|
-
var
|
|
6562
|
-
var SOURCE_EXTENSIONS = [...
|
|
6640
|
+
var MODULE_EXTENSIONS4 = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
6641
|
+
var SOURCE_EXTENSIONS = [...MODULE_EXTENSIONS4, ...CSS_EXTENSIONS];
|
|
6563
6642
|
function findFiles(dir, extensions) {
|
|
6564
6643
|
let entries;
|
|
6565
6644
|
try {
|
|
@@ -6569,7 +6648,7 @@ function findFiles(dir, extensions) {
|
|
|
6569
6648
|
}
|
|
6570
6649
|
return entries.flatMap((entry) => {
|
|
6571
6650
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
6572
|
-
const entryPath =
|
|
6651
|
+
const entryPath = path52.join(dir, entry);
|
|
6573
6652
|
let stats;
|
|
6574
6653
|
try {
|
|
6575
6654
|
stats = statSync3(entryPath);
|
|
@@ -6577,7 +6656,7 @@ function findFiles(dir, extensions) {
|
|
|
6577
6656
|
return [];
|
|
6578
6657
|
}
|
|
6579
6658
|
if (stats.isDirectory()) return findFiles(entryPath, extensions);
|
|
6580
|
-
return extensions.includes(
|
|
6659
|
+
return extensions.includes(path52.extname(entry)) ? [entryPath] : [];
|
|
6581
6660
|
});
|
|
6582
6661
|
}
|
|
6583
6662
|
function cachedTextReader() {
|
|
@@ -6600,7 +6679,7 @@ function escapeRegExp(text) {
|
|
|
6600
6679
|
}
|
|
6601
6680
|
|
|
6602
6681
|
// eslint/rules/tailwind/stylesheet-graph.ts
|
|
6603
|
-
import
|
|
6682
|
+
import path53 from "path";
|
|
6604
6683
|
function registersTailwind(text) {
|
|
6605
6684
|
return /@import\s+(?:url\(\s*)?["']tailwindcss["']\s*\)?/i.test(text);
|
|
6606
6685
|
}
|
|
@@ -6614,25 +6693,25 @@ function moduleImports(text, fileName) {
|
|
|
6614
6693
|
return new RegExp(`(?:import|require)\\s*\\(?\\s*["'][^"']*${escaped}["']`, "i").test(text);
|
|
6615
6694
|
}
|
|
6616
6695
|
function resolveSpecifier2(fromFile, spec, sourceRoot) {
|
|
6617
|
-
if (spec.startsWith("/")) return
|
|
6618
|
-
if (spec.startsWith("./") || spec.startsWith("../")) return
|
|
6619
|
-
if (spec.startsWith("@/")) return
|
|
6696
|
+
if (spec.startsWith("/")) return path53.resolve(spec);
|
|
6697
|
+
if (spec.startsWith("./") || spec.startsWith("../")) return path53.resolve(path53.dirname(fromFile), spec);
|
|
6698
|
+
if (spec.startsWith("@/")) return path53.resolve(sourceRoot, spec.slice(2));
|
|
6620
6699
|
return void 0;
|
|
6621
6700
|
}
|
|
6622
6701
|
function buildStylesheetGraph(options) {
|
|
6623
6702
|
const { cssFiles, sourceRoot, textOf } = options;
|
|
6624
|
-
const cssSet = new Set(cssFiles.map((file) =>
|
|
6703
|
+
const cssSet = new Set(cssFiles.map((file) => path53.normalize(file)));
|
|
6625
6704
|
const globals = cssFiles.filter((file) => registersTailwind(textOf(file)));
|
|
6626
6705
|
const reachable = /* @__PURE__ */ new Set();
|
|
6627
6706
|
const queue = [...globals];
|
|
6628
|
-
for (const global of globals) reachable.add(
|
|
6707
|
+
for (const global of globals) reachable.add(path53.normalize(global));
|
|
6629
6708
|
while (queue.length > 0) {
|
|
6630
6709
|
const from = queue.shift();
|
|
6631
6710
|
if (!from) continue;
|
|
6632
6711
|
for (const spec of importedSpecifiers(textOf(from))) {
|
|
6633
6712
|
const target = resolveSpecifier2(from, spec, sourceRoot);
|
|
6634
6713
|
if (!target) continue;
|
|
6635
|
-
const normalized =
|
|
6714
|
+
const normalized = path53.normalize(target);
|
|
6636
6715
|
if (cssSet.has(normalized) && !reachable.has(normalized)) {
|
|
6637
6716
|
reachable.add(normalized);
|
|
6638
6717
|
queue.push(normalized);
|
|
@@ -6644,7 +6723,7 @@ function buildStylesheetGraph(options) {
|
|
|
6644
6723
|
for (const spec of importedSpecifiers(textOf(global))) {
|
|
6645
6724
|
const target = resolveSpecifier2(global, spec, sourceRoot);
|
|
6646
6725
|
if (!target) continue;
|
|
6647
|
-
const normalized =
|
|
6726
|
+
const normalized = path53.normalize(target);
|
|
6648
6727
|
if (cssSet.has(normalized)) directChildren.add(normalized);
|
|
6649
6728
|
}
|
|
6650
6729
|
}
|
|
@@ -6652,8 +6731,8 @@ function buildStylesheetGraph(options) {
|
|
|
6652
6731
|
}
|
|
6653
6732
|
|
|
6654
6733
|
// eslint/rules/tailwind/css-entry-point.ts
|
|
6655
|
-
var APP_STYLES_DIR =
|
|
6656
|
-
var GLOBAL_STYLESHEET_PATH =
|
|
6734
|
+
var APP_STYLES_DIR = path54.join("app", "styles");
|
|
6735
|
+
var GLOBAL_STYLESHEET_PATH = path54.join(APP_STYLES_DIR, "globals.css");
|
|
6657
6736
|
var cssEntryPointRule = {
|
|
6658
6737
|
meta: {
|
|
6659
6738
|
schema: [],
|
|
@@ -6669,7 +6748,7 @@ var cssEntryPointRule = {
|
|
|
6669
6748
|
try {
|
|
6670
6749
|
if (!statSync4(sourceRoot).isDirectory()) return {};
|
|
6671
6750
|
cssFiles = findFiles(sourceRoot, CSS_EXTENSIONS);
|
|
6672
|
-
moduleFiles = findFiles(sourceRoot,
|
|
6751
|
+
moduleFiles = findFiles(sourceRoot, MODULE_EXTENSIONS4);
|
|
6673
6752
|
} catch {
|
|
6674
6753
|
return {};
|
|
6675
6754
|
}
|
|
@@ -6679,8 +6758,8 @@ var cssEntryPointRule = {
|
|
|
6679
6758
|
return {
|
|
6680
6759
|
"StyleSheet:exit"(node) {
|
|
6681
6760
|
if (globals.length === 0) return;
|
|
6682
|
-
const current =
|
|
6683
|
-
const relative =
|
|
6761
|
+
const current = path54.normalize(path54.resolve(context.filename));
|
|
6762
|
+
const relative = path54.relative(sourceRoot, current);
|
|
6684
6763
|
if (globals.includes(current)) {
|
|
6685
6764
|
if (globals.length > 1) {
|
|
6686
6765
|
context.report({
|
|
@@ -6696,7 +6775,7 @@ var cssEntryPointRule = {
|
|
|
6696
6775
|
});
|
|
6697
6776
|
return;
|
|
6698
6777
|
}
|
|
6699
|
-
const basename =
|
|
6778
|
+
const basename = path54.basename(current);
|
|
6700
6779
|
const importCount = moduleFiles.filter((modulePath) => moduleImports(textOf(modulePath), basename)).length;
|
|
6701
6780
|
if (importCount !== 1) {
|
|
6702
6781
|
context.report({
|
|
@@ -6706,7 +6785,7 @@ var cssEntryPointRule = {
|
|
|
6706
6785
|
}
|
|
6707
6786
|
return;
|
|
6708
6787
|
}
|
|
6709
|
-
const isInAppStyles = relative === APP_STYLES_DIR || relative.startsWith(`${APP_STYLES_DIR}${
|
|
6788
|
+
const isInAppStyles = relative === APP_STYLES_DIR || relative.startsWith(`${APP_STYLES_DIR}${path54.sep}`);
|
|
6710
6789
|
if (!isInAppStyles) {
|
|
6711
6790
|
context.report({
|
|
6712
6791
|
node,
|
|
@@ -7195,7 +7274,7 @@ var tailwindRules = {
|
|
|
7195
7274
|
};
|
|
7196
7275
|
|
|
7197
7276
|
// eslint/rules/type-extraction.ts
|
|
7198
|
-
import
|
|
7277
|
+
import path55 from "path";
|
|
7199
7278
|
var typeExtractionRule = {
|
|
7200
7279
|
meta: {
|
|
7201
7280
|
schema: [],
|
|
@@ -7206,7 +7285,7 @@ var typeExtractionRule = {
|
|
|
7206
7285
|
},
|
|
7207
7286
|
create(context) {
|
|
7208
7287
|
const sourceRoot = sourceRootOf(context);
|
|
7209
|
-
const file =
|
|
7288
|
+
const file = path55.resolve(context.filename);
|
|
7210
7289
|
const segments = segmentsOf(file, sourceRoot);
|
|
7211
7290
|
if (segments.length === 0) return {};
|
|
7212
7291
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -7341,7 +7420,7 @@ var uiStateRule = {
|
|
|
7341
7420
|
// eslint/rules/unknown-utility.ts
|
|
7342
7421
|
import { existsSync as existsSync6, readdirSync as readdirSync4, readFileSync as readFileSync10, statSync as statSync6 } from "fs";
|
|
7343
7422
|
import { createRequire } from "module";
|
|
7344
|
-
import
|
|
7423
|
+
import path56 from "path";
|
|
7345
7424
|
var PREFIX_NAMESPACES = {
|
|
7346
7425
|
bg: ["color"],
|
|
7347
7426
|
text: ["color", "text"],
|
|
@@ -7581,7 +7660,7 @@ function stylesheetFiles(dir) {
|
|
|
7581
7660
|
}
|
|
7582
7661
|
return entries.flatMap((entry) => {
|
|
7583
7662
|
if (entry.startsWith(".") || entry === "node_modules") return [];
|
|
7584
|
-
const entryPath =
|
|
7663
|
+
const entryPath = path56.join(dir, entry);
|
|
7585
7664
|
let stats;
|
|
7586
7665
|
try {
|
|
7587
7666
|
stats = statSync6(entryPath);
|
|
@@ -7589,7 +7668,7 @@ function stylesheetFiles(dir) {
|
|
|
7589
7668
|
return [];
|
|
7590
7669
|
}
|
|
7591
7670
|
if (stats.isDirectory()) return stylesheetFiles(entryPath);
|
|
7592
|
-
return
|
|
7671
|
+
return path56.extname(entry) === ".css" ? [entryPath] : [];
|
|
7593
7672
|
});
|
|
7594
7673
|
}
|
|
7595
7674
|
function packageNameOf(specifier) {
|
|
@@ -7600,10 +7679,10 @@ function packageNameOf(specifier) {
|
|
|
7600
7679
|
function resolvePackageStylesheet(fromFile, specifier) {
|
|
7601
7680
|
const packageName = packageNameOf(specifier);
|
|
7602
7681
|
if (!packageName || packageName === "tailwindcss") return void 0;
|
|
7603
|
-
let directory =
|
|
7604
|
-
while (directory !==
|
|
7605
|
-
const packageRoot =
|
|
7606
|
-
const manifestPath =
|
|
7682
|
+
let directory = path56.dirname(fromFile);
|
|
7683
|
+
while (directory !== path56.dirname(directory)) {
|
|
7684
|
+
const packageRoot = path56.join(directory, "node_modules", packageName);
|
|
7685
|
+
const manifestPath = path56.join(packageRoot, "package.json");
|
|
7607
7686
|
if (existsSync6(manifestPath)) {
|
|
7608
7687
|
try {
|
|
7609
7688
|
const manifest = readFileSync10(manifestPath, "utf8");
|
|
@@ -7611,13 +7690,13 @@ function resolvePackageStylesheet(fromFile, specifier) {
|
|
|
7611
7690
|
const main = /"main"\s*:\s*"(?<file>[^"]+\.css)"/.exec(manifest)?.groups?.file;
|
|
7612
7691
|
const target = stylesheet ?? main;
|
|
7613
7692
|
if (!target) return void 0;
|
|
7614
|
-
const resolved =
|
|
7693
|
+
const resolved = path56.resolve(packageRoot, target);
|
|
7615
7694
|
return existsSync6(resolved) ? resolved : void 0;
|
|
7616
7695
|
} catch {
|
|
7617
7696
|
return void 0;
|
|
7618
7697
|
}
|
|
7619
7698
|
}
|
|
7620
|
-
directory =
|
|
7699
|
+
directory = path56.dirname(directory);
|
|
7621
7700
|
}
|
|
7622
7701
|
return void 0;
|
|
7623
7702
|
}
|
|
@@ -7868,7 +7947,7 @@ var unknownUtilityRule = {
|
|
|
7868
7947
|
};
|
|
7869
7948
|
|
|
7870
7949
|
// eslint/rules/util-file-name.ts
|
|
7871
|
-
import
|
|
7950
|
+
import path57 from "path";
|
|
7872
7951
|
function toKebabCase2(value) {
|
|
7873
7952
|
return value.replace(/(?<lower>[a-z0-9])(?<upper>[A-Z])/g, "$<lower>-$<upper>").replace(/(?<first>[A-Z])(?<rest>[A-Z][a-z])/g, "$<first>-$<rest>").toLowerCase();
|
|
7874
7953
|
}
|
|
@@ -7881,7 +7960,7 @@ var utilFileNameRule = {
|
|
|
7881
7960
|
}
|
|
7882
7961
|
},
|
|
7883
7962
|
create(context) {
|
|
7884
|
-
const filename =
|
|
7963
|
+
const filename = path57.resolve(context.filename);
|
|
7885
7964
|
const segments = filename.replace(/\\/g, "/").split("/");
|
|
7886
7965
|
if (!segments.includes("utils")) return {};
|
|
7887
7966
|
let module;
|
|
@@ -7895,13 +7974,13 @@ var utilFileNameRule = {
|
|
|
7895
7974
|
const functionName = functions[0]?.name;
|
|
7896
7975
|
if (!functionName) return {};
|
|
7897
7976
|
const expected = toKebabCase2(functionName);
|
|
7898
|
-
const actual =
|
|
7977
|
+
const actual = path57.basename(filename, path57.extname(filename));
|
|
7899
7978
|
if (!expected || actual === expected) return {};
|
|
7900
7979
|
return {
|
|
7901
7980
|
Program(node) {
|
|
7902
7981
|
context.report({
|
|
7903
7982
|
node,
|
|
7904
|
-
message: `A utility file exporting ${functionName} must be named ${expected}.${
|
|
7983
|
+
message: `A utility file exporting ${functionName} must be named ${expected}.${path57.extname(filename).slice(1)}.`
|
|
7905
7984
|
});
|
|
7906
7985
|
}
|
|
7907
7986
|
};
|
|
@@ -7909,7 +7988,7 @@ var utilFileNameRule = {
|
|
|
7909
7988
|
};
|
|
7910
7989
|
|
|
7911
7990
|
// eslint/rules/value-extraction.ts
|
|
7912
|
-
import
|
|
7991
|
+
import path58 from "path";
|
|
7913
7992
|
var valueExtractionRule = {
|
|
7914
7993
|
meta: {
|
|
7915
7994
|
schema: [],
|
|
@@ -7920,7 +7999,7 @@ var valueExtractionRule = {
|
|
|
7920
7999
|
},
|
|
7921
8000
|
create(context) {
|
|
7922
8001
|
const sourceRoot = sourceRootOf(context);
|
|
7923
|
-
const file =
|
|
8002
|
+
const file = path58.resolve(context.filename);
|
|
7924
8003
|
const segments = segmentsOf(file, sourceRoot);
|
|
7925
8004
|
if (segments.length === 0 || segments[0] !== "app") return {};
|
|
7926
8005
|
const index = getProjectIndex(sourceRoot);
|
|
@@ -7942,7 +8021,7 @@ var valueExtractionRule = {
|
|
|
7942
8021
|
|
|
7943
8022
|
// eslint/rules/vulyk/tracked-docs.ts
|
|
7944
8023
|
import { existsSync as existsSync7, readFileSync as readFileSync11 } from "fs";
|
|
7945
|
-
import
|
|
8024
|
+
import path59 from "path";
|
|
7946
8025
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
7947
8026
|
var BASE_REQUIRED_TRACKED_DOCS = [
|
|
7948
8027
|
{ name: "documentation-guide", path: "docs/documentation-guide" },
|
|
@@ -7975,8 +8054,8 @@ var trackedDocsRule = {
|
|
|
7975
8054
|
if (!context.filename.endsWith("package.json")) return;
|
|
7976
8055
|
const root = node.body;
|
|
7977
8056
|
if (root.type !== "Object") return;
|
|
7978
|
-
const projectRoot =
|
|
7979
|
-
const configPath =
|
|
8057
|
+
const projectRoot = path59.dirname(path59.resolve(context.filename));
|
|
8058
|
+
const configPath = path59.join(projectRoot, "vulyk.config.ts");
|
|
7980
8059
|
if (!existsSync7(configPath)) {
|
|
7981
8060
|
context.report({
|
|
7982
8061
|
node,
|
|
@@ -8001,7 +8080,7 @@ var trackedDocsRule = {
|
|
|
8001
8080
|
});
|
|
8002
8081
|
}
|
|
8003
8082
|
}
|
|
8004
|
-
const agentsPath =
|
|
8083
|
+
const agentsPath = path59.join(projectRoot, "AGENTS.md");
|
|
8005
8084
|
if (!existsSync7(agentsPath)) {
|
|
8006
8085
|
context.report({
|
|
8007
8086
|
node,
|
|
@@ -8100,8 +8179,8 @@ var withResponseHelperRule = {
|
|
|
8100
8179
|
};
|
|
8101
8180
|
|
|
8102
8181
|
// eslint/rules/zirka-baseline.ts
|
|
8103
|
-
import
|
|
8104
|
-
import
|
|
8182
|
+
import fs7 from "fs";
|
|
8183
|
+
import path60 from "path";
|
|
8105
8184
|
var ESLINT_CONFIG = /^eslint\.config\.(?:ts|mts|cts|js|mjs|cjs)$/;
|
|
8106
8185
|
var PRETTIER_CONFIGS = [
|
|
8107
8186
|
"prettier.config.mjs",
|
|
@@ -8120,10 +8199,10 @@ var zirkaBaselineRule = {
|
|
|
8120
8199
|
}
|
|
8121
8200
|
},
|
|
8122
8201
|
create(context) {
|
|
8123
|
-
const filename =
|
|
8124
|
-
const basename =
|
|
8202
|
+
const filename = path60.resolve(context.filename);
|
|
8203
|
+
const basename = path60.basename(filename);
|
|
8125
8204
|
if (!ESLINT_CONFIG.test(basename)) return {};
|
|
8126
|
-
const projectRoot =
|
|
8205
|
+
const projectRoot = path60.dirname(filename);
|
|
8127
8206
|
const report3 = (message) => {
|
|
8128
8207
|
context.report({
|
|
8129
8208
|
node: context.sourceCode.ast,
|
|
@@ -8138,13 +8217,13 @@ var zirkaBaselineRule = {
|
|
|
8138
8217
|
'ESLint config must take its configuration from zirka (import { styleguide } from "zirka") instead of restating rules locally.'
|
|
8139
8218
|
);
|
|
8140
8219
|
}
|
|
8141
|
-
const tsconfigPath =
|
|
8142
|
-
if (!
|
|
8220
|
+
const tsconfigPath = path60.join(projectRoot, "tsconfig.json");
|
|
8221
|
+
if (!fs7.existsSync(tsconfigPath)) {
|
|
8143
8222
|
report3('No tsconfig.json found. Create one extending the zirka TypeScript base config ("zirka/typescript").');
|
|
8144
8223
|
} else {
|
|
8145
8224
|
let extendsValue;
|
|
8146
8225
|
try {
|
|
8147
|
-
const parsed = JSON.parse(
|
|
8226
|
+
const parsed = JSON.parse(fs7.readFileSync(tsconfigPath, "utf8"));
|
|
8148
8227
|
extendsValue = typeof parsed === "object" && parsed !== null && "extends" in parsed ? parsed.extends : void 0;
|
|
8149
8228
|
} catch {
|
|
8150
8229
|
report3(
|
|
@@ -8156,13 +8235,13 @@ var zirkaBaselineRule = {
|
|
|
8156
8235
|
report3('tsconfig.json must extend the zirka TypeScript base config ("zirka/typescript").');
|
|
8157
8236
|
}
|
|
8158
8237
|
}
|
|
8159
|
-
const prettierConfigFile = PRETTIER_CONFIGS.find((name) =>
|
|
8238
|
+
const prettierConfigFile = PRETTIER_CONFIGS.find((name) => fs7.existsSync(path60.join(projectRoot, name)));
|
|
8160
8239
|
if (!prettierConfigFile) {
|
|
8161
8240
|
report3(
|
|
8162
8241
|
"No prettier config found. Create one that takes its configuration from zirka (styleguide({ prettier: true }).prettierConfig)."
|
|
8163
8242
|
);
|
|
8164
8243
|
} else {
|
|
8165
|
-
const content =
|
|
8244
|
+
const content = fs7.readFileSync(path60.join(projectRoot, prettierConfigFile), "utf8");
|
|
8166
8245
|
if (!content.includes("zirka")) {
|
|
8167
8246
|
report3(
|
|
8168
8247
|
"The prettier config must take its configuration from zirka (styleguide({ prettier: true }).prettierConfig) instead of restating it locally."
|
|
@@ -8369,6 +8448,7 @@ var pasikaNextjsAppRules = {
|
|
|
8369
8448
|
"no-util-barrel": noUtilBarrelRule,
|
|
8370
8449
|
"no-redundant-alias": noRedundantAliasRule,
|
|
8371
8450
|
"enforce-barrel-exports": enforceBarrelExportsRule,
|
|
8451
|
+
"require-barrel-star-exports": requireBarrelStarExportsRule,
|
|
8372
8452
|
"config-extraction": configExtractionRule,
|
|
8373
8453
|
"value-extraction": valueExtractionRule,
|
|
8374
8454
|
"constant-casing": constantCasingRule,
|