pasika 0.10.93 → 0.10.95

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.
@@ -3970,7 +3970,7 @@ var importBoundariesRule = {
3970
3970
  const isAppLocalStyleImport = importerLayer === "app" && importedLayer === "app" && styleExtensions.has(extension);
3971
3971
  const importedIsRootSupport = rootSupportFolders.has(importedLayer);
3972
3972
  const importedIsSameConfig = importerLayer === "config" && importedLayer === "config" && importer[1] === imported[1];
3973
- const isAllowed = !isCodeModule && importerLayer === "app" && isAppLocalStyleImport || isCodeModule && importerLayer === "app" && (importedLayer === "compositions" || importedLayer === "features" || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "compositions" && (importedLayer === "compositions" || importedLayer === "features" || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "features" && (importedLayer === "features" && importerFeature === importedFeature || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "shared" && (importedLayer === "shared" || importedIsRootSupport) || isCodeModule && rootSupportFolders.has(importerLayer) && importedIsRootSupport && (importerLayer !== "config" || importedLayer !== "config" || importedIsSameConfig);
3973
+ const isAllowed = !isCodeModule && importerLayer === "app" && isAppLocalStyleImport || isCodeModule && importerLayer === "app" && (importedLayer === "compositions" || importedLayer === "features" || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "compositions" && (importedLayer === "compositions" || importedLayer === "features" || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "features" && (importedLayer === "features" && importerFeature === importedFeature || importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importerLayer === "shared" && (importedLayer === "shared" || importedIsRootSupport) || isCodeModule && importer.length === 1 && importedIsRootSupport || isCodeModule && rootSupportFolders.has(importerLayer) && importedIsRootSupport && (importerLayer !== "config" || importedLayer !== "config" || importedIsSameConfig);
3974
3974
  if (!isAllowed) {
3975
3975
  context.report({
3976
3976
  node: source,
@@ -4069,12 +4069,13 @@ var importThroughIndexRule = {
4069
4069
  schema: [],
4070
4070
  type: "problem",
4071
4071
  docs: {
4072
- description: "Require imports of support files to use their support-folder index."
4072
+ description: "Enforce public support barrels and direct sibling constants imports."
4073
4073
  }
4074
4074
  },
4075
4075
  create(context) {
4076
4076
  const filename = path32.resolve(context.filename);
4077
4077
  const sourceRoot = sourceRootOf2(context, filename);
4078
+ const importerSegments = segmentsOf(filename, sourceRoot);
4078
4079
  return {
4079
4080
  Program(node) {
4080
4081
  for (const specifier of importSpecifiers(context.sourceCode.text)) {
@@ -4085,8 +4086,19 @@ var importThroughIndexRule = {
4085
4086
  (segment) => ["constants", "types", "schemas"].includes(segment)
4086
4087
  );
4087
4088
  const supportFolder = supportFolderIndex >= 0 ? targetSegments[supportFolderIndex] : void 0;
4088
- if (!supportFolder || path32.basename(target).startsWith("index.")) continue;
4089
+ if (!supportFolder) continue;
4089
4090
  const folderIndex = targetSegments.slice(0, supportFolderIndex + 1);
4091
+ const withinSameSupportFolder = importerSegments.length > supportFolderIndex + 1 && folderIndex.every((segment, index) => importerSegments[index] === segment);
4092
+ if (path32.basename(target).startsWith("index.")) {
4093
+ if (supportFolder === "constants" && withinSameSupportFolder) {
4094
+ context.report({
4095
+ node,
4096
+ message: `Import sibling constants directly instead of through "${specifier}" to avoid circular barrel imports. See the next-codebase-guide constants rule.`
4097
+ });
4098
+ }
4099
+ continue;
4100
+ }
4101
+ if (withinSameSupportFolder) continue;
4090
4102
  const expected = `@/${folderIndex.join("/")}`;
4091
4103
  context.report({
4092
4104
  node,
@@ -4508,6 +4520,18 @@ function keyName(key) {
4508
4520
  function reportFor(context, node, message) {
4509
4521
  context.report({ node, message });
4510
4522
  }
4523
+ function isLocaleWrapper(node) {
4524
+ return ["TSAsExpression", "TSSatisfiesExpression"].includes(node.type) && "expression" in node && typeof node.expression === "object" && "type" in node.expression;
4525
+ }
4526
+ function localeObject(node) {
4527
+ let current = node;
4528
+ while (current) {
4529
+ if (current.type === "ObjectExpression") return current;
4530
+ if (!isLocaleWrapper(current)) return void 0;
4531
+ current = current.expression;
4532
+ }
4533
+ return void 0;
4534
+ }
4511
4535
  function checkKey(context, node, name) {
4512
4536
  if (!ENGLISH.test(name)) {
4513
4537
  reportFor(
@@ -4544,13 +4568,22 @@ var localeKeyShapeRule = {
4544
4568
  },
4545
4569
  create(context) {
4546
4570
  if (!isLocalesFile(context.filename)) return {};
4547
- function visitObject(node) {
4571
+ function visitObject(node, namespace) {
4548
4572
  for (const property of node.properties) {
4549
4573
  if (property.type !== "Property") continue;
4550
4574
  const name = keyName(property.key);
4551
4575
  if (name === void 0) continue;
4552
- if (property.value.type === "ObjectExpression") {
4553
- visitObject(property.value);
4576
+ const nested = localeObject(property.value);
4577
+ if (nested) {
4578
+ if (namespace !== void 0) {
4579
+ reportFor(
4580
+ context,
4581
+ property,
4582
+ `Locale "${namespace}.${name}" must not be a nested object. Keep string keys directly inside the "${namespace}" feature namespace. See docs/next-codebase-guide/rules/locales-rule.md`
4583
+ );
4584
+ } else {
4585
+ visitObject(nested, name);
4586
+ }
4554
4587
  } else if (property.value.type === "Literal" && typeof property.value.value === "string") {
4555
4588
  checkKey(context, property, name);
4556
4589
  }
@@ -4559,8 +4592,9 @@ var localeKeyShapeRule = {
4559
4592
  return {
4560
4593
  VariableDeclarator(node) {
4561
4594
  if (node.id.type !== "Identifier" || node.id.name !== "locales") return;
4562
- if (node.init?.type !== "ObjectExpression") return;
4563
- visitObject(node.init);
4595
+ const root = localeObject(node.init);
4596
+ if (!root) return;
4597
+ visitObject(root);
4564
4598
  }
4565
4599
  };
4566
4600
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pasika",
3
- "version": "0.10.93",
3
+ "version": "0.10.95",
4
4
  "description": "Reusable agent setup package",
5
5
  "repository": {
6
6
  "type": "git",