@shivaedev/quality 0.13.0 → 0.14.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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.0 - 2026-10-05
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- The `effect-fn-functions` plugin reports a top-level function whose whole body is `Effect.gen(…)`, written as an arrow or as a function that only returns it. Write it as `const loadItem = Effect.fn("ItemStore.loadItem")(function* (id: string) { … })`, which names its span after the function, or as `Effect.fnUntraced(…)` when it needs no span. A function nested in another, an object member, a `.pipe(…)` on the `Effect.gen` and a function that runs other statements before it are not reported. The rule has no fix.
|
|
8
|
+
- The `effect-test-bodies` plugin reports, in test code, a callback whose whole body is `Effect.gen(function* () { … })` passed to `it`, `test` or one of their members, such as `it.effect` or `it.effect.skipIf(…)`. Pass the generator to the test instead, `it.effect("loads the item", function* () { … })`, and let the test helper run it with `Effect.gen`; `@shivaedev/effect-test/it.ts` provides such an `it`. Test code is a test file or a file under `test-support/`, as for every other rule. The rule has no fix.
|
|
9
|
+
- A repository that upgrades records the existing findings of the two plugins with `quality baseline write --rule biome/plugin`.
|
|
10
|
+
|
|
3
11
|
## 0.13.0 - 2026-10-05
|
|
4
12
|
|
|
5
13
|
### Changed
|
package/README.md
CHANGED
|
@@ -422,6 +422,8 @@ A name says what a thing is, and the same kind of thing is named the same way ev
|
|
|
422
422
|
| Schemas | PascalCase and named like their type: `const Item = Schema.Struct(...)` with `type Item = typeof Item.Type`. | `schema-names` plugin |
|
|
423
423
|
| `Schema.Struct` fields | camelCase, also when quoted. Outside data keeps its keys only at the edge: `Schema.Struct({ createdAt: Schema.String }).pipe(Schema.encodeKeys({ createdAt: "created_at" }))`. | `schema-struct-keys` plugin, `key-names` plugin |
|
|
424
424
|
| `Effect.fn` spans | `"Owner.operation"`, where the owner is the service or module and the operation is the name the function is bound to: `const loadItem = Effect.fn("ItemStore.loadItem")`, and `loadItem: Effect.fn("ItemStore.loadItem")` in an object. | `effect-fn-spans` plugin |
|
|
425
|
+
| `Effect.gen` functions | A top-level function whose whole body is `Effect.gen` is an `Effect.fn`: `const loadItem = Effect.fn("ItemStore.loadItem")(function* (id: string) { … })`, or `Effect.fnUntraced` when it needs no span. | `effect-fn-functions` plugin |
|
|
426
|
+
| Effect test bodies | In test code, a test takes the generator itself: `it.effect("loads the item", function* () { … })`, never `() => Effect.gen(function* () { … })`. The test helper runs it with `Effect.gen`. | `effect-test-bodies` plugin |
|
|
425
427
|
| Service Layers | A static `layer` on the service, read as `ItemStore.layer`. No exported `ItemStoreLive` or `ItemStoreLayer` constant. A Layer that wires an application together stays unexported. | `service-layers` plugin |
|
|
426
428
|
| Private members | A `#field`. No `private`, `protected` or `public` modifier. | `useConsistentMemberAccessibility` |
|
|
427
429
|
| React | A function passed to an `onX` prop is `handleX`, an `onX` prop forwarded as it is, or a state setter passed as it is: `onOpenChange={setOpen}`. A context is `ThemeContext`, a ref `inputRef`, an id `fieldId`. A module that exports a component exports only components; a test may define the components it renders. | `handler-names` plugin, `useReactNamingConvention`, `useComponentExportOnlyModules` |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
engine biome(1.0)
|
|
2
|
+
language js(typescript, jsx)
|
|
3
|
+
|
|
4
|
+
or {
|
|
5
|
+
JsVariableDeclarator(id=$name, initializer=JsInitializerClause(expression=JsArrowFunctionExpression(body=$body))),
|
|
6
|
+
JsFunctionDeclaration(id=$name, body=$body),
|
|
7
|
+
JsFunctionExportDefaultDeclaration(id=$name, body=$body)
|
|
8
|
+
} as $function where {
|
|
9
|
+
$body <: or {
|
|
10
|
+
JsFunctionBody(statements=[JsReturnStatement(argument=`Effect.gen($...)`)]),
|
|
11
|
+
`Effect.gen($...)`
|
|
12
|
+
},
|
|
13
|
+
! $function <: within JsFunctionBody() ,
|
|
14
|
+
register_diagnostic(span=$name, message="A top-level function whose whole body is Effect.gen is an Effect.fn, which names its span and keeps the call site in traces: const loadItem = Effect.fn('ItemStore.loadItem')(function* (id: string) { ... }). Effect.fnUntraced fits a function that needs no span.")
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
engine biome(1.0)
|
|
2
|
+
language js(typescript, jsx)
|
|
3
|
+
|
|
4
|
+
`$test($title, $callback, $...)` where {
|
|
5
|
+
$test <: r"it|test|it\.[A-Za-z.]+|test\.[A-Za-z.]+|it\.[A-Za-z.]+\(.*\)|test\.[A-Za-z.]+\(.*\)",
|
|
6
|
+
$callback <: JsArrowFunctionExpression(body=$body),
|
|
7
|
+
$body <: or {
|
|
8
|
+
`Effect.gen(function* () { $... })`,
|
|
9
|
+
JsFunctionBody(statements=[JsReturnStatement(argument=`Effect.gen(function* () { $... })`)])
|
|
10
|
+
},
|
|
11
|
+
register_diagnostic(span=$callback, message="A test body that is only Effect.gen is the generator itself: pass the function* to the test, as in it.effect('loads the item', function* () { ... }), and the test helper runs it with Effect.gen. @shivaedev/effect-test/it.ts provides an it whose effect and live testers take one.")
|
|
12
|
+
}
|
package/biome/preset.json
CHANGED
|
@@ -647,6 +647,14 @@
|
|
|
647
647
|
"includes": ["**/*.ts", "**/*.tsx", "!**/*.d.ts"],
|
|
648
648
|
"path": "./node_modules/@shivaedev/quality/biome/plugins/effect-fn-spans.grit"
|
|
649
649
|
},
|
|
650
|
+
{
|
|
651
|
+
"includes": ["**/*.ts", "**/*.tsx", "!**/*.d.ts"],
|
|
652
|
+
"path": "./node_modules/@shivaedev/quality/biome/plugins/effect-fn-functions.grit"
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"includes": ["**/*.test.*", "**/*.spec.*", "**/test-support/**", "!**/*.d.ts"],
|
|
656
|
+
"path": "./node_modules/@shivaedev/quality/biome/plugins/effect-test-bodies.grit"
|
|
657
|
+
},
|
|
650
658
|
{
|
|
651
659
|
"includes": ["**/*.ts", "**/*.tsx", "!**/*.d.ts"],
|
|
652
660
|
"path": "./node_modules/@shivaedev/quality/biome/plugins/constant-names.grit"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/quality",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
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": {
|