pasika 0.10.47 → 0.10.48
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 +30 -38
- package/package.json +1 -1
|
@@ -3363,14 +3363,6 @@ var httpErrorUsageRule = {
|
|
|
3363
3363
|
// eslint/rules/husky/husky-hook.ts
|
|
3364
3364
|
import { existsSync as existsSync4, readFileSync as readFileSync6 } from "fs";
|
|
3365
3365
|
import path28 from "path";
|
|
3366
|
-
var VITEST_CONFIG_NAMES = [
|
|
3367
|
-
"vitest.config.ts",
|
|
3368
|
-
"vitest.config.mts",
|
|
3369
|
-
"vitest.config.cts",
|
|
3370
|
-
"vitest.config.js",
|
|
3371
|
-
"vitest.config.mjs",
|
|
3372
|
-
"vitest.config.cjs"
|
|
3373
|
-
];
|
|
3374
3366
|
function memberName(member) {
|
|
3375
3367
|
return member.name.type === "String" ? member.name.value : member.name.name;
|
|
3376
3368
|
}
|
|
@@ -3379,7 +3371,7 @@ var huskyHookRule = {
|
|
|
3379
3371
|
schema: [],
|
|
3380
3372
|
type: "problem",
|
|
3381
3373
|
docs: {
|
|
3382
|
-
description: "Require a pre-commit hook that runs lint-staged, typecheck, coverage
|
|
3374
|
+
description: "Require a pre-commit hook that runs lint-staged, typecheck, coverage, suppression pruning, and the libyear drift check."
|
|
3383
3375
|
}
|
|
3384
3376
|
},
|
|
3385
3377
|
create(context) {
|
|
@@ -3412,17 +3404,6 @@ var huskyHookRule = {
|
|
|
3412
3404
|
}
|
|
3413
3405
|
requireNamedScript("typecheck");
|
|
3414
3406
|
requireNamedScript("test:unit:coverage");
|
|
3415
|
-
const vitestConfigName = VITEST_CONFIG_NAMES.find((name) => existsSync4(path28.join(context.cwd, name)));
|
|
3416
|
-
if (vitestConfigName !== void 0) {
|
|
3417
|
-
const coverageIndex = content.indexOf("npm run test:unit:coverage");
|
|
3418
|
-
const localAddIndex = content.indexOf(`git add ${vitestConfigName}`);
|
|
3419
|
-
if (localAddIndex <= coverageIndex) {
|
|
3420
|
-
context.report({
|
|
3421
|
-
node,
|
|
3422
|
-
message: `.husky/pre-commit must stage an auto-updated ${vitestConfigName} after coverage.`
|
|
3423
|
-
});
|
|
3424
|
-
}
|
|
3425
|
-
}
|
|
3426
3407
|
if (!content.includes("libyear --limit-major-individual=1")) {
|
|
3427
3408
|
context.report({ node, message: ".husky/pre-commit must run npx libyear --limit-major-individual=1." });
|
|
3428
3409
|
}
|
|
@@ -4705,19 +4686,15 @@ var DOC3 = "See docs/next-codebase-guide/rules/redundant-aliases-rule.md";
|
|
|
4705
4686
|
var VALUE_SENTINELS = /* @__PURE__ */ new Set(["undefined", "NaN", "Infinity"]);
|
|
4706
4687
|
var HTTP_METHODS = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);
|
|
4707
4688
|
function entityNameText(name) {
|
|
4708
|
-
if (!name) return void 0;
|
|
4709
4689
|
if (name.type === "Identifier") return name.name;
|
|
4710
4690
|
if (name.type === "TSQualifiedName") {
|
|
4711
4691
|
const left = entityNameText(name.left);
|
|
4712
|
-
const right = name.right
|
|
4692
|
+
const right = name.right.name;
|
|
4713
4693
|
return left && right ? `${left}.${right}` : void 0;
|
|
4714
4694
|
}
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
return object && property ? `${object}.${property}` : void 0;
|
|
4719
|
-
}
|
|
4720
|
-
return void 0;
|
|
4695
|
+
const object = entityNameText(name.object);
|
|
4696
|
+
const property = name.property.name;
|
|
4697
|
+
return object && property ? `${object}.${property}` : void 0;
|
|
4721
4698
|
}
|
|
4722
4699
|
function aliasMessage(alias, source) {
|
|
4723
4700
|
const aliasName = alias ?? "This declaration";
|
|
@@ -4757,16 +4734,31 @@ var noRedundantAliasRule = {
|
|
|
4757
4734
|
message: aliasMessage(node.id?.name, source)
|
|
4758
4735
|
});
|
|
4759
4736
|
},
|
|
4737
|
+
ExportNamedDeclaration(node) {
|
|
4738
|
+
for (const specifier of node.specifiers) {
|
|
4739
|
+
if (specifier.local.type !== "Identifier" || specifier.exported.type !== "Identifier") continue;
|
|
4740
|
+
const source = specifier.local.name;
|
|
4741
|
+
const alias = specifier.exported.name;
|
|
4742
|
+
if (source === alias) continue;
|
|
4743
|
+
const frameworkRouteAlias = path37.basename(context.filename) === "route.ts" && HTTP_METHODS.has(alias);
|
|
4744
|
+
if (frameworkRouteAlias) continue;
|
|
4745
|
+
context.report({
|
|
4746
|
+
node: specifier,
|
|
4747
|
+
message: aliasMessage(alias, source)
|
|
4748
|
+
});
|
|
4749
|
+
}
|
|
4750
|
+
},
|
|
4760
4751
|
TSInterfaceDeclaration(node) {
|
|
4761
4752
|
if (node.typeParameters || node.body?.body?.length !== 0 || node.extends?.length !== 1) return;
|
|
4762
|
-
const heritage
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4753
|
+
for (const heritage of node.extends) {
|
|
4754
|
+
if (heritage.typeArguments) return;
|
|
4755
|
+
const source = entityNameText(heritage.expression);
|
|
4756
|
+
if (!source) return;
|
|
4757
|
+
context.report({
|
|
4758
|
+
node,
|
|
4759
|
+
message: aliasMessage(node.id?.name, source)
|
|
4760
|
+
});
|
|
4761
|
+
}
|
|
4770
4762
|
}
|
|
4771
4763
|
};
|
|
4772
4764
|
}
|
|
@@ -5046,7 +5038,7 @@ function stringValues2(value) {
|
|
|
5046
5038
|
if (value.type !== "Array") return [];
|
|
5047
5039
|
return value.elements.flatMap((element) => element.value.type === "String" ? [element.value.value] : []);
|
|
5048
5040
|
}
|
|
5049
|
-
var
|
|
5041
|
+
var VITEST_CONFIG_NAMES = [
|
|
5050
5042
|
"vitest.config.ts",
|
|
5051
5043
|
"vitest.config.mts",
|
|
5052
5044
|
"vitest.config.cts",
|
|
@@ -5103,7 +5095,7 @@ var vitestCoverageRule = {
|
|
|
5103
5095
|
message: 'package.json must declare a "test:unit:coverage" script that runs Vitest with coverage.'
|
|
5104
5096
|
});
|
|
5105
5097
|
}
|
|
5106
|
-
const configName =
|
|
5098
|
+
const configName = VITEST_CONFIG_NAMES.find((name) => existsSync5(path39.join(context.cwd, name)));
|
|
5107
5099
|
if (!configName) {
|
|
5108
5100
|
context.report({
|
|
5109
5101
|
node,
|