pasika 0.10.41 → 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 = {
@@ -5177,13 +5244,15 @@ var pureFunctionExtractRule = {
5177
5244
  create(context) {
5178
5245
  const filename = context.filename;
5179
5246
  const isRouteFile = path40.basename(filename) === "route.ts";
5180
- const isSourceFile = /\.(?:[cm]?[jt]sx?)$/.test(filename);
5181
- if (!isSourceFile && !isRouteFile) return {};
5247
+ const isComponentFile = filename.endsWith(".tsx") || filename.endsWith(".jsx");
5182
5248
  const sourceRoot = sourceRootOf(context);
5183
5249
  const relative = path40.relative(sourceRoot, filename);
5184
5250
  if (relative.startsWith("..")) return {};
5185
5251
  const segments = relative.split(path40.sep);
5186
- if (segments.slice(0, -1).includes("utils")) return {};
5252
+ const folders = segments.slice(0, -1);
5253
+ const isHookSupportFile = folders.includes("hooks") && /\.(?:[cm]?[jt]s)$/.test(filename);
5254
+ if (!isComponentFile && !isRouteFile && !isHookSupportFile) return {};
5255
+ if (folders.includes("utils")) return {};
5187
5256
  if (segments[0] === "app" && !isRouteFile) return {};
5188
5257
  function report3(node, name) {
5189
5258
  context.report({
@@ -5200,6 +5269,7 @@ var pureFunctionExtractRule = {
5200
5269
  if (!name) return;
5201
5270
  if (isRouteFile && ROUTE_HANDLER_EXPORT_NAMES.has(name)) return;
5202
5271
  if (isComponentLikeName(name) || isHookName3(name)) return;
5272
+ if (isHookSupportFile && node.async) return;
5203
5273
  if (!node.body || hasHookUsage(node.body)) return;
5204
5274
  report3(node, name);
5205
5275
  },
@@ -5217,6 +5287,7 @@ var pureFunctionExtractRule = {
5217
5287
  if (!init || init.type !== "ArrowFunctionExpression" && init.type !== "FunctionExpression") {
5218
5288
  return;
5219
5289
  }
5290
+ if (isHookSupportFile && init.async) return;
5220
5291
  if (init.body.type === "BlockStatement" && hasHookUsage(init.body)) return;
5221
5292
  report3(node, name);
5222
5293
  }
@@ -7714,9 +7785,9 @@ var vulykRules = {
7714
7785
  // eslint/rules/with-response-helper.ts
7715
7786
  var HELPER2 = "withResponse";
7716
7787
  var ENTRY2 = "pasika/with-response";
7717
- var DOC3 = "docs/pasika-adoption-guide/rules/with-response-helper-rule.md";
7718
- var DECLARED2 = `A repository must not declare its own ${HELPER2}; import it from ${ENTRY2}. See ${DOC3}`;
7719
- var IMPORTED2 = `${HELPER2} must be imported from ${ENTRY2}. See ${DOC3}`;
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}`;
7720
7791
  function isNamed2(node, name) {
7721
7792
  return node?.type === "Identifier" && node.name === name;
7722
7793
  }
@@ -7837,10 +7908,10 @@ function referencesZirka(sourceCode) {
7837
7908
  // eslint/rules/zod-fetch-helper.ts
7838
7909
  var HELPER3 = "zodFetch";
7839
7910
  var ENTRY3 = "pasika/zod-fetch";
7840
- var DOC4 = "docs/pasika-adoption-guide/rules/zod-fetch-helper-rule.md";
7841
- var FETCHED = `fetch must not be called; make the request through ${HELPER3} from ${ENTRY3}. See ${DOC4}`;
7842
- var DECLARED3 = `A file must not declare its own ${HELPER3}; import it from ${ENTRY3}. See ${DOC4}`;
7843
- var IMPORTED3 = `${HELPER3} must be imported from ${ENTRY3}. See ${DOC4}`;
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}`;
7844
7915
  var GLOBAL_OBJECTS = /* @__PURE__ */ new Set(["globalThis", "window", "self", "global"]);
7845
7916
  var TEST_FILE = /(?:^|[\\/])(?:__tests__|tests)[\\/]|[.](?:test|spec)[.][cm]?[jt]sx?$/;
7846
7917
  function isNamed3(node, name) {
@@ -8018,6 +8089,7 @@ var pasikaNextjsAppRules = {
8018
8089
  "import-through-index": importThroughIndexRule,
8019
8090
  "util-file-name": utilFileNameRule,
8020
8091
  "no-util-barrel": noUtilBarrelRule,
8092
+ "no-redundant-alias": noRedundantAliasRule,
8021
8093
  "enforce-barrel-exports": enforceBarrelExportsRule,
8022
8094
  "config-extraction": configExtractionRule,
8023
8095
  "value-extraction": valueExtractionRule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.41",
3
+ "version": "0.10.43",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",