@shivaedev/quality 0.72.0 → 0.72.2

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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.72.2 - 2026-11-07
4
+
5
+ ### Changed
6
+
7
+ - Update `@shivaedev/service` from 0.8.1 to 0.8.2.
8
+ - Update `@shivaedev/test-story` from 0.45.2 to 0.45.3.
9
+
10
+ ## 0.72.1 - 2026-11-07
11
+
12
+ ### Fixed
13
+
14
+ - Follow service initializer state through nested helper calls, including helpers wrapped with `Effect.fn`, while reporting helpers with borrowed callers and exported service parameters.
15
+ - Recognize foreign host callbacks in inline plugin objects and class methods implementing foreign interfaces.
16
+ - Resolve build entries through Node path `dirname`, including roots derived from `import.meta.dirname` and `fileURLToPath(import.meta.url)`.
17
+
3
18
  ## 0.72.0 - 2026-11-07
4
19
 
5
20
  ### Added
package/README.md CHANGED
@@ -122,7 +122,7 @@ Within Effect code, folders named `adapters/` or `test-support/`, at any depth,
122
122
 
123
123
  The `ambient-runtime` Biome plugin also reports `Effect.run*` calls whose computation contains `Clock`, `Config` or `Random`, `currentTimeMillisUnsafe`, crypto UUIDs and bytes, `performance.now`, process arguments, working directory and exit state, `globalThis.process.env`, timeouts and microtasks. Yield service computations in the caller's Effect so its environment controls them. These additional checks apply to core TypeScript code. They accept `cli.ts`, `main.ts(x)`, `entry.ts(x)`, `*-cli.ts`, modules that call `runMain`, use `NodeRuntime.runMain` or guard execution with `fileURLToPath(import.meta.url) === process.argv[1]`, tool configs, tests, `adapters/` and `test-support/`. The existing `Date.now()`, `new Date()`, `Math.random()`, console and direct `process.env` bans still apply there.
124
124
 
125
- `effect/service-parameters` reports parameters carrying a service in exported and local functions and public methods, including returned factories and function-typed parameters returning services. It follows service classes and tags, non-empty Contexts and service implementation shapes through aliases, interfaces, generic constraints, inferred parameters and destructuring. Read services from Effect's environment instead. An Effect or Stream requiring a service is a computation and is accepted. Methods implementing a service and functions constructing Layers may take services as parameters. Within Effect code, `test-support/` folders are exempt from this rule; `adapters/` folders are checked. Module-level PascalCase functions returning React nodes or elements are components: their props and callback prop signatures may carry services, including a connection’s AtomRegistry. An ordinary function taking the same service still fails. Callbacks whose arguments are supplied by their owner keep those arguments, including object methods contextually typed by a foreign signature; wrapping and returning a callback as a runtime operation still checks it. Test-kit registrations do not turn plain kit state into runtime service plumbing. Type predicates inspect service values without declaring a runtime dependency. Operation parameters supplied exclusively by the service’s `methods: (state)` argument, directly or through other such parameters, carry owned initializer state, including the Layer’s own Scope. A hand-built state object or an independent Scope parameter still counts as service plumbing. Owned fibers, closeable scopes and native atom evaluation contexts follow Effect’s lifecycle conventions; wrapping a function with `Effect.fn` still checks its parameters. An adapter may pass a foreign resource between its functions when the calls supply values constructed through an outside library or received by its host callbacks, including local construction helpers and an Effect acquisition wrapper; reading that resource from the environment still counts as service plumbing. Installed implementation shapes are discovered in the consuming repository's package scopes, alongside the framework service package's scope.
125
+ `effect/service-parameters` reports parameters carrying a service in exported and local functions and public methods, including returned factories and function-typed parameters returning services. It follows service classes and tags, non-empty Contexts and service implementation shapes through aliases, interfaces, generic constraints, inferred parameters and destructuring. Read services from Effect's environment instead. An Effect or Stream requiring a service is a computation and is accepted. Methods implementing a service and functions constructing Layers may take services as parameters. Within Effect code, `test-support/` folders are exempt from this rule; `adapters/` folders are checked. Module-level PascalCase functions returning React nodes or elements are components: their props and callback prop signatures may carry services, including a connection’s AtomRegistry. An ordinary function taking the same service still fails. Callbacks whose arguments are supplied by their owner keep those arguments, including object methods contextually typed by a foreign signature, inline host plugin methods and methods implementing a foreign interface; wrapping and returning a callback as a runtime operation still checks it. Test-kit registrations do not turn plain kit state into runtime service plumbing. Type predicates inspect service values without declaring a runtime dependency. Operation parameters supplied exclusively by the service's `methods: (state)` argument, directly or through other such parameters and internal helpers, carry owned initializer state, including members of the Layer’s own Scope and parameters in helpers wrapped with `Effect.fn`. A hand-built state object or an independent Scope parameter still counts as service plumbing. Owned fibers, closeable scopes and native atom evaluation contexts follow Effect's lifecycle conventions; wrapping a function with `Effect.fn` still checks its parameters. An adapter may pass a foreign resource between its functions when the calls supply values constructed through an outside library or received by its host callbacks, including local construction helpers and an Effect acquisition wrapper; reading that resource from the environment still counts as service plumbing. Installed implementation shapes are discovered in the consuming repository's package scopes, alongside the framework service package's scope.
126
126
 
127
127
  Both rules refuse config exceptions and inline suppressions. Record existing debt with `quality baseline write --rule effect/boundary` and `quality baseline write --rule effect/service-parameters`; the normal report and baseline burn-down apply.
128
128
 
@@ -424,7 +424,7 @@ Git calls `quality baseline merge <ancestor> <current> <other>`. Entries are key
424
424
 
425
425
  ### Unused code
426
426
 
427
- `code/unused` uses knip to report unused files, value and type exports, unused dependencies (including development and optional peer dependencies), and imports missing from the package manifest in every workspace. It runs through `quality lint` and the normal report and baseline. The rule accepts no options or permanent exceptions; Quality supplies knip’s entry points without a repository knip config. It follows package scripts through their imports to esbuild `build`, `buildSync` and `context` calls, Rolldown `build` and `watch` calls (including config arrays), and `Bun.build`, reading literal entry lists or maps, local constants, array spreads, arguments passed through local or imported build helpers, mapped config array elements, builds inside Effect acquisition callbacks, and Node path `join` / `resolve` calls. Conventional tool configs, including dependency-cruiser configs and nested Vitest configs, are entries too. Relative paths use the script package’s working directory (or esbuild’s `absWorkingDir`); `import.meta.dirname` and `__dirname` refer to the build helper’s folder. Node path calls use the script package’s process directory even when the bundler sets a different working directory. Entry files and their imports count as used without fake imports. Node module resolution through `createRequire(...).resolve(...)` also counts as dependency use; an ordinary object’s `resolve` method does not. Unrelated strings and entries in abandoned build helpers do not establish reachability. Runtime modules supplied by a host can be declared in an ambient script included by the importing file’s TypeScript project. These declarations satisfy the missing-dependency check only in that project; undeclared imports still fail.
427
+ `code/unused` uses knip to report unused files, value and type exports, unused dependencies (including development and optional peer dependencies), and imports missing from the package manifest in every workspace. It runs through `quality lint` and the normal report and baseline. The rule accepts no options or permanent exceptions; Quality supplies knip’s entry points without a repository knip config. It follows package scripts through their imports to esbuild `build`, `buildSync` and `context` calls, Rolldown `build` and `watch` calls (including config arrays), and `Bun.build`, reading literal entry lists or maps, local constants, array spreads, arguments passed through local or imported build helpers, mapped config array elements, builds inside Effect acquisition callbacks, and Node path `join`, `resolve` and `dirname` calls, including `fileURLToPath(import.meta.url)`. Conventional tool configs, including dependency-cruiser configs and nested Vitest configs, are entries too. Relative paths use the script package’s working directory (or esbuild’s `absWorkingDir`); `import.meta.dirname` and `__dirname` refer to the build helper’s folder. Node path calls use the script package’s process directory even when the bundler sets a different working directory. Entry files and their imports count as used without fake imports. Node module resolution through `createRequire(...).resolve(...)` also counts as dependency use; an ordinary object’s `resolve` method does not. Unrelated strings and entries in abandoned build helpers do not establish reachability. Runtime modules supplied by a host can be declared in an ambient script included by the importing file’s TypeScript project. These declarations satisfy the missing-dependency check only in that project; undeclared imports still fail.
428
428
 
429
429
  Package `exports` are public API, including wildcard targets and source conditions. Package `bin` and scripts, test and story globs, tool configs and `src/test-support` provide the other entry points. Imports reachable from those entries count as used. Source-conditioned package import aliases resolve to their sources before a build. Compiler mappings from `tsconfig.json` and `tsconfig.build.json` keep imports on their source files when build output exists. An internal module can be used while one of its exports remains unused. An application’s declared dependency entry points satisfy provided imports under the same policy as `imports/manifest`.
430
430
 
@@ -1 +1 @@
1
- {"version":3,"file":"buildEntryPaths.d.ts","sourceRoot":"","sources":["../../src/adapters/buildEntryPaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAgC,MAAM,8BAA8B,CAAC;AA8BhG,wBAAgB,eAAe,CAC9B,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,WAAW,CAAC,EAAE,CAAC,IAAI,CAAa,EACxC,QAAQ,GAAE,aAAyB,GACjC,SAAS,MAAM,EAAE,CAsBnB"}
1
+ {"version":3,"file":"buildEntryPaths.d.ts","sourceRoot":"","sources":["../../src/adapters/buildEntryPaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAgC,MAAM,8BAA8B,CAAC;AAkDhG,wBAAgB,eAAe,CAC9B,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,WAAW,CAAC,EAAE,CAAC,IAAI,CAAa,EACxC,QAAQ,GAAE,aAAyB,GACjC,SAAS,MAAM,EAAE,CAsBnB"}
@@ -2,12 +2,21 @@ import { posix } from "node:path";
2
2
  import ts from "typescript";
3
3
  import { buildEntryValue, buildOption } from "#adapters/buildEntryValue.ts";
4
4
  import { importedCall } from "#adapters/importedCall.ts";
5
- function pathFromCall(node, cwd, paths) {
5
+ function pathFromCall(node, cwd, file, paths) {
6
6
  if (node.expression.getText() === "process.cwd" && node.arguments.length === 0) {
7
7
  return [cwd];
8
8
  }
9
9
  const imported = importedCall(node);
10
- if (imported === undefined || !/^(?:node:)?path$/u.test(imported.module) || (imported.name !== "join" && imported.name !== "resolve")) {
10
+ if (imported?.module === "node:url" && imported.name === "fileURLToPath" && node.arguments[0] !== undefined) {
11
+ const argument = node.arguments[0];
12
+ return ts.isPropertyAccessExpression(argument)
13
+ && ts.isMetaProperty(argument.expression)
14
+ && argument.expression.keywordToken === ts.SyntaxKind.ImportKeyword
15
+ && argument.name.text === "url"
16
+ ? [file]
17
+ : [];
18
+ }
19
+ if (imported === undefined || !/^(?:node:)?path$/u.test(imported.module) || !["join", "resolve", "dirname"].includes(imported.name)) {
11
20
  return [];
12
21
  }
13
22
  const parts = node.arguments.map(paths);
@@ -15,7 +24,13 @@ function pathFromCall(node, cwd, paths) {
15
24
  return [];
16
25
  }
17
26
  const values = parts.flat();
18
- return [imported.name === "resolve" ? posix.resolve(cwd, ...values) : posix.join(...values)];
27
+ if (imported.name === "resolve") {
28
+ return [posix.resolve(cwd, ...values)];
29
+ }
30
+ if (imported.name === "dirname") {
31
+ return [posix.dirname(values[0] ?? "")];
32
+ }
33
+ return [posix.join(...values)];
19
34
  }
20
35
  function valuesOf(node) {
21
36
  if (ts.isArrayLiteralExpression(node)) {
@@ -46,6 +61,6 @@ export function buildEntryPaths(expression, cwd, file, active = new Set(), bindi
46
61
  || (ts.isPropertyAccessExpression(node) && node.expression.kind === ts.SyntaxKind.MetaProperty && node.name.text === "dirname")) {
47
62
  return [posix.dirname(file)];
48
63
  }
49
- return ts.isCallExpression(node) ? pathFromCall(node, cwd, paths) : valuesOf(node).flatMap(paths);
64
+ return ts.isCallExpression(node) ? pathFromCall(node, cwd, file, paths) : valuesOf(node).flatMap(paths);
50
65
  }
51
66
  //# sourceMappingURL=buildEntryPaths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildEntryPaths.js","sourceRoot":"","sources":["../../src/adapters/buildEntryPaths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAsB,eAAe,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,SAAS,YAAY,CAAC,IAAuB,EAAE,GAAW,EAAE,KAAuD;IAClH,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,aAAa,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChF,OAAO,CAAC,GAAG,CAAC,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI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,CAAC,UAAU,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,EAC9H,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACzG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"foreignCallback.d.ts","sourceRoot":"","sources":["../../src/adapters/foreignCallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAGhE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,GAAG,SAAS,CAUlG;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,oBAAoB,GAAG,OAAO,CAe7G"}
1
+ {"version":3,"file":"foreignCallback.d.ts","sourceRoot":"","sources":["../../src/adapters/foreignCallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAGhE;AA+BD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,GAAG,SAAS,CAWlG;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,oBAAoB,GAAG,OAAO,CAe7G"}
@@ -3,16 +3,43 @@ export function foreignDeclaration(node) {
3
3
  const file = node.getSourceFile().fileName.replaceAll("\\", "/");
4
4
  return file.includes("/node_modules/") && !/\/(?:effect|@effect|@shivaedev)\//u.test(file);
5
5
  }
6
+ function methodType(checker, type, name) {
7
+ if (type === undefined) {
8
+ return undefined;
9
+ }
10
+ const property = (type.isUnionOrIntersection() ? type.types : [type])
11
+ .map((part) => part.getProperty(name))
12
+ .find((candidate) => candidate !== undefined);
13
+ return property === undefined ? undefined : checker.getTypeOfSymbol(property);
14
+ }
15
+ function methodName(node) {
16
+ return node.name.getText().replace(/^['"]|['"]$/gu, "");
17
+ }
18
+ function implementedMethodType(checker, node) {
19
+ if (!ts.isClassLike(node.parent) || node.name === undefined) {
20
+ return undefined;
21
+ }
22
+ for (const typeNode of (node.parent.heritageClauses ?? [])
23
+ .filter((clause) => clause.token === ts.SyntaxKind.ImplementsKeyword)
24
+ .flatMap((clause) => clause.types)) {
25
+ const type = methodType(checker, checker.getTypeAtLocation(typeNode), methodName(node));
26
+ if (type !== undefined) {
27
+ return type;
28
+ }
29
+ }
30
+ return undefined;
31
+ }
6
32
  export function contextualCallbackType(checker, node) {
7
33
  if (ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {
8
34
  return checker.getContextualType(node);
9
35
  }
10
- if (ts.isMethodDeclaration(node) && ts.isObjectLiteralExpression(node.parent)) {
11
- const object = checker.getContextualType(node.parent);
12
- const property = object?.getProperty(node.name.getText().replace(/^["']|["']$/gu, ""));
13
- return property === undefined ? undefined : checker.getTypeOfSymbol(property);
36
+ if (!ts.isMethodDeclaration(node)) {
37
+ return undefined;
14
38
  }
15
- return undefined;
39
+ if (ts.isObjectLiteralExpression(node.parent)) {
40
+ return methodType(checker, checker.getContextualType(node.parent), methodName(node));
41
+ }
42
+ return implementedMethodType(checker, node);
16
43
  }
17
44
  export function foreignCallbackParameter(checker, parameter) {
18
45
  const fn = parameter.parent;
@@ -1 +1 @@
1
- {"version":3,"file":"foreignCallback.js","sourceRoot":"","sources":["../../src/adapters/foreignCallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,UAAU,kBAAkB,CAAC,IAAoB;IACtD,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACjE,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,oCAAoC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5F,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAuB,EAAE,IAAa;IAC5E,IAAI,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/D,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/E,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;QACvF,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,wB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CAAC,IAAI,CAC1F,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,KAAK,SAAS,IAAI,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAAC,CAC/F,EACA,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACtI,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACtD,OAAO,KAAK,EAAE,WAAW,KAAK,SAAS,IAAI,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAClF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ownedServiceParameters.d.ts","sourceRoot":"","sources":["../../src/adapters/ownedServiceParameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAK5B,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,eAa7E,EAAE,CAAC,oBAAoB,KAAG,OAAO,CAMpD"}
1
+ {"version":3,"file":"ownedServiceParameters.d.ts","sourceRoot":"","sources":["../../src/adapters/ownedServiceParameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAiD5B,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,eA8D7E,EAAE,CAAC,oBAAoB,KAAG,OAAO,CACpD"}
@@ -2,6 +2,41 @@ import ts from "typescript";
2
2
  import { parameterOrigins } from "#adapters/parameterOrigins.ts";
3
3
  import { serviceAssemblyImports } from "#adapters/serviceAssemblyImports.ts";
4
4
  import { directServiceDefinitions, serviceProperty } from "#adapters/serviceAssemblySyntax.ts";
5
+ import { effectApi, resolvedValue } from "#adapters/serviceModelSyntax.ts";
6
+ function wrappedCallArguments(checker, parameter, sources) {
7
+ const callback = parameter.parent;
8
+ if (!((ts.isArrowFunction(callback) || ts.isFunctionExpression(callback))
9
+ && ts.isCallExpression(callback.parent)
10
+ && callback.parent.arguments.includes(callback))) {
11
+ return undefined;
12
+ }
13
+ const wrapper = callback.parent;
14
+ if (!(ts.isCallExpression(wrapper.expression) && effectApi(checker, wrapper.expression.expression, "fn"))) {
15
+ return undefined;
16
+ }
17
+ const declaration = wrapper.parent;
18
+ if (!(ts.isVariableDeclaration(declaration) && declaration.initializer === wrapper && ts.isIdentifier(declaration.name))) {
19
+ return undefined;
20
+ }
21
+ const symbol = checker.getSymbolAtLocation(declaration.name);
22
+ if (symbol === undefined) {
23
+ return undefined;
24
+ }
25
+ const arguments_ = [];
26
+ for (const source of sources) {
27
+ function visit(node) {
28
+ if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && checker.getSymbolAtLocation(node.expression) === symbol) {
29
+ const argument = node.arguments[callback.parameters.indexOf(parameter)];
30
+ if (argument !== undefined) {
31
+ arguments_.push(argument);
32
+ }
33
+ }
34
+ ts.forEachChild(node, visit);
35
+ }
36
+ visit(source);
37
+ }
38
+ return arguments_;
39
+ }
5
40
  export function ownedServiceParameters(checker, sources) {
6
41
  const states = new Set();
7
42
  for (const source of sources) {
@@ -15,10 +50,55 @@ export function ownedServiceParameters(checker, sources) {
15
50
  }
16
51
  }
17
52
  const originates = parameterOrigins(checker, sources);
18
- return (parameter) => states.size > 0
19
- && originates(parameter, (value) => {
20
- const declaration = ts.isIdentifier(value) ? checker.getSymbolAtLocation(value)?.valueDeclaration : value;
21
- return declaration !== undefined && states.has(declaration);
22
- });
53
+ const results = new Map();
54
+ const wrappedArguments = new Map();
55
+ function owned(parameter, active = new Set()) {
56
+ if (active.has(parameter)) {
57
+ return false;
58
+ }
59
+ const cached = results.get(parameter);
60
+ if (cached !== undefined) {
61
+ return cached;
62
+ }
63
+ const visited = new Set([...active, parameter]);
64
+ const wrapped = wrappedArguments.has(parameter) ? wrappedArguments.get(parameter) : wrappedCallArguments(checker, parameter, sources);
65
+ wrappedArguments.set(parameter, wrapped);
66
+ if (wrapped !== undefined) {
67
+ const result = wrapped.length > 0 && wrapped.every((argument) => ownedValue(argument, visited));
68
+ results.set(parameter, result);
69
+ return result;
70
+ }
71
+ const result = originates(parameter, (value) => ownedValue(value, visited));
72
+ results.set(parameter, result);
73
+ return result;
74
+ }
75
+ function rootParameter(value) {
76
+ let origin = value;
77
+ while (ts.isPropertyAccessExpression(origin) || ts.isElementAccessExpression(origin)) {
78
+ origin = origin.expression;
79
+ }
80
+ const root = ts.isIdentifier(origin) ? checker.getSymbolAtLocation(origin)?.valueDeclaration : undefined;
81
+ return root !== undefined && ts.isParameter(root) ? root : undefined;
82
+ }
83
+ function isOwnedState(value) {
84
+ const declaration = ts.isIdentifier(value) ? checker.getSymbolAtLocation(value)?.valueDeclaration : value;
85
+ const root = rootParameter(value);
86
+ return (declaration !== undefined && states.has(declaration)) || (root !== undefined && states.has(root));
87
+ }
88
+ function ownedValue(value, active) {
89
+ if (isOwnedState(value)) {
90
+ return true;
91
+ }
92
+ const root = rootParameter(value);
93
+ if (root !== undefined && owned(root, active)) {
94
+ return true;
95
+ }
96
+ if (!ts.isExpression(value)) {
97
+ return false;
98
+ }
99
+ const resolved = resolvedValue(checker, value);
100
+ return resolved !== value && ts.isExpression(resolved) && ownedValue(resolved, active);
101
+ }
102
+ return (parameter) => states.size > 0 && owned(parameter);
23
103
  }
24
104
  //# sourceMappingURL=ownedServiceParameters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ownedServiceParameters.js","s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AAW,EAAE,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;AAC7F,CAAC"}
@@ -32,7 +32,7 @@ export const serviceParameters = defineRule({
32
32
  return serviceFindings(inputs.root, sources, checker, serviceCatalog(program, checker, names));
33
33
  });
34
34
  }),
35
- description: "Exported and local functions and public methods take services from Effect's environment, including aliases, constraints, inferred/destructured parameters and factory returns. Service keys/classes, non-empty Contexts and implementation shapes are services; Effect/Stream requirements are computations. Service implementation methods, framework callbacks, module-level React components and their props, owned initializer state, foreign host object methods, owned foreign adapter resources and Layer constructors are accepted. Within Effect code, test-support/ folders are exempt. The fixed adapters/ convention bridges outside libraries to Effect values; adapters still follow this rule and ambient runtime bans. No config exceptions or inline suppressions; baseline existing debt.",
35
+ description: "Exported and local functions and public methods take services from Effect's environment, including aliases, constraints, inferred/destructured parameters and factory returns. Service keys/classes, non-empty Contexts and implementation shapes are services; Effect/Stream requirements are computations. Service implementation methods, framework callbacks, module-level React components and their props, owned initializer state, foreign host callbacks in object literals and classes, owned foreign adapter resources and Layer constructors are accepted. Within Effect code, test-support/ folders are exempt. The fixed adapters/ convention bridges outside libraries to Effect values; adapters still follow this rule and ambient runtime bans. No config exceptions or inline suppressions; baseline existing debt.",
36
36
  id: "effect/service-parameters",
37
37
  registrable: false,
38
38
  });
@@ -1 +1 @@
1
- {"version":3,"file":"serviceParameters.js","sourceRoot":"","sources":["../../../src/rules/effect/serviceParameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,UAAU,EAAmB,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM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EAAE,CAAC;YACtC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnB,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7C,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;YAClC,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;YACzC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACtC,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACnE,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;YACH,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QAChG,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,WAAW,EACV,uyBAAuyB;IACxyB,EAAE,EAAE,2BAA2B;IAC/B,WAAW,EAAE,KAAK;CAClB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/quality",
3
- "version": "0.72.0",
3
+ "version": "0.72.2",
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": {
@@ -55,7 +55,7 @@
55
55
  "@mdn/browser-compat-data": "8.1.7",
56
56
  "@shivaedev/errors": "0.10.1",
57
57
  "@shivaedev/heavy-lock": "0.11.1",
58
- "@shivaedev/service": "0.8.1",
58
+ "@shivaedev/service": "0.8.2",
59
59
  "@shivaedev/skills": "0.8.1",
60
60
  "@vitest/coverage-v8": "5.0.5",
61
61
  "browserslist": "4.29.5",
@@ -68,7 +68,7 @@
68
68
  "@effect/platform-node": "4.1.1",
69
69
  "@effect/platform-node-shared": "4.1.1",
70
70
  "@effect/vitest": "4.1.1",
71
- "@shivaedev/test-story": "0.45.2",
71
+ "@shivaedev/test-story": "0.45.3",
72
72
  "@types/node": "24.19.2",
73
73
  "@typescript/native": "npm:typescript@7.0.2",
74
74
  "effect": "4.1.1",
@@ -77,7 +77,7 @@
77
77
  "peerDependencies": {
78
78
  "@effect/platform-node": "4.1.1",
79
79
  "@effect/platform-node-shared": "4.1.1",
80
- "@shivaedev/test-story": "0.45.2",
80
+ "@shivaedev/test-story": "0.45.3",
81
81
  "effect": "4.1.1",
82
82
  "vitest": "5.0.5"
83
83
  },
@@ -3,12 +3,26 @@ import ts from "typescript";
3
3
  import { type BuildBindings, buildEntryValue, buildOption } from "#adapters/buildEntryValue.ts";
4
4
  import { importedCall } from "#adapters/importedCall.ts";
5
5
 
6
- function pathFromCall(node: ts.CallExpression, cwd: string, paths: (expression: ts.Expression) => readonly string[]): readonly string[] {
6
+ function pathFromCall(
7
+ node: ts.CallExpression,
8
+ cwd: string,
9
+ file: string,
10
+ paths: (expression: ts.Expression) => readonly string[],
11
+ ): readonly string[] {
7
12
  if (node.expression.getText() === "process.cwd" && node.arguments.length === 0) {
8
13
  return [cwd];
9
14
  }
10
15
  const imported = importedCall(node);
11
- if (imported === undefined || !/^(?:node:)?path$/u.test(imported.module) || (imported.name !== "join" && imported.name !== "resolve")) {
16
+ if (imported?.module === "node:url" && imported.name === "fileURLToPath" && node.arguments[0] !== undefined) {
17
+ const argument = node.arguments[0];
18
+ return ts.isPropertyAccessExpression(argument)
19
+ && ts.isMetaProperty(argument.expression)
20
+ && argument.expression.keywordToken === ts.SyntaxKind.ImportKeyword
21
+ && argument.name.text === "url"
22
+ ? [file]
23
+ : [];
24
+ }
25
+ if (imported === undefined || !/^(?:node:)?path$/u.test(imported.module) || !["join", "resolve", "dirname"].includes(imported.name)) {
12
26
  return [];
13
27
  }
14
28
  const parts = node.arguments.map(paths);
@@ -16,7 +30,13 @@ function pathFromCall(node: ts.CallExpression, cwd: string, paths: (expression:
16
30
  return [];
17
31
  }
18
32
  const values = parts.flat();
19
- return [imported.name === "resolve" ? posix.resolve(cwd, ...values) : posix.join(...values)];
33
+ if (imported.name === "resolve") {
34
+ return [posix.resolve(cwd, ...values)];
35
+ }
36
+ if (imported.name === "dirname") {
37
+ return [posix.dirname(values[0] ?? "")];
38
+ }
39
+ return [posix.join(...values)];
20
40
  }
21
41
 
22
42
  function valuesOf(node: ts.Expression): readonly ts.Expression[] {
@@ -57,5 +77,5 @@ export function buildEntryPaths(
57
77
  ) {
58
78
  return [posix.dirname(file)];
59
79
  }
60
- return ts.isCallExpression(node) ? pathFromCall(node, cwd, paths) : valuesOf(node).flatMap(paths);
80
+ return ts.isCallExpression(node) ? pathFromCall(node, cwd, file, paths) : valuesOf(node).flatMap(paths);
61
81
  }
@@ -5,16 +5,46 @@ export function foreignDeclaration(node: ts.Declaration): boolean {
5
5
  return file.includes("/node_modules/") && !/\/(?:effect|@effect|@shivaedev)\//u.test(file);
6
6
  }
7
7
 
8
+ function methodType(checker: ts.TypeChecker, type: ts.Type | undefined, name: string): ts.Type | undefined {
9
+ if (type === undefined) {
10
+ return undefined;
11
+ }
12
+ const property = (type.isUnionOrIntersection() ? type.types : [type])
13
+ .map((part) => part.getProperty(name))
14
+ .find((candidate) => candidate !== undefined);
15
+ return property === undefined ? undefined : checker.getTypeOfSymbol(property);
16
+ }
17
+
18
+ function methodName(node: ts.MethodDeclaration): string {
19
+ return node.name.getText().replace(/^['"]|['"]$/gu, "");
20
+ }
21
+
22
+ function implementedMethodType(checker: ts.TypeChecker, node: ts.MethodDeclaration): ts.Type | undefined {
23
+ if (!ts.isClassLike(node.parent) || node.name === undefined) {
24
+ return undefined;
25
+ }
26
+ for (const typeNode of (node.parent.heritageClauses ?? [])
27
+ .filter((clause) => clause.token === ts.SyntaxKind.ImplementsKeyword)
28
+ .flatMap((clause) => clause.types)) {
29
+ const type = methodType(checker, checker.getTypeAtLocation(typeNode), methodName(node));
30
+ if (type !== undefined) {
31
+ return type;
32
+ }
33
+ }
34
+ return undefined;
35
+ }
36
+
8
37
  export function contextualCallbackType(checker: ts.TypeChecker, node: ts.Node): ts.Type | undefined {
9
38
  if (ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {
10
39
  return checker.getContextualType(node);
11
40
  }
12
- if (ts.isMethodDeclaration(node) && ts.isObjectLiteralExpression(node.parent)) {
13
- const object = checker.getContextualType(node.parent);
14
- const property = object?.getProperty(node.name.getText().replace(/^["']|["']$/gu, ""));
15
- return property === undefined ? undefined : checker.getTypeOfSymbol(property);
41
+ if (!ts.isMethodDeclaration(node)) {
42
+ return undefined;
16
43
  }
17
- return undefined;
44
+ if (ts.isObjectLiteralExpression(node.parent)) {
45
+ return methodType(checker, checker.getContextualType(node.parent), methodName(node));
46
+ }
47
+ return implementedMethodType(checker, node);
18
48
  }
19
49
 
20
50
  export function foreignCallbackParameter(checker: ts.TypeChecker, parameter: ts.ParameterDeclaration): boolean {
@@ -2,6 +2,50 @@ import ts from "typescript";
2
2
  import { parameterOrigins } from "#adapters/parameterOrigins.ts";
3
3
  import { serviceAssemblyImports } from "#adapters/serviceAssemblyImports.ts";
4
4
  import { directServiceDefinitions, serviceProperty } from "#adapters/serviceAssemblySyntax.ts";
5
+ import { effectApi, resolvedValue } from "#adapters/serviceModelSyntax.ts";
6
+
7
+ function wrappedCallArguments(
8
+ checker: ts.TypeChecker,
9
+ parameter: ts.ParameterDeclaration,
10
+ sources: readonly ts.SourceFile[],
11
+ ): readonly ts.Expression[] | undefined {
12
+ const callback = parameter.parent;
13
+ if (
14
+ !(
15
+ (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback))
16
+ && ts.isCallExpression(callback.parent)
17
+ && callback.parent.arguments.includes(callback)
18
+ )
19
+ ) {
20
+ return undefined;
21
+ }
22
+ const wrapper = callback.parent;
23
+ if (!(ts.isCallExpression(wrapper.expression) && effectApi(checker, wrapper.expression.expression, "fn"))) {
24
+ return undefined;
25
+ }
26
+ const declaration = wrapper.parent;
27
+ if (!(ts.isVariableDeclaration(declaration) && declaration.initializer === wrapper && ts.isIdentifier(declaration.name))) {
28
+ return undefined;
29
+ }
30
+ const symbol = checker.getSymbolAtLocation(declaration.name);
31
+ if (symbol === undefined) {
32
+ return undefined;
33
+ }
34
+ const arguments_: ts.Expression[] = [];
35
+ for (const source of sources) {
36
+ function visit(node: ts.Node): void {
37
+ if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && checker.getSymbolAtLocation(node.expression) === symbol) {
38
+ const argument = node.arguments[callback.parameters.indexOf(parameter)];
39
+ if (argument !== undefined) {
40
+ arguments_.push(argument);
41
+ }
42
+ }
43
+ ts.forEachChild(node, visit);
44
+ }
45
+ visit(source);
46
+ }
47
+ return arguments_;
48
+ }
5
49
 
6
50
  export function ownedServiceParameters(checker: ts.TypeChecker, sources: readonly ts.SourceFile[]) {
7
51
  const states = new Set<ts.Node>();
@@ -16,10 +60,54 @@ export function ownedServiceParameters(checker: ts.TypeChecker, sources: readonl
16
60
  }
17
61
  }
18
62
  const originates = parameterOrigins(checker, sources);
19
- return (parameter: ts.ParameterDeclaration): boolean =>
20
- states.size > 0
21
- && originates(parameter, (value) => {
22
- const declaration = ts.isIdentifier(value) ? checker.getSymbolAtLocation(value)?.valueDeclaration : value;
23
- return declaration !== undefined && states.has(declaration);
24
- });
63
+ const results = new Map<ts.ParameterDeclaration, boolean>();
64
+ const wrappedArguments = new Map<ts.ParameterDeclaration, readonly ts.Expression[] | undefined>();
65
+ function owned(parameter: ts.ParameterDeclaration, active: ReadonlySet<ts.ParameterDeclaration> = new Set()): boolean {
66
+ if (active.has(parameter)) {
67
+ return false;
68
+ }
69
+ const cached = results.get(parameter);
70
+ if (cached !== undefined) {
71
+ return cached;
72
+ }
73
+ const visited = new Set([...active, parameter]);
74
+ const wrapped = wrappedArguments.has(parameter) ? wrappedArguments.get(parameter) : wrappedCallArguments(checker, parameter, sources);
75
+ wrappedArguments.set(parameter, wrapped);
76
+ if (wrapped !== undefined) {
77
+ const result = wrapped.length > 0 && wrapped.every((argument) => ownedValue(argument, visited));
78
+ results.set(parameter, result);
79
+ return result;
80
+ }
81
+ const result = originates(parameter, (value) => ownedValue(value, visited));
82
+ results.set(parameter, result);
83
+ return result;
84
+ }
85
+ function rootParameter(value: ts.Node): ts.ParameterDeclaration | undefined {
86
+ let origin = value;
87
+ while (ts.isPropertyAccessExpression(origin) || ts.isElementAccessExpression(origin)) {
88
+ origin = origin.expression;
89
+ }
90
+ const root = ts.isIdentifier(origin) ? checker.getSymbolAtLocation(origin)?.valueDeclaration : undefined;
91
+ return root !== undefined && ts.isParameter(root) ? root : undefined;
92
+ }
93
+ function isOwnedState(value: ts.Node): boolean {
94
+ const declaration = ts.isIdentifier(value) ? checker.getSymbolAtLocation(value)?.valueDeclaration : value;
95
+ const root = rootParameter(value);
96
+ return (declaration !== undefined && states.has(declaration)) || (root !== undefined && states.has(root));
97
+ }
98
+ function ownedValue(value: ts.Node, active: ReadonlySet<ts.ParameterDeclaration>): boolean {
99
+ if (isOwnedState(value)) {
100
+ return true;
101
+ }
102
+ const root = rootParameter(value);
103
+ if (root !== undefined && owned(root, active)) {
104
+ return true;
105
+ }
106
+ if (!ts.isExpression(value)) {
107
+ return false;
108
+ }
109
+ const resolved = resolvedValue(checker, value);
110
+ return resolved !== value && ts.isExpression(resolved) && ownedValue(resolved, active);
111
+ }
112
+ return (parameter: ts.ParameterDeclaration): boolean => states.size > 0 && owned(parameter);
25
113
  }
@@ -34,7 +34,7 @@ export const serviceParameters = defineRule({
34
34
  });
35
35
  }),
36
36
  description:
37
- "Exported and local functions and public methods take services from Effect's environment, including aliases, constraints, inferred/destructured parameters and factory returns. Service keys/classes, non-empty Contexts and implementation shapes are services; Effect/Stream requirements are computations. Service implementation methods, framework callbacks, module-level React components and their props, owned initializer state, foreign host object methods, owned foreign adapter resources and Layer constructors are accepted. Within Effect code, test-support/ folders are exempt. The fixed adapters/ convention bridges outside libraries to Effect values; adapters still follow this rule and ambient runtime bans. No config exceptions or inline suppressions; baseline existing debt.",
37
+ "Exported and local functions and public methods take services from Effect's environment, including aliases, constraints, inferred/destructured parameters and factory returns. Service keys/classes, non-empty Contexts and implementation shapes are services; Effect/Stream requirements are computations. Service implementation methods, framework callbacks, module-level React components and their props, owned initializer state, foreign host callbacks in object literals and classes, owned foreign adapter resources and Layer constructors are accepted. Within Effect code, test-support/ folders are exempt. The fixed adapters/ convention bridges outside libraries to Effect values; adapters still follow this rule and ambient runtime bans. No config exceptions or inline suppressions; baseline existing debt.",
38
38
  id: "effect/service-parameters",
39
39
  registrable: false,
40
40
  });