pasika 0.7.2 → 0.7.4
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 +57 -21
- package/package.json +1 -1
|
@@ -4630,12 +4630,30 @@ var referenceBlockHeadingsRule = {
|
|
|
4630
4630
|
};
|
|
4631
4631
|
|
|
4632
4632
|
// eslint/rules/documentation/support-document-placement.ts
|
|
4633
|
+
import { existsSync as existsSync2 } from "fs";
|
|
4633
4634
|
import path39 from "path";
|
|
4635
|
+
function checkPlacement(filename, kind) {
|
|
4636
|
+
const parentFolder = path39.basename(path39.dirname(filename));
|
|
4637
|
+
const expectedParent = `${kind}s`;
|
|
4638
|
+
if (parentFolder !== expectedParent) {
|
|
4639
|
+
return `${kind} lives in "${parentFolder}/" instead of "${expectedParent}/"`;
|
|
4640
|
+
}
|
|
4641
|
+
const guideFolderPath = path39.dirname(path39.dirname(filename));
|
|
4642
|
+
const guideFolder = path39.basename(guideFolderPath);
|
|
4643
|
+
if (!guideFolder.endsWith("-guide")) {
|
|
4644
|
+
return `${kind} owner folder "${guideFolder}/" does not use the "*-guide/" suffix`;
|
|
4645
|
+
}
|
|
4646
|
+
const entryPoint = `${guideFolder}.md`;
|
|
4647
|
+
if (!existsSync2(path39.join(guideFolderPath, entryPoint))) {
|
|
4648
|
+
return `${kind} owner folder "${guideFolder}/" has no "${entryPoint}" entry point`;
|
|
4649
|
+
}
|
|
4650
|
+
return void 0;
|
|
4651
|
+
}
|
|
4634
4652
|
var supportDocumentPlacementRule = {
|
|
4635
4653
|
meta: {
|
|
4636
4654
|
type: "problem",
|
|
4637
4655
|
docs: {
|
|
4638
|
-
description: "Rules must
|
|
4656
|
+
description: "Rules and references must belong to a guide with a matching entry point.",
|
|
4639
4657
|
recommended: true
|
|
4640
4658
|
}
|
|
4641
4659
|
},
|
|
@@ -4644,17 +4662,15 @@ var supportDocumentPlacementRule = {
|
|
|
4644
4662
|
root(node) {
|
|
4645
4663
|
const filename = getFilename(context);
|
|
4646
4664
|
if (!filename.endsWith(".md")) return;
|
|
4647
|
-
|
|
4648
|
-
if (filename.endsWith("-rule.md")
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
}
|
|
4654
|
-
if (filename.endsWith("-reference.md") && parentFolder !== "references") {
|
|
4665
|
+
let kind;
|
|
4666
|
+
if (filename.endsWith("-rule.md")) kind = "rule";
|
|
4667
|
+
if (filename.endsWith("-reference.md")) kind = "reference";
|
|
4668
|
+
if (!kind) return;
|
|
4669
|
+
const message = checkPlacement(filename, kind);
|
|
4670
|
+
if (message) {
|
|
4655
4671
|
context.report({
|
|
4656
4672
|
node,
|
|
4657
|
-
message
|
|
4673
|
+
message
|
|
4658
4674
|
});
|
|
4659
4675
|
}
|
|
4660
4676
|
}
|
|
@@ -5072,7 +5088,7 @@ var glossaryTermLinkingRule = {
|
|
|
5072
5088
|
};
|
|
5073
5089
|
|
|
5074
5090
|
// eslint/rules/documentation/guide-mentions-documents.ts
|
|
5075
|
-
import { existsSync as
|
|
5091
|
+
import { existsSync as existsSync3 } from "fs";
|
|
5076
5092
|
import path43 from "path";
|
|
5077
5093
|
function visitSteps3(node, check) {
|
|
5078
5094
|
if (node.type === "list" && node.ordered) {
|
|
@@ -5139,7 +5155,7 @@ var guideMentionsDocumentsRule = {
|
|
|
5139
5155
|
const target = linkTarget(link.url);
|
|
5140
5156
|
if (!target.endsWith(".md")) continue;
|
|
5141
5157
|
const resolved = path43.normalize(path43.join(guideDir, target));
|
|
5142
|
-
if (!
|
|
5158
|
+
if (!existsSync3(resolved)) {
|
|
5143
5159
|
context.report({
|
|
5144
5160
|
node: link,
|
|
5145
5161
|
message: `Guide links a document that does not exist: ${link.url}`
|
|
@@ -6183,7 +6199,7 @@ var nextjsStackRule = {
|
|
|
6183
6199
|
};
|
|
6184
6200
|
|
|
6185
6201
|
// eslint/rules/package-json/vitest-coverage.ts
|
|
6186
|
-
import { existsSync as
|
|
6202
|
+
import { existsSync as existsSync4, readFileSync as readFileSync9 } from "fs";
|
|
6187
6203
|
import path47 from "path";
|
|
6188
6204
|
function memberName5(member) {
|
|
6189
6205
|
return member.name.type === "String" ? member.name.value : member.name.name;
|
|
@@ -6253,7 +6269,7 @@ var vitestCoverageRule = {
|
|
|
6253
6269
|
message: 'package.json must declare a "test:unit:coverage" script that runs Vitest with coverage.'
|
|
6254
6270
|
});
|
|
6255
6271
|
}
|
|
6256
|
-
const configName = VITEST_CONFIG_NAMES.find((name) =>
|
|
6272
|
+
const configName = VITEST_CONFIG_NAMES.find((name) => existsSync4(path47.join(context.cwd, name)));
|
|
6257
6273
|
if (!configName) {
|
|
6258
6274
|
context.report({
|
|
6259
6275
|
node,
|
|
@@ -6308,8 +6324,16 @@ var nextjsPackageJsonRules = {
|
|
|
6308
6324
|
};
|
|
6309
6325
|
|
|
6310
6326
|
// eslint/rules/husky/husky-hook.ts
|
|
6311
|
-
import { existsSync as
|
|
6327
|
+
import { existsSync as existsSync5, readFileSync as readFileSync10 } from "fs";
|
|
6312
6328
|
import path48 from "path";
|
|
6329
|
+
var VITEST_CONFIG_NAMES2 = [
|
|
6330
|
+
"vitest.config.ts",
|
|
6331
|
+
"vitest.config.mts",
|
|
6332
|
+
"vitest.config.cts",
|
|
6333
|
+
"vitest.config.js",
|
|
6334
|
+
"vitest.config.mjs",
|
|
6335
|
+
"vitest.config.cjs"
|
|
6336
|
+
];
|
|
6313
6337
|
function memberName6(member) {
|
|
6314
6338
|
return member.name.type === "String" ? member.name.value : member.name.name;
|
|
6315
6339
|
}
|
|
@@ -6318,7 +6342,7 @@ var huskyHookRule = {
|
|
|
6318
6342
|
schema: [],
|
|
6319
6343
|
type: "problem",
|
|
6320
6344
|
docs: {
|
|
6321
|
-
description: "Require a pre-commit hook that runs lint-staged
|
|
6345
|
+
description: "Require a pre-commit hook that runs lint-staged, typecheck, coverage with local threshold staging, suppression pruning when applicable, and the libyear drift check."
|
|
6322
6346
|
}
|
|
6323
6347
|
},
|
|
6324
6348
|
create(context) {
|
|
@@ -6328,7 +6352,7 @@ var huskyHookRule = {
|
|
|
6328
6352
|
if (root.type !== "Object") return;
|
|
6329
6353
|
if (!context.filename.endsWith("package.json")) return;
|
|
6330
6354
|
const hookPath = path48.join(context.cwd, ".husky", "pre-commit");
|
|
6331
|
-
if (!
|
|
6355
|
+
if (!existsSync5(hookPath)) {
|
|
6332
6356
|
context.report({
|
|
6333
6357
|
node,
|
|
6334
6358
|
message: "No .husky/pre-commit hook found. Configure husky to run checks before commits."
|
|
@@ -6350,11 +6374,23 @@ var huskyHookRule = {
|
|
|
6350
6374
|
context.report({ node, message: ".husky/pre-commit must run lint-staged." });
|
|
6351
6375
|
}
|
|
6352
6376
|
requireNamedScript("typecheck");
|
|
6377
|
+
requireNamedScript("test:unit:coverage");
|
|
6378
|
+
const vitestConfigName = VITEST_CONFIG_NAMES2.find((name) => existsSync5(path48.join(context.cwd, name)));
|
|
6379
|
+
if (vitestConfigName !== void 0) {
|
|
6380
|
+
const coverageIndex = content.indexOf("npm run test:unit:coverage");
|
|
6381
|
+
const localAddIndex = content.indexOf(`git add ${vitestConfigName}`);
|
|
6382
|
+
if (localAddIndex <= coverageIndex) {
|
|
6383
|
+
context.report({
|
|
6384
|
+
node,
|
|
6385
|
+
message: `.husky/pre-commit must stage an auto-updated ${vitestConfigName} after coverage.`
|
|
6386
|
+
});
|
|
6387
|
+
}
|
|
6388
|
+
}
|
|
6353
6389
|
if (!content.includes("libyear --limit-major-individual=1")) {
|
|
6354
6390
|
context.report({ node, message: ".husky/pre-commit must run npx libyear --limit-major-individual=1." });
|
|
6355
6391
|
}
|
|
6356
6392
|
const suppressionsPath = path48.join(context.cwd, "eslint-suppressions.json");
|
|
6357
|
-
if (
|
|
6393
|
+
if (existsSync5(suppressionsPath)) {
|
|
6358
6394
|
requireNamedScript("lint:prune");
|
|
6359
6395
|
}
|
|
6360
6396
|
if (scripts?.value.type === "Object") {
|
|
@@ -6377,7 +6413,7 @@ var huskyRules = {
|
|
|
6377
6413
|
};
|
|
6378
6414
|
|
|
6379
6415
|
// eslint/rules/vulyk/vulyk-docs.ts
|
|
6380
|
-
import { existsSync as
|
|
6416
|
+
import { existsSync as existsSync6, readFileSync as readFileSync11 } from "fs";
|
|
6381
6417
|
import path49 from "path";
|
|
6382
6418
|
var PASIKA_REPO = "Bredansky/pasika";
|
|
6383
6419
|
var BASE_REQUIRED_DOCS = [
|
|
@@ -6413,7 +6449,7 @@ var vulykDocsRule = {
|
|
|
6413
6449
|
if (root.type !== "Object") return;
|
|
6414
6450
|
const projectRoot = path49.dirname(path49.resolve(context.filename));
|
|
6415
6451
|
const configPath = path49.join(projectRoot, "vulyk.config.ts");
|
|
6416
|
-
if (!
|
|
6452
|
+
if (!existsSync6(configPath)) {
|
|
6417
6453
|
context.report({
|
|
6418
6454
|
node,
|
|
6419
6455
|
message: "No vulyk.config.ts found. Run npx vulyk@latest init to create one that tracks the framework's docs."
|
|
@@ -6438,7 +6474,7 @@ var vulykDocsRule = {
|
|
|
6438
6474
|
}
|
|
6439
6475
|
}
|
|
6440
6476
|
const agentsPath = path49.join(projectRoot, "AGENTS.md");
|
|
6441
|
-
if (!
|
|
6477
|
+
if (!existsSync6(agentsPath)) {
|
|
6442
6478
|
context.report({
|
|
6443
6479
|
node,
|
|
6444
6480
|
message: "No AGENTS.md found. Run npx vulyk@latest agents to generate the agent file that routes to the tracked docs."
|