@adbayb/stack 3.6.0 → 3.7.0-next.1794007272976.f444a4a
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/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@ Rules: `software-design` reference `smells-antipatterns.md` and `software-design
|
|
|
37
37
|
|
|
38
38
|
Rules: `software-design` reference `clean-code.md`.
|
|
39
39
|
|
|
40
|
-
- Evidence: laws (KISS cleverness, DRY knowledge ownership, POLA surprises, Gall/YAGNI over-building, Kernighan hard-to-debug code, Conway/unclear ownership, Boy Scout/Broken Windows small decay left in touched code); naming (intent, one verb per meaning, banned synonyms, `All` infix, boolean `is*/has*/can*`, `input`/`output` generics vs domain names, `<Fn>Input`/`<Fn>Output` boundary contracts, `on<Event>` handlers, verb-first functions/noun types, stutter, type prefixes, `Manager`/`Helper`/`Util` identifiers, scope-sized names, consistency with the slice's existing verbs); function size/nesting/guards, single-level abstraction, output args; explanatory variables, encapsulated and positive conditionals, pass-through single-use aliases; named constants for domain policy and arbitrary defaults/limits/timeouts/retry counts (with stated reason); temporal coupling and logical dependencies left implicit (ambient order, hidden initialization); comments (why not what), commented-out code; type-checker silencing (`as any`, `@ts-ignore`, `!`); redundant annotations;
|
|
40
|
+
- Evidence: laws (KISS cleverness, DRY knowledge ownership, POLA surprises, Gall/YAGNI over-building, Kernighan hard-to-debug code, Conway/unclear ownership, Boy Scout/Broken Windows small decay left in touched code); naming (intent, one verb per meaning, banned synonyms, `All` infix, boolean `is*/has*/can*`, `input`/`output` generics vs domain names, `<Fn>Input`/`<Fn>Output` boundary contracts, `on<Event>` handlers, verb-first functions/noun types, stutter, type prefixes, `Manager`/`Helper`/`Util` identifiers, scope-sized names, consistency with the slice's existing verbs); function size/nesting/guards, single-level abstraction, output args; explanatory variables, encapsulated and positive conditionals, pass-through single-use aliases; modern, idiomatic syntax when it improves clarity or reduces code, provided it preserves readability and behavior and is supported by declared runtime/browser targets and toolchain; avoid assumed performance gains and costly or incompatible transpilation/polyfills; named constants for domain policy and arbitrary defaults/limits/timeouts/retry counts (with stated reason); temporal coupling and logical dependencies left implicit (ambient order, hidden initialization); comments (why not what), commented-out code; type-checker silencing (`as any`, `@ts-ignore`, `!`); redundant annotations; primary exported APIs before supporting types and implementation details, test scenarios before test helpers, and const use-before-define; error handling convention (Result mapping at adapters, absence vs failed I/O, preserved causes, swallowed errors, error codes mixed with values); silent domain (logging/metrics in entities or use cases); `undefined` vs `null` semantics; neutral text; public interface docs/TSDoc.
|
|
41
41
|
- Deltas: scope naming/style to new or edited code, neutral-text checks to introduced text.
|
|
42
42
|
|
|
43
43
|
## F. Tests / cohesion / coupling / errors
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
## Code rules
|
|
16
16
|
|
|
17
|
+
- Prefer modern, idiomatic syntax when it improves clarity or reduces code, and only when supported by the project's declared runtime/browser targets and toolchain. Preserve readability and behavior; don't assume newer syntax is faster, and avoid syntax that requires costly or incompatible transpilation/polyfills.
|
|
17
18
|
- Names reveal intent: `refundOverdueOrders(clock, repo)` beats `process(data, 1)`. No abbreviations, no `tmp`/`data2`, no misleading names (`getAll` that is actually a map).
|
|
18
19
|
- Functions are small, single-level, single-purpose. Prefer guard clauses and shallow nesting; deeper nesting is a signal to check for mixed responsibilities or hard-to-follow control flow. For new or substantially edited functions approaching 20 lines, check whether extraction improves cohesion and readability; line count alone is not a reason to add indirection. Leave unrelated existing functions for a scoped refactor.
|
|
19
20
|
- Use `async`/`await` to sequence asynchronous work; generators instead provide lazy iteration. Use a generator when incremental production is needed and it makes the flow clearer than a direct loop or platform stream, not just to express ordinary async control flow.
|
|
20
21
|
- Use `api-surface.md` for command/query separation. No output args. Name literals that encode domain policy or recur with the same meaning; leave self-explanatory structural literals inline.
|
|
21
22
|
- Match the surrounding annotation style: skip annotations that only repeat an inferred type, but keep explicit types where the file or exported contract already uses them; annotate when a stricter type than inferred is wanted (e.g. an enum instead of `string`).
|
|
22
|
-
- Order files top-down:
|
|
23
|
+
- Order production files top-down: put the primary exported API first, followed by supporting types and implementation details. In test files, describe scenarios before test helpers. Do not call a `const` helper at module load before it is defined.
|
|
23
24
|
- Comments explain why, never what. Delete commented-out code and obvious narration. Code should read without them.
|
|
24
25
|
- Error handling is explicit: use the project's established convention. In Result-based code, represent expected failures as Results and map foreign exceptions at adapters; do not introduce a Result library or migrate throw-based code for this rule. Distinguish expected absence from failed I/O; never turn a failed lookup into an empty result. Preserve error causes for boundary reporting, without leaking infrastructure or secrets. Hosts map failures to responses and logs; do not swallow errors or mix error codes with successful values.
|
|
25
26
|
- Silent domain: no logging or metrics in entities or use cases. Observability lives in adapters/hosts (middleware/decorators); the domain signals through typed errors and return values.
|