pasika 0.10.30 → 0.10.31

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.
@@ -4936,6 +4936,11 @@ function isSubstantial(node) {
4936
4936
  function blockChildren(node) {
4937
4937
  return (node.children ?? []).filter(isJsxNode);
4938
4938
  }
4939
+ function structuralChildren(node) {
4940
+ return (node.children ?? []).filter(
4941
+ (child) => isJsxNode(child) || isJsxExpressionContainer(child)
4942
+ );
4943
+ }
4939
4944
  var repeatedStructureRule = {
4940
4945
  meta: {
4941
4946
  schema: [],
@@ -4955,6 +4960,10 @@ var repeatedStructureRule = {
4955
4960
  }
4956
4961
  };
4957
4962
  function checkChildren(node) {
4963
+ checkSubstantialBlocks(node);
4964
+ checkSmallElementExpressionPairs(node);
4965
+ }
4966
+ function checkSubstantialBlocks(node) {
4958
4967
  const children = blockChildren(node);
4959
4968
  const seen = /* @__PURE__ */ new Map();
4960
4969
  for (const child of children) {
@@ -4967,12 +4976,36 @@ var repeatedStructureRule = {
4967
4976
  if (group.length < 2) continue;
4968
4977
  const first = group[0];
4969
4978
  if (!first || !isSubstantial(first)) continue;
4970
- context.report({
4971
- node: first,
4972
- message: `The same arrangement of elements appears ${String(group.length)} times here; extract it as a named component. Different data or labels do not prevent extraction. See docs/next-codebase-guide/rules/repeated-structure-rule.md`
4973
- });
4979
+ reportRepeatedStructure(first, group.length);
4980
+ }
4981
+ }
4982
+ function checkSmallElementExpressionPairs(node) {
4983
+ const children = structuralChildren(node);
4984
+ const seen = /* @__PURE__ */ new Map();
4985
+ for (let index = 0; index < children.length - 1; index += 1) {
4986
+ const first = children[index];
4987
+ const second = children[index + 1];
4988
+ if (!first || !second || !isJsxNode(first) || !isJsxExpressionContainer(second) || isSubstantial(first)) {
4989
+ continue;
4990
+ }
4991
+ const sig = `${signature(first)}/{}`;
4992
+ const group = seen.get(sig) ?? [];
4993
+ group.push(first);
4994
+ seen.set(sig, group);
4995
+ }
4996
+ for (const [, group] of seen) {
4997
+ if (group.length < 2) continue;
4998
+ const first = group[0];
4999
+ if (!first) continue;
5000
+ reportRepeatedStructure(first, group.length);
4974
5001
  }
4975
5002
  }
5003
+ function reportRepeatedStructure(node, count) {
5004
+ context.report({
5005
+ node,
5006
+ message: `The same arrangement of elements appears ${String(count)} times here; extract it as a named component. Different data or labels do not prevent extraction. See docs/next-codebase-guide/rules/repeated-structure-rule.md`
5007
+ });
5008
+ }
4976
5009
  }
4977
5010
  };
4978
5011
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.30",
3
+ "version": "0.10.31",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",