pasika 0.10.42 → 0.10.43
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.
|
@@ -201,6 +201,7 @@ declare const pasikaPlugin: {
|
|
|
201
201
|
"import-through-index": eslint.Rule.RuleModule;
|
|
202
202
|
"util-file-name": eslint.Rule.RuleModule;
|
|
203
203
|
"no-util-barrel": eslint.Rule.RuleModule;
|
|
204
|
+
"no-redundant-alias": eslint.Rule.RuleModule;
|
|
204
205
|
"enforce-barrel-exports": eslint.Rule.RuleModule;
|
|
205
206
|
"config-extraction": eslint.Rule.RuleModule;
|
|
206
207
|
"value-extraction": eslint.Rule.RuleModule;
|
|
@@ -4708,6 +4708,73 @@ var noMixedConcernsRule = {
|
|
|
4708
4708
|
}
|
|
4709
4709
|
};
|
|
4710
4710
|
|
|
4711
|
+
// eslint/rules/no-redundant-alias.ts
|
|
4712
|
+
var DOC3 = "See docs/next-codebase-guide/rules/redundant-aliases-rule.md";
|
|
4713
|
+
var VALUE_SENTINELS = /* @__PURE__ */ new Set(["undefined", "NaN", "Infinity"]);
|
|
4714
|
+
function entityNameText(name) {
|
|
4715
|
+
if (!name) return void 0;
|
|
4716
|
+
if (name.type === "Identifier") return name.name;
|
|
4717
|
+
if (name.type === "TSQualifiedName") {
|
|
4718
|
+
const left = entityNameText(name.left);
|
|
4719
|
+
const right = name.right?.name;
|
|
4720
|
+
return left && right ? `${left}.${right}` : void 0;
|
|
4721
|
+
}
|
|
4722
|
+
if (name.type === "MemberExpression" && !name.computed) {
|
|
4723
|
+
const object = entityNameText(name.object);
|
|
4724
|
+
const property = name.property?.name;
|
|
4725
|
+
return object && property ? `${object}.${property}` : void 0;
|
|
4726
|
+
}
|
|
4727
|
+
return void 0;
|
|
4728
|
+
}
|
|
4729
|
+
function aliasMessage(alias, source) {
|
|
4730
|
+
const aliasName = alias ?? "This declaration";
|
|
4731
|
+
const sourceName = source ?? "the original symbol";
|
|
4732
|
+
return `"${aliasName}" only renames "${sourceName}". Use "${sourceName}" directly or rename the original symbol and its consumers. ${DOC3}`;
|
|
4733
|
+
}
|
|
4734
|
+
var noRedundantAliasRule = {
|
|
4735
|
+
meta: {
|
|
4736
|
+
schema: [],
|
|
4737
|
+
type: "problem",
|
|
4738
|
+
docs: {
|
|
4739
|
+
description: "Disallow declarations that only give an existing symbol a second name."
|
|
4740
|
+
}
|
|
4741
|
+
},
|
|
4742
|
+
create(context) {
|
|
4743
|
+
return {
|
|
4744
|
+
VariableDeclarator(node) {
|
|
4745
|
+
if (node.id.type !== "Identifier" || node.init?.type !== "Identifier") return;
|
|
4746
|
+
if (VALUE_SENTINELS.has(node.init.name)) return;
|
|
4747
|
+
context.report({
|
|
4748
|
+
node,
|
|
4749
|
+
message: aliasMessage(node.id.name, node.init.name)
|
|
4750
|
+
});
|
|
4751
|
+
},
|
|
4752
|
+
TSTypeAliasDeclaration(node) {
|
|
4753
|
+
if (node.typeParameters) return;
|
|
4754
|
+
const annotation = node.typeAnnotation;
|
|
4755
|
+
if (annotation?.type !== "TSTypeReference" || annotation.typeArguments) return;
|
|
4756
|
+
const source = entityNameText(annotation.typeName);
|
|
4757
|
+
if (!source) return;
|
|
4758
|
+
context.report({
|
|
4759
|
+
node,
|
|
4760
|
+
message: aliasMessage(node.id?.name, source)
|
|
4761
|
+
});
|
|
4762
|
+
},
|
|
4763
|
+
TSInterfaceDeclaration(node) {
|
|
4764
|
+
if (node.typeParameters || node.body?.body?.length !== 0 || node.extends?.length !== 1) return;
|
|
4765
|
+
const heritage = node.extends[0];
|
|
4766
|
+
if (heritage?.typeArguments) return;
|
|
4767
|
+
const source = entityNameText(heritage?.expression);
|
|
4768
|
+
if (!source) return;
|
|
4769
|
+
context.report({
|
|
4770
|
+
node,
|
|
4771
|
+
message: aliasMessage(node.id?.name, source)
|
|
4772
|
+
});
|
|
4773
|
+
}
|
|
4774
|
+
};
|
|
4775
|
+
}
|
|
4776
|
+
};
|
|
4777
|
+
|
|
4711
4778
|
// eslint/rules/no-util-barrel.ts
|
|
4712
4779
|
import path37 from "path";
|
|
4713
4780
|
var noUtilBarrelRule = {
|
|
@@ -7718,9 +7785,9 @@ var vulykRules = {
|
|
|
7718
7785
|
// eslint/rules/with-response-helper.ts
|
|
7719
7786
|
var HELPER2 = "withResponse";
|
|
7720
7787
|
var ENTRY2 = "pasika/with-response";
|
|
7721
|
-
var
|
|
7722
|
-
var DECLARED2 = `A repository must not declare its own ${HELPER2}; import it from ${ENTRY2}. See ${
|
|
7723
|
-
var IMPORTED2 = `${HELPER2} must be imported from ${ENTRY2}. See ${
|
|
7788
|
+
var DOC4 = "docs/pasika-adoption-guide/rules/with-response-helper-rule.md";
|
|
7789
|
+
var DECLARED2 = `A repository must not declare its own ${HELPER2}; import it from ${ENTRY2}. See ${DOC4}`;
|
|
7790
|
+
var IMPORTED2 = `${HELPER2} must be imported from ${ENTRY2}. See ${DOC4}`;
|
|
7724
7791
|
function isNamed2(node, name) {
|
|
7725
7792
|
return node?.type === "Identifier" && node.name === name;
|
|
7726
7793
|
}
|
|
@@ -7841,10 +7908,10 @@ function referencesZirka(sourceCode) {
|
|
|
7841
7908
|
// eslint/rules/zod-fetch-helper.ts
|
|
7842
7909
|
var HELPER3 = "zodFetch";
|
|
7843
7910
|
var ENTRY3 = "pasika/zod-fetch";
|
|
7844
|
-
var
|
|
7845
|
-
var FETCHED = `fetch must not be called; make the request through ${HELPER3} from ${ENTRY3}. See ${
|
|
7846
|
-
var DECLARED3 = `A file must not declare its own ${HELPER3}; import it from ${ENTRY3}. See ${
|
|
7847
|
-
var IMPORTED3 = `${HELPER3} must be imported from ${ENTRY3}. See ${
|
|
7911
|
+
var DOC5 = "docs/pasika-adoption-guide/rules/zod-fetch-helper-rule.md";
|
|
7912
|
+
var FETCHED = `fetch must not be called; make the request through ${HELPER3} from ${ENTRY3}. See ${DOC5}`;
|
|
7913
|
+
var DECLARED3 = `A file must not declare its own ${HELPER3}; import it from ${ENTRY3}. See ${DOC5}`;
|
|
7914
|
+
var IMPORTED3 = `${HELPER3} must be imported from ${ENTRY3}. See ${DOC5}`;
|
|
7848
7915
|
var GLOBAL_OBJECTS = /* @__PURE__ */ new Set(["globalThis", "window", "self", "global"]);
|
|
7849
7916
|
var TEST_FILE = /(?:^|[\\/])(?:__tests__|tests)[\\/]|[.](?:test|spec)[.][cm]?[jt]sx?$/;
|
|
7850
7917
|
function isNamed3(node, name) {
|
|
@@ -8022,6 +8089,7 @@ var pasikaNextjsAppRules = {
|
|
|
8022
8089
|
"import-through-index": importThroughIndexRule,
|
|
8023
8090
|
"util-file-name": utilFileNameRule,
|
|
8024
8091
|
"no-util-barrel": noUtilBarrelRule,
|
|
8092
|
+
"no-redundant-alias": noRedundantAliasRule,
|
|
8025
8093
|
"enforce-barrel-exports": enforceBarrelExportsRule,
|
|
8026
8094
|
"config-extraction": configExtractionRule,
|
|
8027
8095
|
"value-extraction": valueExtractionRule,
|