@systemfsoftware/stryker-ignorer-effect-schema-declarations 0.1.1 → 0.2.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 +6 -0
- package/README.md +23 -14
- package/dist/index.d.ts +14 -0
- package/dist/index.mjs +133 -45
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @systemfsoftware/stryker-ignorer-effect-schema-declarations
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- The ignorer recognizes the declaration forms Effect Schema files use today, so far fewer unkillable mutants reach your report. A `TaggedStruct` tag, an `annotate({ identifier, description, title })` object, a filter or check annotation object such as `makeFilter(predicate, { expected })`, a declaration's `toCodecArbitrary` callback and the arbitrary link transformation it returns, a decoding or constructor default, and a `TypeId` identity constant are all reported as `Ignored` now. Predicates, bounds, patterns, literal vocabularies, struct field sets, and codec decode/encode transformations keep being mutated. Each newly recognized form carries its own exported reason constant.
|
|
8
|
+
|
|
3
9
|
## 0.1.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -17,18 +17,16 @@ pnpm add -D @systemfsoftware/stryker-ignorer-effect-schema-declarations
|
|
|
17
17
|
|
|
18
18
|
## Setup in `stryker.config.ts`
|
|
19
19
|
|
|
20
|
-
Add the
|
|
20
|
+
Add the package name to `ignorers`. Every ignorer the module exports is then active.
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
import { defineConfig } from '@systemfsoftware/stryker-js/config'
|
|
24
24
|
|
|
25
25
|
export default defineConfig({
|
|
26
26
|
testRunner: {
|
|
27
|
-
plugin:
|
|
27
|
+
plugin: '@systemfsoftware/stryker-js-vitest-runner',
|
|
28
28
|
},
|
|
29
|
-
ignorers: [
|
|
30
|
-
import.meta.resolve('@systemfsoftware/stryker-ignorer-effect-schema-declarations'),
|
|
31
|
-
],
|
|
29
|
+
ignorers: ['@systemfsoftware/stryker-ignorer-effect-schema-declarations'],
|
|
32
30
|
})
|
|
33
31
|
```
|
|
34
32
|
|
|
@@ -36,15 +34,26 @@ Mutants recognized by the ignorer are reported with status `Ignored`, carrying t
|
|
|
36
34
|
|
|
37
35
|
## What It Ignores
|
|
38
36
|
|
|
39
|
-
| Declaration
|
|
40
|
-
|
|
|
41
|
-
| Brand descriptions
|
|
42
|
-
| `TaggedClass` / `TaggedError` tag strings
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
37
|
+
| Declaration | Example |
|
|
38
|
+
| --------------------------------------------------------- | ------------------------------------------------------------------------------------ |
|
|
39
|
+
| Brand descriptions | `Symbol.for('UserId')` |
|
|
40
|
+
| `TaggedClass` / `TaggedError` tag strings | `S.TaggedClass<A>()('Placed', { ... })` |
|
|
41
|
+
| `TaggedStruct` tag strings | `S.TaggedStruct('PeerMissing', { ... })` |
|
|
42
|
+
| Schema property declarations | Property definition schema trees in tagged classes |
|
|
43
|
+
| `optionalWith` default values | `S.optionalWith(S.Number, { default: () => 0 })` |
|
|
44
|
+
| `withDecodingDefault` / `withConstructorDefault` defaults | `S.withDecodingDefaultKey(Effect.succeed(true))` |
|
|
45
|
+
| Documentation annotations | `identifier`, `description`, `title`, `documentation`, `examples` |
|
|
46
|
+
| Pure documentation `annotations({ ... })` | `S.annotations({ title: 'Amount' })` |
|
|
47
|
+
| Pure documentation `annotate({ ... })` | `S.annotate({ identifier: 'PackageExport' })` |
|
|
48
|
+
| Filter/check annotation objects | `S.makeFilter(pred, { expected: 'a canonical file' })` |
|
|
49
|
+
| Generation-only declaration callbacks | `S.declare(pred, { toCodecArbitrary: () => arbitrary })` |
|
|
50
|
+
| Arbitrary link transformations | `S.link<T>()(S.Null, { decode: …, encode: … })` outside a production `toCodec*` slot |
|
|
51
|
+
| Type identity constants | `const TypeId = '…/StageError' as const` |
|
|
52
|
+
|
|
53
|
+
## What Stays Graded
|
|
54
|
+
|
|
55
|
+
Everything a mutant can still change at run time stays live: filter predicates and bounds, patterns, literal vocabularies, struct field sets, codec decode/encode transformations, and any object or string a schema uses to decide acceptance. The ignorer only removes mutants whose position cannot change a decoded value, a routing decision, or an encoded value.
|
|
47
56
|
|
|
48
57
|
## License
|
|
49
58
|
|
|
50
|
-
[Apache-2.0](
|
|
59
|
+
[Apache-2.0](../../LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -6,8 +6,18 @@ export declare const ANNOTATION_TEXT_IGNORED: 'annotation documentation value is
|
|
|
6
6
|
|
|
7
7
|
export declare const BRAND_NAME_IGNORED: 'Schema.brand name is identity-only data, not behaviour';
|
|
8
8
|
|
|
9
|
+
export declare const CHECK_ANNOTATION_OBJECT_IGNORED: 'filter/check annotation object holds documentation and generation hints, not behaviour';
|
|
10
|
+
|
|
11
|
+
export declare const CHECK_ANNOTATION_TEXT_IGNORED: 'filter/check annotation value is documentation data, not behaviour';
|
|
12
|
+
|
|
9
13
|
export declare const CLASS_ID_IGNORED: 'Schema.Class identifier is a declaration name, not behaviour';
|
|
10
14
|
|
|
15
|
+
export declare const DECODING_DEFAULT_IGNORED: 'withDecodingDefault/withConstructorDefault default is config, not behaviour';
|
|
16
|
+
|
|
17
|
+
export declare const GENERATION_ANNOTATION_IGNORED: 'arbitrary-generation annotation never runs in production, not behaviour';
|
|
18
|
+
|
|
19
|
+
export declare const LINK_TRANSFORMATION_IGNORED: 'S.link() transformation feeds arbitrary generation only, not production codecs';
|
|
20
|
+
|
|
11
21
|
export declare const OPTIONAL_DEFAULT_IGNORED: 'optionalWith default value is config, not behaviour';
|
|
12
22
|
|
|
13
23
|
export declare const strykerIgnorers: readonly Ignorer[];
|
|
@@ -16,6 +26,10 @@ export declare const SYMBOL_DESCRIPTION_IGNORED: 'Symbol.for() brand description
|
|
|
16
26
|
|
|
17
27
|
export declare const TAGGED_FIELDS_IGNORED: 'TaggedClass/TaggedError field schema is a declaration, not behaviour';
|
|
18
28
|
|
|
29
|
+
export declare const TAGGED_STRUCT_TAG_IGNORED: 'TaggedStruct _tag is a declaration discriminant, not behaviour';
|
|
30
|
+
|
|
19
31
|
export declare const TAGGED_TAG_IGNORED: 'TaggedClass/TaggedError _tag is a declaration discriminant, not behaviour';
|
|
20
32
|
|
|
33
|
+
export declare const TYPE_ID_IGNORED: 'a TypeId constant is a declaration identity, not behaviour';
|
|
34
|
+
|
|
21
35
|
export { }
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { defineIgnorer } from "@systemfsoftware/stryker-ignorer-kit";
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/effect-schema-declarations.ts
|
|
3
3
|
const SYMBOL_DESCRIPTION_IGNORED = "Symbol.for() brand description is identity-only data, not behaviour";
|
|
4
4
|
const TAGGED_TAG_IGNORED = "TaggedClass/TaggedError _tag is a declaration discriminant, not behaviour";
|
|
5
|
+
const TAGGED_STRUCT_TAG_IGNORED = "TaggedStruct _tag is a declaration discriminant, not behaviour";
|
|
5
6
|
const TAGGED_FIELDS_IGNORED = "TaggedClass/TaggedError field schema is a declaration, not behaviour";
|
|
6
7
|
const CLASS_ID_IGNORED = "Schema.Class identifier is a declaration name, not behaviour";
|
|
7
8
|
const BRAND_NAME_IGNORED = "Schema.brand name is identity-only data, not behaviour";
|
|
8
9
|
const OPTIONAL_DEFAULT_IGNORED = "optionalWith default value is config, not behaviour";
|
|
10
|
+
const DECODING_DEFAULT_IGNORED = "withDecodingDefault/withConstructorDefault default is config, not behaviour";
|
|
9
11
|
const ANNOTATION_OBJECT_IGNORED = "annotations object holding only documentation is a declaration, not behaviour";
|
|
10
12
|
const ANNOTATION_TEXT_IGNORED = "annotation documentation value is declaration data, not behaviour";
|
|
13
|
+
const CHECK_ANNOTATION_OBJECT_IGNORED = "filter/check annotation object holds documentation and generation hints, not behaviour";
|
|
14
|
+
const CHECK_ANNOTATION_TEXT_IGNORED = "filter/check annotation value is documentation data, not behaviour";
|
|
15
|
+
const GENERATION_ANNOTATION_IGNORED = "arbitrary-generation annotation never runs in production, not behaviour";
|
|
16
|
+
const LINK_TRANSFORMATION_IGNORED = "S.link() transformation feeds arbitrary generation only, not production codecs";
|
|
17
|
+
const TYPE_ID_IGNORED = "a TypeId constant is a declaration identity, not behaviour";
|
|
11
18
|
const DOCUMENTATION_KEYS = {
|
|
12
19
|
identifier: true,
|
|
13
20
|
description: true,
|
|
@@ -15,73 +22,154 @@ const DOCUMENTATION_KEYS = {
|
|
|
15
22
|
documentation: true,
|
|
16
23
|
examples: true
|
|
17
24
|
};
|
|
25
|
+
const CHECK_TEXT_KEYS = {
|
|
26
|
+
...DOCUMENTATION_KEYS,
|
|
27
|
+
expected: true,
|
|
28
|
+
message: true
|
|
29
|
+
};
|
|
30
|
+
const GENERATION_KEYS = {
|
|
31
|
+
toCodecArbitrary: true,
|
|
32
|
+
toArbitrary: true,
|
|
33
|
+
arbitraryConstraint: true,
|
|
34
|
+
arbitrary: true
|
|
35
|
+
};
|
|
36
|
+
const PRODUCTION_CODEC_KEYS = {
|
|
37
|
+
toCodec: true,
|
|
38
|
+
toCodecJson: true,
|
|
39
|
+
toCodecStringTree: true,
|
|
40
|
+
toCodecIso: true
|
|
41
|
+
};
|
|
18
42
|
const TAGGED_FACTORIES = ["TaggedClass", "TaggedError"];
|
|
19
|
-
const
|
|
43
|
+
const TAGGED_STRUCT_FACTORIES = ["TaggedStruct"];
|
|
44
|
+
const ANNOTATION_CALLEES = ["annotations", "annotate"];
|
|
45
|
+
const ANNOTATION_OBJECT_CALLEES = [
|
|
46
|
+
"makeFilter",
|
|
47
|
+
"makeFilterGroup",
|
|
48
|
+
"declare"
|
|
49
|
+
];
|
|
50
|
+
const DEFAULT_CALLEES = [
|
|
51
|
+
"withDecodingDefault",
|
|
52
|
+
"withDecodingDefaultKey",
|
|
53
|
+
"withConstructorDefault"
|
|
54
|
+
];
|
|
20
55
|
const isIdentifierNamed = (node, name) => node.type === "Identifier" && node.name === name;
|
|
21
56
|
const isIdentifierAmong = (node, names) => node.type === "Identifier" && names.includes(node.name);
|
|
22
57
|
const isPlainMember = (node) => node.type === "MemberExpression" && node.computed === false;
|
|
23
58
|
const isMemberObjectNamed = (node, object) => isPlainMember(node) && isIdentifierNamed(node.object, object);
|
|
24
59
|
const isMemberPropertyNamed = (node, property) => isPlainMember(node) && isIdentifierNamed(node.property, property);
|
|
60
|
+
const isMemberPropertyAmong = (node, properties) => isPlainMember(node) && isIdentifierAmong(node.property, properties);
|
|
25
61
|
const isSymbolForCallee = (callee) => isMemberObjectNamed(callee, "Symbol") && isMemberPropertyNamed(callee, "for");
|
|
26
62
|
const isFactoryReference = (reference, factories) => isPlainMember(reference) && isIdentifierAmong(reference.property, factories);
|
|
27
63
|
const isTaggedFactoryCallee = (callee) => callee.type === "CallExpression" && isFactoryReference(callee.callee, TAGGED_FACTORIES);
|
|
28
|
-
const
|
|
64
|
+
const isTaggedStructCallee = (callee) => isFactoryReference(callee, TAGGED_STRUCT_FACTORIES);
|
|
65
|
+
const isClassFactoryCallee = (callee) => isMemberPropertyNamed(callee, "Class");
|
|
29
66
|
const isBrandCallee = (callee) => isMemberPropertyNamed(callee, "brand");
|
|
30
|
-
const
|
|
67
|
+
const isLinkMember = (callee) => isMemberPropertyNamed(callee, "link");
|
|
68
|
+
const isLinkFactoryCall = (callee) => callee.type === "CallExpression" && isLinkMember(callee.callee);
|
|
69
|
+
const isLinkCallee = (callee) => isLinkMember(callee) || isLinkFactoryCall(callee);
|
|
70
|
+
const isAnnotationsCallee = (callee) => isMemberPropertyAmong(callee, ANNOTATION_CALLEES);
|
|
71
|
+
const isAnnotationObjectCallee = (callee) => isMemberPropertyAmong(callee, ANNOTATION_OBJECT_CALLEES);
|
|
72
|
+
const isDefaultCallee = (callee) => isMemberPropertyAmong(callee, DEFAULT_CALLEES);
|
|
31
73
|
const isOptionalWithCallee = (callee) => isMemberObjectNamed(callee, "S") && isMemberPropertyNamed(callee, "optionalWith");
|
|
32
74
|
const holdsCallOf = (call, callee) => call !== void 0 && callee(call.callee);
|
|
33
75
|
const holdsArgumentOf = (node, call, index, callee) => holdsCallOf(call, callee) && call.arguments[index] === node;
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const holdsDocumentationEntries = (properties) => properties.length > 0 && properties.every(isDocumentationEntry);
|
|
40
|
-
const isDocumentationOnlyObject = (node) => node.type === "ObjectExpression" && holdsDocumentationEntries(node.properties);
|
|
41
|
-
const holdsDocumentationObjectArgument = (node, call) => isDocumentationOnlyObject(node) && holdsArgumentOf(node, call, 0, isAnnotationsCallee);
|
|
76
|
+
const isKeyedByName = (value, keys) => typeof value === "string" && keys[value] === true;
|
|
77
|
+
const isLiteralKeyOf = (key, keys) => key.type === "Literal" && isKeyedByName(key.value, keys);
|
|
78
|
+
const isKeyOf = (key, keys) => key.type === "Identifier" ? isKeyedByName(key.name, keys) : isLiteralKeyOf(key, keys);
|
|
79
|
+
const isPropertyNode = (node) => node !== void 0 && node.type === "Property";
|
|
80
|
+
const isComputedFreeProperty = (node) => isPropertyNode(node) && node.computed === false;
|
|
42
81
|
const isCallNode = (node) => node !== void 0 && node.type === "CallExpression";
|
|
43
|
-
const asCall = (node) => isCallNode(node) ? node : void 0;
|
|
44
|
-
const isEntryNode = (property) => property !== void 0 && isDocumentationEntry(property);
|
|
45
|
-
const isDocumentationEntryValue = (property, node) => isEntryNode(property) && property.value === node;
|
|
46
82
|
const isObjectNode = (node) => node !== void 0 && node.type === "ObjectExpression";
|
|
47
|
-
const
|
|
48
|
-
const
|
|
83
|
+
const isVariableDeclarator = (node) => node?.type === "VariableDeclarator";
|
|
84
|
+
const asCall = (node) => isCallNode(node) ? node : void 0;
|
|
85
|
+
const isDocumentationKeyNode = (key) => isKeyOf(key, DOCUMENTATION_KEYS);
|
|
86
|
+
const isCheckTextKeyNode = (key) => isKeyOf(key, CHECK_TEXT_KEYS);
|
|
87
|
+
const isGenerationKeyNode = (key) => isKeyOf(key, GENERATION_KEYS);
|
|
88
|
+
const isDocumentationOrCheckKeyNode = (key) => isDocumentationKeyNode(key) || isCheckTextKeyNode(key);
|
|
89
|
+
const isDeclarationKeyNode = (key) => isDocumentationOrCheckKeyNode(key) || isGenerationKeyNode(key);
|
|
90
|
+
const isDocumentationEntry = (property) => isComputedFreeProperty(property) && isDocumentationKeyNode(property.key);
|
|
91
|
+
const isDeclarationEntry = (property) => isComputedFreeProperty(property) && isDeclarationKeyNode(property.key);
|
|
92
|
+
const holdsEntries = (properties, holds) => properties.length > 0 && properties.every(holds);
|
|
93
|
+
const isDocumentationOnlyObject = (node) => isObjectNode(node) && holdsEntries(node.properties, isDocumentationEntry);
|
|
94
|
+
const isDeclarationAnnotationObject = (node) => isObjectNode(node) && holdsEntries(node.properties, isDeclarationEntry);
|
|
95
|
+
const isArgumentAt = (node, call, index, callee) => isObjectNode(node) && holdsArgumentOf(node, asCall(call), index, callee);
|
|
96
|
+
const isDocumentationObjectArgument = (node, call) => isDocumentationOnlyObject(node) && holdsArgumentOf(node, call, 0, isAnnotationsCallee);
|
|
97
|
+
const isDeclarationAnnotationArgument = (node, call) => isDeclarationAnnotationObject(node) && holdsArgumentOf(node, call, 1, isAnnotationObjectCallee);
|
|
98
|
+
const simpleArgumentRule = (index, callee, reason) => ({
|
|
49
99
|
holds: (node, call) => holdsArgumentOf(node, call, index, callee),
|
|
50
100
|
reason
|
|
51
101
|
});
|
|
52
102
|
const LITERAL_ARGUMENT_RULES = [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
103
|
+
simpleArgumentRule(0, isSymbolForCallee, SYMBOL_DESCRIPTION_IGNORED),
|
|
104
|
+
simpleArgumentRule(0, isTaggedFactoryCallee, TAGGED_TAG_IGNORED),
|
|
105
|
+
simpleArgumentRule(0, isTaggedStructCallee, TAGGED_STRUCT_TAG_IGNORED),
|
|
106
|
+
simpleArgumentRule(0, isClassFactoryCallee, CLASS_ID_IGNORED),
|
|
107
|
+
simpleArgumentRule(0, isBrandCallee, BRAND_NAME_IGNORED)
|
|
108
|
+
];
|
|
109
|
+
const OBJECT_ARGUMENT_RULES = [
|
|
110
|
+
simpleArgumentRule(1, isTaggedFactoryCallee, TAGGED_FIELDS_IGNORED),
|
|
111
|
+
{
|
|
112
|
+
holds: isDocumentationObjectArgument,
|
|
113
|
+
reason: ANNOTATION_OBJECT_IGNORED
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
holds: isDeclarationAnnotationArgument,
|
|
117
|
+
reason: CHECK_ANNOTATION_OBJECT_IGNORED
|
|
118
|
+
}
|
|
57
119
|
];
|
|
58
|
-
const
|
|
59
|
-
holds: holdsDocumentationObjectArgument,
|
|
60
|
-
reason: ANNOTATION_OBJECT_IGNORED
|
|
61
|
-
}];
|
|
62
|
-
const ARROW_ARGUMENT_RULES = [argumentRule(1, isOptionalWithCallee, OPTIONAL_DEFAULT_IGNORED)];
|
|
120
|
+
const ARROW_ARGUMENT_RULES = [simpleArgumentRule(1, isOptionalWithCallee, OPTIONAL_DEFAULT_IGNORED)];
|
|
63
121
|
const firstArgumentReason = (rules, node, call) => rules.find((rule) => rule.holds(node, call))?.reason;
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
122
|
+
const slotsOf = (node, ancestors) => [node, ...ancestors].map((child, index) => ({
|
|
123
|
+
child,
|
|
124
|
+
ancestor: ancestors[index],
|
|
125
|
+
holder: ancestors[index + 1],
|
|
126
|
+
call: asCall(ancestors[index + 2])
|
|
127
|
+
}));
|
|
128
|
+
const isEntrySlot = (slot) => isComputedFreeProperty(slot.ancestor) && slot.ancestor.value === slot.child;
|
|
129
|
+
const isAnnotationEntrySlot = (slot) => isEntrySlot(slot) && isArgumentAt(slot.holder, slot.call, 1, isAnnotationObjectCallee);
|
|
130
|
+
const isDocumentationEntrySlot = (slot) => isEntrySlot(slot) && isDocumentationKeyNode(slot.ancestor.key);
|
|
131
|
+
const isDocumentationSlot = (slot) => isDocumentationEntrySlot(slot) && isArgumentAt(slot.holder, slot.call, 0, isAnnotationsCallee);
|
|
132
|
+
const isCallArgumentSlot = (slot, index) => isCallNode(slot.ancestor) && slot.ancestor.arguments[index] === slot.child;
|
|
133
|
+
const isArgumentSlot = (slot, index, callee) => isCallArgumentSlot(slot, index) && callee(slot.ancestor.callee);
|
|
134
|
+
const isDeclaratorSlot = (slot) => isVariableDeclarator(slot.ancestor) && slot.ancestor.init === slot.child;
|
|
135
|
+
const isDirectDeclaratorSlot = (node) => (slot) => isDeclaratorSlot(slot) && isDirectInitializer(slot, node);
|
|
136
|
+
const isTypeIdSlot = (node) => (slot) => isDirectDeclaratorSlot(node)(slot) && isTypeIdName(slot);
|
|
137
|
+
const isDirectInitializer = (slot, node) => slot.child === node || isAsExpressionOf(slot.child, node);
|
|
138
|
+
const isAsExpressionOf = (child, node) => child.type === "TSAsExpression" && child.expression === node;
|
|
139
|
+
const isTypeIdName = (slot) => slot.ancestor.id.type === "Identifier" && slot.ancestor.id.name === "TypeId";
|
|
140
|
+
const generationKeyReason = (key) => isGenerationKeyNode(key) ? GENERATION_ANNOTATION_IGNORED : void 0;
|
|
141
|
+
const textKeyReason = (key) => isCheckTextKeyNode(key) ? CHECK_ANNOTATION_TEXT_IGNORED : void 0;
|
|
142
|
+
const keyReason = (key) => generationKeyReason(key) ?? textKeyReason(key);
|
|
143
|
+
const entrySlotReason = (slot) => isAnnotationEntrySlot(slot) ? keyReason(slot.ancestor.key) : void 0;
|
|
144
|
+
const documentationSlotReason = (slot) => isDocumentationSlot(slot) ? ANNOTATION_TEXT_IGNORED : void 0;
|
|
145
|
+
const argumentSlotReason = (index, callee, reason) => (slot) => isArgumentSlot(slot, index, callee) ? reason : void 0;
|
|
146
|
+
const typeIdSlotReason = (node) => (slot) => isTypeIdSlot(node)(slot) ? TYPE_ID_IGNORED : void 0;
|
|
147
|
+
const isProductionCodecKey = (key) => isKeyOf(key, PRODUCTION_CODEC_KEYS);
|
|
148
|
+
const isProductionCodecSlot = (slot) => isAnnotationEntrySlot(slot) && isProductionCodecKey(slot.ancestor.key);
|
|
149
|
+
const isOutsideProductionCodec = (slots) => !slots.some(isProductionCodecSlot);
|
|
150
|
+
const isIgnorableLinkSlot = (slot, slots) => isArgumentSlot(slot, 1, isLinkCallee) && isOutsideProductionCodec(slots);
|
|
151
|
+
const linkSlotReason = (slot, slots) => isIgnorableLinkSlot(slot, slots) ? LINK_TRANSFORMATION_IGNORED : void 0;
|
|
152
|
+
const rulesFor = (node) => [
|
|
153
|
+
documentationSlotReason,
|
|
154
|
+
entrySlotReason,
|
|
155
|
+
linkSlotReason,
|
|
156
|
+
argumentSlotReason(0, isDefaultCallee, DECODING_DEFAULT_IGNORED),
|
|
157
|
+
typeIdSlotReason(node)
|
|
158
|
+
];
|
|
159
|
+
const firstReasonOf = (slots, rules) => slots.flatMap((slot) => rules.map((rule) => rule(slot, slots))).find((reason) => reason !== void 0);
|
|
160
|
+
const subtreeReasonOf = (node, ctx) => firstReasonOf(slotsOf(node, ctx.ancestors), rulesFor(node));
|
|
161
|
+
const objectReasonOf = (node, ctx) => firstArgumentReason(OBJECT_ARGUMENT_RULES, node, ctx.parentIf("CallExpression")) ?? subtreeReasonOf(node, ctx);
|
|
162
|
+
const literalReasonOf = (node, ctx) => firstArgumentReason(LITERAL_ARGUMENT_RULES, node, ctx.parentIf("CallExpression")) ?? subtreeReasonOf(node, ctx);
|
|
163
|
+
const arrowReasonOf = (node, ctx) => firstArgumentReason(ARROW_ARGUMENT_RULES, node, ctx.parentIf("CallExpression")) ?? subtreeReasonOf(node, ctx);
|
|
164
|
+
const BY_TYPE_REASON = {
|
|
165
|
+
ObjectExpression: objectReasonOf,
|
|
166
|
+
Literal: literalReasonOf,
|
|
167
|
+
ArrowFunctionExpression: arrowReasonOf
|
|
67
168
|
};
|
|
68
|
-
const
|
|
169
|
+
const ignoredReasonOf = (node, ctx) => (BY_TYPE_REASON[node.type] ?? subtreeReasonOf)(node, ctx);
|
|
69
170
|
const strykerIgnorers = [defineIgnorer({
|
|
70
171
|
name: "effect-schema-declarations",
|
|
71
|
-
visitors: {
|
|
72
|
-
Literal: (node, ctx) => {
|
|
73
|
-
const parent = ctx.parentIf("CallExpression");
|
|
74
|
-
return firstArgumentReason(LITERAL_ARGUMENT_RULES, node, parent) ?? documentationValueReason(node, ctx);
|
|
75
|
-
},
|
|
76
|
-
ObjectExpression: (node, ctx) => {
|
|
77
|
-
const parent = ctx.parentIf("CallExpression");
|
|
78
|
-
return firstArgumentReason(OBJECT_ARGUMENT_RULES, node, parent);
|
|
79
|
-
},
|
|
80
|
-
ArrowFunctionExpression: (node, ctx) => {
|
|
81
|
-
const parent = ctx.parentIf("CallExpression");
|
|
82
|
-
return firstArgumentReason(ARROW_ARGUMENT_RULES, node, parent);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
172
|
+
visitors: { onAnyNode: ignoredReasonOf }
|
|
85
173
|
})];
|
|
86
174
|
//#endregion
|
|
87
|
-
export { ANNOTATION_OBJECT_IGNORED, ANNOTATION_TEXT_IGNORED, BRAND_NAME_IGNORED, CLASS_ID_IGNORED, OPTIONAL_DEFAULT_IGNORED, SYMBOL_DESCRIPTION_IGNORED, TAGGED_FIELDS_IGNORED, TAGGED_TAG_IGNORED, strykerIgnorers };
|
|
175
|
+
export { ANNOTATION_OBJECT_IGNORED, ANNOTATION_TEXT_IGNORED, BRAND_NAME_IGNORED, CHECK_ANNOTATION_OBJECT_IGNORED, CHECK_ANNOTATION_TEXT_IGNORED, CLASS_ID_IGNORED, DECODING_DEFAULT_IGNORED, GENERATION_ANNOTATION_IGNORED, LINK_TRANSFORMATION_IGNORED, OPTIONAL_DEFAULT_IGNORED, SYMBOL_DESCRIPTION_IGNORED, TAGGED_FIELDS_IGNORED, TAGGED_STRUCT_TAG_IGNORED, TAGGED_TAG_IGNORED, TYPE_ID_IGNORED, strykerIgnorers };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/stryker-ignorer-effect-schema-declarations",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"@effect/tsgo": "^0.45.0",
|
|
40
40
|
"@microsoft/api-extractor": "^7",
|
|
41
41
|
"@systemfsoftware/arethetypeswrong-cli": "^4.2.0",
|
|
42
|
-
"@systemfsoftware/tsconfig": "^
|
|
42
|
+
"@systemfsoftware/tsconfig": "^2.0.1",
|
|
43
|
+
"@systemfsoftware/vitest": "^0.1.0",
|
|
43
44
|
"@types/node": "^24",
|
|
44
45
|
"@vitest/coverage-v8": "^5",
|
|
45
46
|
"oxlint": "^1",
|
|
@@ -47,8 +48,8 @@
|
|
|
47
48
|
"tsdown": "^0.23.0",
|
|
48
49
|
"typescript": "^7",
|
|
49
50
|
"vitest": "^5",
|
|
50
|
-
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
51
51
|
"@systemfsoftware/oxlint-ignorer-config": "^0.1.1",
|
|
52
|
+
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
52
53
|
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
53
54
|
},
|
|
54
55
|
"publishConfig": {
|
|
@@ -58,12 +59,12 @@
|
|
|
58
59
|
"scripts": {
|
|
59
60
|
"build": "tsdown",
|
|
60
61
|
"clean": "rimraf dist",
|
|
61
|
-
"typecheck": "tsc
|
|
62
|
+
"typecheck": "tsc -b",
|
|
62
63
|
"test": "vitest run",
|
|
63
64
|
"lint": "f=${OXLINT_FORMAT:-${AGENT:+agent}}; oxlint . --format=${f:-default}",
|
|
64
65
|
"attw": "attw --pack .",
|
|
65
66
|
"api:check": "api-extractor run",
|
|
66
67
|
"api:update": "api-extractor run --local",
|
|
67
|
-
"lint:tsgo": "effect-tsgo diagnostics --project tsconfig.json --format ${TSGO_FORMAT:-text}"
|
|
68
|
+
"lint:tsgo": "effect-tsgo diagnostics --project tsconfig.app.json --format ${TSGO_FORMAT:-text} && effect-tsgo diagnostics --project tsconfig.test.json --format ${TSGO_FORMAT:-text}"
|
|
68
69
|
}
|
|
69
70
|
}
|