pasika 0.7.5 → 0.7.7
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 +21 -4
- package/package.json +1 -1
|
@@ -2056,7 +2056,7 @@ var supportFolderShapeRule = {
|
|
|
2056
2056
|
schema: [],
|
|
2057
2057
|
type: "problem",
|
|
2058
2058
|
docs: {
|
|
2059
|
-
description: "Require support
|
|
2059
|
+
description: "Require a support folder to either define its exports directly in index.ts or re-export every sibling from it, never both."
|
|
2060
2060
|
}
|
|
2061
2061
|
},
|
|
2062
2062
|
create(context) {
|
|
@@ -2078,13 +2078,22 @@ var supportFolderShapeRule = {
|
|
|
2078
2078
|
Program(node) {
|
|
2079
2079
|
const source = context.sourceCode.text;
|
|
2080
2080
|
const hasDirectExport = /export\s+(?:const|let|var|function|class|type|interface|enum)\b/.test(source);
|
|
2081
|
-
if (hasDirectExport) return;
|
|
2082
2081
|
const exportedFiles = /* @__PURE__ */ new Set();
|
|
2083
2082
|
const exportPattern = /export\s+(?:\{[^}]*\}|\*[^;]*)\s+from\s+["'](?<specifier>\.[^"']+)["']/g;
|
|
2084
2083
|
for (const match of source.matchAll(exportPattern)) {
|
|
2085
2084
|
const specifier = match.groups?.specifier;
|
|
2086
2085
|
if (specifier) exportedFiles.add(path16.basename(specifier));
|
|
2087
2086
|
}
|
|
2087
|
+
const hasAnyReExport = exportedFiles.size > 0;
|
|
2088
|
+
const guide = `docs/next-codebase-guide/rules/${folder === "constants" ? "constants" : "types-and-schemas"}-rule.md`;
|
|
2089
|
+
if (hasDirectExport && hasAnyReExport) {
|
|
2090
|
+
context.report({
|
|
2091
|
+
node,
|
|
2092
|
+
message: `${folder}/index.ts mixes direct exports with re-exported support files; pick one strategy for the whole folder. See ${guide}`
|
|
2093
|
+
});
|
|
2094
|
+
return;
|
|
2095
|
+
}
|
|
2096
|
+
if (hasDirectExport) return;
|
|
2088
2097
|
const missing = siblingModules.filter((entry) => {
|
|
2089
2098
|
const stem = entry.replace(/\.(?:[cm]?tsx?|jsx?)$/, "");
|
|
2090
2099
|
return !exportedFiles.has(stem);
|
|
@@ -2092,7 +2101,7 @@ var supportFolderShapeRule = {
|
|
|
2092
2101
|
if (missing.length === 0) return;
|
|
2093
2102
|
context.report({
|
|
2094
2103
|
node,
|
|
2095
|
-
message: `${folder}/index.ts must
|
|
2104
|
+
message: `${folder}/index.ts must re-export every support file: ${missing.join(", ")}. See ${guide}`
|
|
2096
2105
|
});
|
|
2097
2106
|
}
|
|
2098
2107
|
};
|
|
@@ -6308,7 +6317,7 @@ var huskyHookRule = {
|
|
|
6308
6317
|
schema: [],
|
|
6309
6318
|
type: "problem",
|
|
6310
6319
|
docs: {
|
|
6311
|
-
description: "Require a pre-commit hook that runs lint-staged, typecheck, coverage
|
|
6320
|
+
description: "Require a pre-commit hook that runs lint-staged, typecheck, coverage and suppression pruning with local staging, and the libyear drift check."
|
|
6312
6321
|
}
|
|
6313
6322
|
},
|
|
6314
6323
|
create(context) {
|
|
@@ -6358,6 +6367,14 @@ var huskyHookRule = {
|
|
|
6358
6367
|
const suppressionsPath = path48.join(context.cwd, "eslint-suppressions.json");
|
|
6359
6368
|
if (existsSync5(suppressionsPath)) {
|
|
6360
6369
|
requireNamedScript("lint:prune");
|
|
6370
|
+
const pruneIndex = content.indexOf("npm run lint:prune");
|
|
6371
|
+
const localAddIndex = content.indexOf("git add eslint-suppressions.json");
|
|
6372
|
+
if (localAddIndex <= pruneIndex) {
|
|
6373
|
+
context.report({
|
|
6374
|
+
node,
|
|
6375
|
+
message: ".husky/pre-commit must stage eslint-suppressions.json after pruning suppressions."
|
|
6376
|
+
});
|
|
6377
|
+
}
|
|
6361
6378
|
}
|
|
6362
6379
|
if (scripts?.value.type === "Object") {
|
|
6363
6380
|
const prepare = scripts.value.members.find((member) => memberName5(member) === "prepare");
|