@shivaedev/quality 0.49.0 → 0.50.0
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 +23 -0
- package/README.md +8 -2
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +8 -34
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/baseline.d.ts +1 -1
- package/dist/cli/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +9 -3
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/messages.d.ts +1 -1
- package/dist/cli/messages.d.ts.map +1 -1
- package/dist/cli/messages.js +2 -1
- package/dist/cli/messages.js.map +1 -1
- package/dist/cli/options.d.ts +45 -0
- package/dist/cli/options.d.ts.map +1 -0
- package/dist/cli/options.js +35 -0
- package/dist/cli/options.js.map +1 -0
- package/dist/cli/program.js +1 -1
- package/dist/cli/program.js.map +1 -1
- package/dist/imports/classifyRuntime.d.ts.map +1 -1
- package/dist/imports/classifyRuntime.js +4 -1
- package/dist/imports/classifyRuntime.js.map +1 -1
- package/dist/imports/runtime.d.ts +6 -3
- package/dist/imports/runtime.d.ts.map +1 -1
- package/dist/imports/runtime.js +15 -21
- package/dist/imports/runtime.js.map +1 -1
- package/dist/naming/migrationFile.d.ts.map +1 -1
- package/dist/naming/migrationFile.js +3 -1
- package/dist/naming/migrationFile.js.map +1 -1
- package/dist/naming/moduleRoot.d.ts +2 -0
- package/dist/naming/moduleRoot.d.ts.map +1 -0
- package/dist/naming/moduleRoot.js +13 -0
- package/dist/naming/moduleRoot.js.map +1 -0
- package/dist/rules/builtIn.d.ts +1 -1
- package/dist/rules/effect/boundary.d.ts.map +1 -1
- package/dist/rules/effect/boundary.js +30 -6
- package/dist/rules/effect/boundary.js.map +1 -1
- package/dist/rules/effect/boundaryCalls.d.ts +3 -0
- package/dist/rules/effect/boundaryCalls.d.ts.map +1 -0
- package/dist/rules/effect/boundaryCalls.js +121 -0
- package/dist/rules/effect/boundaryCalls.js.map +1 -0
- package/dist/rules/effect/boundaryReference.d.ts +4 -0
- package/dist/rules/effect/boundaryReference.d.ts.map +1 -0
- package/dist/rules/effect/boundaryReference.js +80 -0
- package/dist/rules/effect/boundaryReference.js.map +1 -0
- package/dist/rules/effect/program.d.ts +1 -1
- package/dist/rules/effect/program.d.ts.map +1 -1
- package/dist/rules/effect/program.js +4 -1
- package/dist/rules/effect/program.js.map +1 -1
- package/dist/rules/effect/promiseParameter.d.ts +3 -0
- package/dist/rules/effect/promiseParameter.d.ts.map +1 -0
- package/dist/rules/effect/promiseParameter.js +24 -0
- package/dist/rules/effect/promiseParameter.js.map +1 -0
- package/dist/rules/imports/runtime.d.ts +1 -1
- package/dist/rules/imports/runtime.d.ts.map +1 -1
- package/dist/rules/stories/groupedOutcomes.js +1 -1
- package/dist/rules/stories/groupedOutcomes.js.map +1 -1
- package/docs/debt-and-hooks.md +3 -1
- package/package.json +2 -2
- package/src/cli/args.ts +15 -43
- package/src/cli/baseline.ts +9 -2
- package/src/cli/messages.ts +2 -1
- package/src/cli/options.ts +43 -0
- package/src/cli/program.ts +1 -1
- package/src/imports/classifyRuntime.ts +4 -1
- package/src/imports/runtime.ts +19 -21
- package/src/naming/migrationFile.ts +3 -1
- package/src/naming/moduleRoot.ts +13 -0
- package/src/rules/effect/boundary.ts +48 -24
- package/src/rules/effect/boundaryCalls.ts +130 -0
- package/src/rules/effect/boundaryReference.ts +85 -0
- package/src/rules/effect/program.ts +4 -1
- package/src/rules/effect/promiseParameter.ts +26 -0
- package/src/rules/stories/groupedOutcomes.ts +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
export function promiseParameter(checker: ts.TypeChecker, node: ts.Node): string | undefined {
|
|
4
|
+
if (!ts.isParameter(node)) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
const seen = new Set<ts.Type>();
|
|
8
|
+
function carries(type: ts.Type): boolean {
|
|
9
|
+
if (seen.has(type)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
seen.add(type);
|
|
13
|
+
if (["Promise", "PromiseLike"].includes(type.getSymbol()?.name ?? "")) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (type.isUnionOrIntersection()) {
|
|
17
|
+
return type.types.some(carries);
|
|
18
|
+
}
|
|
19
|
+
const constraint = checker.getBaseConstraintOfType(type);
|
|
20
|
+
return (
|
|
21
|
+
(constraint !== undefined && carries(constraint))
|
|
22
|
+
|| type.getCallSignatures().some((signature) => carries(checker.getReturnTypeOfSignature(signature)))
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return carries(checker.getTypeAtLocation(node)) ? `Promise-typed parameter (${node.name.getText()})` : undefined;
|
|
26
|
+
}
|
|
@@ -6,7 +6,7 @@ import { storySources } from "./sources.ts";
|
|
|
6
6
|
import { memberName, syntaxFindings, unwrapped } from "./syntax.ts";
|
|
7
7
|
|
|
8
8
|
const MESSAGE =
|
|
9
|
-
'Checks several outcomes with consecutive expect(yield* …) lines. Let the story\'s words lead: yield* outcomes(
|
|
9
|
+
'Checks several outcomes with consecutive expect(yield* …) lines. Let the story\'s words lead: yield* outcomes([["label", () => readout(), expected], …]) from @shivaedev/test-story/server/outcomes.ts, one row per outcome. Keep a plain expect for a single outcome.';
|
|
10
10
|
|
|
11
11
|
const EXPECT_MODULES = ["vitest", "@effect/vitest"];
|
|
12
12
|
|