@beignet/cli 0.0.12 → 0.0.14

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/src/lint.ts CHANGED
@@ -99,6 +99,19 @@ export async function lintApp(
99
99
 
100
100
  if (sourceLayer === "test" || sourceLayer === "unknown") continue;
101
101
 
102
+ if (isLegacySharedDomainPath(file, config)) {
103
+ const canonicalSharedDomain = sharedDomainPath(config);
104
+ diagnostics.push({
105
+ severity: "error",
106
+ code: "BEIGNET_CANONICAL_STRUCTURE",
107
+ file,
108
+ importPath: canonicalSharedDomain,
109
+ line: 1,
110
+ column: 1,
111
+ message: `root shared-domain files are legacy. Move shared-kernel domain concepts to ${canonicalSharedDomain}.`,
112
+ });
113
+ }
114
+
102
115
  const lineStarts = computeLineStarts(source);
103
116
  for (const reference of importGraph.get(file) ?? []) {
104
117
  const diagnostic = lintImport(file, sourceLayer, reference, config);
@@ -1033,7 +1046,7 @@ function featureImportViolation(
1033
1046
 
1034
1047
  return `feature-specific domain files must not import another feature's domain (${stripKnownExtension(
1035
1048
  resolvedPath,
1036
- )}). Move shared concepts to features/shared/domain.`;
1049
+ )}). Move shared-kernel domain concepts to ${sharedDomainPath(config)}.`;
1037
1050
  }
1038
1051
 
1039
1052
  const domainBannedPackages = new Set([
@@ -1163,7 +1176,7 @@ function classifyPath(
1163
1176
  if (isUnder(normalizedPath, portsDir)) return "port";
1164
1177
  if (isUnder(normalizedPath, "client")) return "client";
1165
1178
  if (isUnder(normalizedPath, "components")) return "component";
1166
- if (isUnder(normalizedPath, sharedDomainPath(config))) return "domain";
1179
+ if (isUnder(normalizedPath, legacySharedDomainPath(config))) return "domain";
1167
1180
  if (isUnder(normalizedPath, "lib")) return "lib";
1168
1181
 
1169
1182
  const featurePath = featureRelativePath(normalizedPath, featuresPath);
@@ -1244,7 +1257,7 @@ function featureLayerInfo(
1244
1257
  return { feature, layer };
1245
1258
  }
1246
1259
 
1247
- function sharedDomainPath(config: ResolvedBeignetConfig): string {
1260
+ function legacySharedDomainPath(config: ResolvedBeignetConfig): string {
1248
1261
  const featuresDir = directoryPath(config.paths.features);
1249
1262
  const featuresParent = directoryPath(path.dirname(featuresDir));
1250
1263
  if (!featuresParent || featuresParent === ".") return "domain";
@@ -1252,6 +1265,18 @@ function sharedDomainPath(config: ResolvedBeignetConfig): string {
1252
1265
  return path.join(featuresParent, "domain");
1253
1266
  }
1254
1267
 
1268
+ function sharedDomainPath(config: ResolvedBeignetConfig): string {
1269
+ return path.join(directoryPath(config.paths.features), "shared/domain");
1270
+ }
1271
+
1272
+ function isLegacySharedDomainPath(
1273
+ filePath: string,
1274
+ config: ResolvedBeignetConfig,
1275
+ ): boolean {
1276
+ const normalizedPath = stripKnownExtension(normalizePath(filePath));
1277
+ return isUnder(normalizedPath, legacySharedDomainPath(config));
1278
+ }
1279
+
1255
1280
  function layerLabel(layer: SourceLayer): string {
1256
1281
  return layer.replaceAll("-", " ");
1257
1282
  }