@shivaedev/quality 0.62.0 → 0.62.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.62.1 - 2026-11-04
4
+
5
+ ### Fixed
6
+
7
+ - Accept source-only file-preserving wildcard exports for packages with `"private": true`. Published packages still require source, types and dist mappings, and every package must keep `#test/*` rooted at `./src/test-support/*`.
8
+
3
9
  ## 0.62.0 - 2026-11-04
4
10
 
5
11
  ### Added
package/README.md CHANGED
@@ -405,7 +405,7 @@ For adoption, run `quality baseline write --rule code/unused --file src/legacy.t
405
405
  - **SQL transactions:** `effect/sql-transact` reports native `sql.withTransaction` calls around repository writes, `transact` or `invalidateOnCommit`. Begin the outer transaction with `transact(effect, { onSqlError })` so changed keys follow its commit. The rule resolves native SQL and repository declarations and follows direct calls, pipes, local aliases and source helpers. Native read-only and raw SQL transactions and unrelated transaction methods remain supported.
406
406
  - **React:** `react/jsx-conditionals` reports `&&` and ternaries in the JSX children a component returns, including nested decisions and returned `.map` items. Decisions in a `const` above the return, JSX built inside library callbacks and conditional attributes are accepted. A ternary with two plain string or number literal branches, such as `{on ? "On" : "Off"}`, is accepted; branches that select JSX, components or computed values still need a decision before the JSX. This rule owns the check, so the shared Biome preset leaves `noLeakedRender` off.
407
407
  - **Tests:** `tests/follow` and `tests/colocated` keep a test beside the code it covers, named `<file>[.<modifier>].test.ts` or `<behaviour>[.<modifier>].spec.ts` with at most one modifier of `dom`, `slow`, `typecheck` and `unit`; a unit test runs without the DOM, so `.unit.dom` is rejected. `tests/colocated` always treats `__tests__/` as a test folder. It treats `test/`, `tests/` and `spec/` as test folders only when their directly contained checked files are all tests or test support; a product folder with source beside its specs is an ordinary source folder. Declared `suites` keep their own layout. Shared test support belongs in `test-support/`, the sanctioned test-only folder. A test covering a whole module may sit at its root or directly beside its folder. The story rules above keep setup in the kit.
408
- - **Manifests:** `manifests/valid` decodes every repository `package.json` through one shared Schema before dependent rules run and reports each invalid manifest once with its file path. An unreadable manifest or one removed after discovery becomes a `manifests/valid` finding. Optional lookups still treat `NotFound` as absence. `manifests/sorted` keeps every `package.json` in sort-package-json order, and `manifests/source-first` puts the `@shivaedev/source` or `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `@shivaedev/source` (or an application’s own `source`), `types` and `default`. A subtree pattern such as `./server/*.ts` keeps that same subtree in its targets. An optional root entry and exact-path non-code assets such as JSON presets and `./package.json` are allowed. Every module remains importable; `null` export entries fail with a request to remove the block. A package without modules, such as a dependency shell, exports only exact assets and needs no wildcard. Import each module at its path under `src/`; named aliases, flattened paths, per-file module lists and additional wildcards fail. When declared, the standard imports must preserve their roots: `#*.ts` maps directly to `./src/*.ts` or uses `@shivaedev/source` (or an application’s own `source`) `./src/*.ts`, types `./dist/*.d.ts` and default `./dist/*.js`; `#test/*` maps to `./src/test-support/*`. Include subfolders in specifiers, such as `#server/module.ts`. Other aliases are allowed. `manifests/application` keeps an application on its entry points, as described above.
408
+ - **Manifests:** `manifests/valid` decodes every repository `package.json` through one shared Schema before dependent rules run and reports each invalid manifest once with its file path. An unreadable manifest or one removed after discovery becomes a `manifests/valid` finding. Optional lookups still treat `NotFound` as absence. `manifests/sorted` keeps every `package.json` in sort-package-json order, and `manifests/source-first` puts the `@shivaedev/source` or `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `@shivaedev/source` (or an application’s own `source`), `types` and `default`. Packages with `"private": true` may instead map the wildcard directly to source (`"./*.ts": "./src/*.ts"`); published packages require the full source, types and default conditions. A subtree pattern such as `./server/*.ts` keeps that same subtree in its targets. An optional root entry and exact-path non-code assets such as JSON presets and `./package.json` are allowed. Every module remains importable; `null` export entries fail with a request to remove the block. A package without modules, such as a dependency shell, exports only exact assets and needs no wildcard. Import each module at its path under `src/`; named aliases, flattened paths, per-file module lists and additional wildcards fail. When declared, the standard imports must preserve their roots: `#*.ts` maps directly to `./src/*.ts` or uses `@shivaedev/source` (or an application’s own `source`) `./src/*.ts`, types `./dist/*.d.ts` and default `./dist/*.js`; `#test/*` maps to `./src/test-support/*`. Include subfolders in specifiers, such as `#server/module.ts`. Other aliases are allowed. `manifests/application` keeps an application on its entry points, as described above.
409
409
  - **Biome:** the `biome` rule reports Biome's error findings as `biome/<category>`. A Biome run that fails without an error finding, such as one whose config leaves no file to check, fails lint and fix with Biome's message. The preset leaves out the `.worktrees` folder at the root, so a checkout does not lint its linked worktrees, while a worktree inside it lints all of its own files. The preset's plugins ban ambient time, randomness, `console` and `process.env` in favour of Effect's services.
410
410
 
411
411
  ### Decide before JSX
@@ -1 +1 @@
1
- {"version":3,"file":"manifestsExportsShape.d.ts","sourceRoot":"","sources":["../../src/rules/manifestsExportsShape.ts"],"names":[],"mappings":"AA6FA,eAAO,MAAM,qBAAqB,sEAuBhC,CAAC"}
1
+ {"version":3,"file":"manifestsExportsShape.d.ts","sourceRoot":"","sources":["../../src/rules/manifestsExportsShape.ts"],"names":[],"mappings":"AAsGA,eAAO,MAAM,qBAAqB,sEAuBhC,CAAC"}
@@ -8,11 +8,17 @@ const CODE_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", "
8
8
  function isMap(value) {
9
9
  return typeof value === "object" && value !== null && !Array.isArray(value);
10
10
  }
11
- function standardPattern(key, value) {
12
- if (!(key.startsWith("./") && key.endsWith(".ts")) || key.split("*").length !== 2 || !isMap(value)) {
11
+ function standardPattern(key, value, sourceOnly = false) {
12
+ if (!(key.startsWith("./") && key.endsWith(".ts")) || key.split("*").length !== 2) {
13
13
  return false;
14
14
  }
15
15
  const subpath = key.slice("./".length);
16
+ if (sourceOnly && value === `./src/${subpath}`) {
17
+ return true;
18
+ }
19
+ if (!isMap(value)) {
20
+ return false;
21
+ }
16
22
  const stem = subpath.slice(0, -".ts".length);
17
23
  const source = "@shivaedev/source" in value ? "@shivaedev/source" : "source";
18
24
  const conditions = { default: `./dist/${stem}.js`, [source]: `./src/${subpath}`, types: `./dist/${stem}.d.ts` };
@@ -23,35 +29,38 @@ function exactAsset(key, value) {
23
29
  const extension = posix.extname(key);
24
30
  return key.startsWith("./") && !key.includes("*") && value === key && extension !== "" && !CODE_EXTENSIONS.has(extension);
25
31
  }
26
- function finding(file, subject, reason) {
32
+ function finding(file, subject, reason, isPrivate) {
33
+ const sourceOnly = isPrivate ? ' For a private package, mapping "./*.ts" directly to "./src/*.ts" is also accepted.' : "";
27
34
  return {
28
35
  file,
29
- message: `${reason} Import the module at its file path through the single "${PATTERN}" wildcard (for example, "./server/better-auth/mount.ts" for "./src/server/better-auth/mount.ts"). Map it to source "./src/*.ts", types "./dist/*.d.ts" and default "./dist/*.js"; remove aliases and per-file module exports. Non-code assets must use their exact file paths.`,
36
+ message: `${reason} Import the module at its file path through the single "${PATTERN}" wildcard (for example, "./server/better-auth/mount.ts" for "./src/server/better-auth/mount.ts"). Map it to source "./src/*.ts", types "./dist/*.d.ts" and default "./dist/*.js"; remove aliases and per-file module exports. Non-code assets must use their exact file paths.${sourceOnly}`,
30
37
  subject,
31
38
  };
32
39
  }
33
- function findingsIn(file, exports) {
40
+ function findingsIn(file, exports, isPrivate) {
34
41
  if (exports === undefined) {
35
42
  return [];
36
43
  }
37
44
  if (!isMap(exports)) {
38
- return [finding(file, "exports", "The exports field must be a subpath map.")];
45
+ return [finding(file, "exports", "The exports field must be a subpath map.", isPrivate)];
39
46
  }
40
47
  const entries = Object.entries(exports);
41
48
  const patterns = entries.filter(([key, value]) => key.includes("*") && value !== null);
42
49
  const exportsModules = entries.some(([key, value]) => value !== null && !exactAsset(key, value));
43
50
  const count = patterns.length === 1 || (patterns.length === 0 && !exportsModules)
44
51
  ? []
45
- : [finding(file, "exports", `The exports field needs exactly one non-null wildcard; found ${patterns.length}.`)];
52
+ : [finding(file, "exports", `The exports field needs exactly one non-null wildcard; found ${patterns.length}.`, isPrivate)];
46
53
  return [
47
54
  ...count,
48
55
  ...entries.flatMap(([key, value]) => {
49
56
  if (value === null) {
50
- return [finding(file, key, `Export "${key}" blocks module imports with null. Remove the null entry so callers can import each module.`)];
57
+ return [
58
+ finding(file, key, `Export "${key}" blocks module imports with null. Remove the null entry so callers can import each module.`, isPrivate),
59
+ ];
51
60
  }
52
- return key === "." || exactAsset(key, value) || standardPattern(key, value)
61
+ return key === "." || exactAsset(key, value) || standardPattern(key, value, isPrivate)
53
62
  ? []
54
- : [finding(file, key, `Export "${key}" does not preserve the module's file path.`)];
63
+ : [finding(file, key, `Export "${key}" does not preserve the module's file path.`, isPrivate)];
55
64
  }),
56
65
  ];
57
66
  }
@@ -87,7 +96,7 @@ export const manifestsExportsShape = defineRule({
87
96
  if (file === "package.json" && manifest === undefined) {
88
97
  return [];
89
98
  }
90
- return [...findingsIn(file, manifest?.exports), ...importFindings(file, manifest?.imports)];
99
+ return [...findingsIn(file, manifest?.exports, manifest?.private === true), ...importFindings(file, manifest?.imports)];
91
100
  }), { concurrency: "unbounded" });
92
101
  return findings.flat();
93
102
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"manifestsExportsShape.js","sourceRoot":"","sources":["../../src/rules/manifestsExportsShape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAgB,MAAM,UAAU,CAAC;AAEpD,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEzB,MAAM,eAAe,GAAG,IAAI,G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 -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/quality",
3
- "version": "0.62.0",
3
+ "version": "0.62.1",
4
4
  "description": "Repository quality gate with typed rules, a baseline of existing debt and a registry of reasoned exceptions",
5
5
  "homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/quality#readme",
6
6
  "bugs": {
@@ -12,11 +12,17 @@ function isMap(value: unknown): value is Readonly<Record<string, unknown>> {
12
12
  return typeof value === "object" && value !== null && !Array.isArray(value);
13
13
  }
14
14
 
15
- function standardPattern(key: string, value: unknown): boolean {
16
- if (!(key.startsWith("./") && key.endsWith(".ts")) || key.split("*").length !== 2 || !isMap(value)) {
15
+ function standardPattern(key: string, value: unknown, sourceOnly = false): boolean {
16
+ if (!(key.startsWith("./") && key.endsWith(".ts")) || key.split("*").length !== 2) {
17
17
  return false;
18
18
  }
19
19
  const subpath = key.slice("./".length);
20
+ if (sourceOnly && value === `./src/${subpath}`) {
21
+ return true;
22
+ }
23
+ if (!isMap(value)) {
24
+ return false;
25
+ }
20
26
  const stem = subpath.slice(0, -".ts".length);
21
27
  const source = "@shivaedev/source" in value ? "@shivaedev/source" : "source";
22
28
  const conditions = { default: `./dist/${stem}.js`, [source]: `./src/${subpath}`, types: `./dist/${stem}.d.ts` };
@@ -31,20 +37,21 @@ function exactAsset(key: string, value: unknown): boolean {
31
37
  return key.startsWith("./") && !key.includes("*") && value === key && extension !== "" && !CODE_EXTENSIONS.has(extension);
32
38
  }
33
39
 
34
- function finding(file: string, subject: string, reason: string): Finding {
40
+ function finding(file: string, subject: string, reason: string, isPrivate: boolean): Finding {
41
+ const sourceOnly = isPrivate ? ' For a private package, mapping "./*.ts" directly to "./src/*.ts" is also accepted.' : "";
35
42
  return {
36
43
  file,
37
- message: `${reason} Import the module at its file path through the single "${PATTERN}" wildcard (for example, "./server/better-auth/mount.ts" for "./src/server/better-auth/mount.ts"). Map it to source "./src/*.ts", types "./dist/*.d.ts" and default "./dist/*.js"; remove aliases and per-file module exports. Non-code assets must use their exact file paths.`,
44
+ message: `${reason} Import the module at its file path through the single "${PATTERN}" wildcard (for example, "./server/better-auth/mount.ts" for "./src/server/better-auth/mount.ts"). Map it to source "./src/*.ts", types "./dist/*.d.ts" and default "./dist/*.js"; remove aliases and per-file module exports. Non-code assets must use their exact file paths.${sourceOnly}`,
38
45
  subject,
39
46
  };
40
47
  }
41
48
 
42
- function findingsIn(file: string, exports: unknown): readonly Finding[] {
49
+ function findingsIn(file: string, exports: unknown, isPrivate: boolean): readonly Finding[] {
43
50
  if (exports === undefined) {
44
51
  return [];
45
52
  }
46
53
  if (!isMap(exports)) {
47
- return [finding(file, "exports", "The exports field must be a subpath map.")];
54
+ return [finding(file, "exports", "The exports field must be a subpath map.", isPrivate)];
48
55
  }
49
56
  const entries = Object.entries(exports);
50
57
  const patterns = entries.filter(([key, value]) => key.includes("*") && value !== null);
@@ -52,16 +59,18 @@ function findingsIn(file: string, exports: unknown): readonly Finding[] {
52
59
  const count =
53
60
  patterns.length === 1 || (patterns.length === 0 && !exportsModules)
54
61
  ? []
55
- : [finding(file, "exports", `The exports field needs exactly one non-null wildcard; found ${patterns.length}.`)];
62
+ : [finding(file, "exports", `The exports field needs exactly one non-null wildcard; found ${patterns.length}.`, isPrivate)];
56
63
  return [
57
64
  ...count,
58
65
  ...entries.flatMap(([key, value]) => {
59
66
  if (value === null) {
60
- return [finding(file, key, `Export "${key}" blocks module imports with null. Remove the null entry so callers can import each module.`)];
67
+ return [
68
+ finding(file, key, `Export "${key}" blocks module imports with null. Remove the null entry so callers can import each module.`, isPrivate),
69
+ ];
61
70
  }
62
- return key === "." || exactAsset(key, value) || standardPattern(key, value)
71
+ return key === "." || exactAsset(key, value) || standardPattern(key, value, isPrivate)
63
72
  ? []
64
- : [finding(file, key, `Export "${key}" does not preserve the module's file path.`)];
73
+ : [finding(file, key, `Export "${key}" does not preserve the module's file path.`, isPrivate)];
65
74
  }),
66
75
  ];
67
76
  }
@@ -104,7 +113,7 @@ export const manifestsExportsShape = defineRule({
104
113
  if (file === "package.json" && manifest === undefined) {
105
114
  return [];
106
115
  }
107
- return [...findingsIn(file, manifest?.exports), ...importFindings(file, manifest?.imports)];
116
+ return [...findingsIn(file, manifest?.exports, manifest?.private === true), ...importFindings(file, manifest?.imports)];
108
117
  }),
109
118
  { concurrency: "unbounded" },
110
119
  );