@commonplaces/oxlint-plugin 0.9.0 → 0.9.1
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/README.md +5 -0
- package/dist/service-instrumentation.js +39 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -303,6 +303,11 @@ plus supplied operations in native `Layer.mock` replacements,
|
|
|
303
303
|
preserving canonical names through named imports, namespace imports and immutable
|
|
304
304
|
aliases. Shadowed names cannot borrow import identity. Every explicit operation
|
|
305
305
|
requires its exact `Effect.fn("Orders.create")` or `Effect.withSpan` name.
|
|
306
|
+
Readonly resource groups are traversed recursively, including local immutable
|
|
307
|
+
aliases: `Orders.session.read` requires that full canonical span. Each supplied
|
|
308
|
+
leaf in `Layer.mock` is checked too. Empty resource groups, cyclic groups,
|
|
309
|
+
spreads and dynamic property names fail closed; local nested contract types
|
|
310
|
+
continue to identify data and Stream members.
|
|
306
311
|
Legacy `serviceNames` selection remains available for existing consumers.
|
|
307
312
|
An empty selector is rejected.
|
|
308
313
|
|
|
@@ -206,30 +206,48 @@ export const requireServiceOperationInstrumentation = defineRule({
|
|
|
206
206
|
context.report({ node, messageId: "unsupportedOperation" });
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
if (
|
|
211
|
-
|
|
209
|
+
const check = (object, prefix, members, visited = []) => {
|
|
210
|
+
if (Array.contains(visited, object) ||
|
|
211
|
+
(visited.length > 0 && object.properties.length === 0)) {
|
|
212
|
+
context.report({ node: object, messageId: "unsupportedOperation" });
|
|
212
213
|
return;
|
|
213
214
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
context
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
215
|
+
Array.forEach(object.properties, (property) => {
|
|
216
|
+
if (property.type !== "Property") {
|
|
217
|
+
context.report({ node: property, messageId: "unsupportedOperation" });
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const key = property.computed && property.key.type !== "Literal"
|
|
221
|
+
? Option.none()
|
|
222
|
+
: propertyName(property.key);
|
|
223
|
+
Option.match(key, {
|
|
224
|
+
onNone: () => context.report({ node: property, messageId: "unsupportedOperation" }),
|
|
225
|
+
onSome: (member) => {
|
|
226
|
+
if (dataMember(context, members, member) ||
|
|
227
|
+
streamValue(context, property.value))
|
|
228
|
+
return;
|
|
229
|
+
const name = `${prefix}.${member}`;
|
|
230
|
+
const value = valueOf(context, property.value);
|
|
231
|
+
if (Option.isSome(value) && value.value.type === "ObjectExpression") {
|
|
232
|
+
const nested = Array.findFirst(members, (field) => field.type === "TSPropertySignature" &&
|
|
233
|
+
Option.contains(propertyName(field.key), member)).pipe(Option.flatMap((field) => field.type === "TSPropertySignature"
|
|
234
|
+
? Option.fromNullishOr(field.typeAnnotation?.typeAnnotation)
|
|
235
|
+
: Option.none()), Option.filter((type) => type.type === "TSTypeLiteral"), Option.map((type) => (type.type === "TSTypeLiteral" ? type.members : [])), Option.getOrElse(() => []));
|
|
236
|
+
check(value.value, name, nested, [...visited, object]);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (!instrumented(context, property.value, name) &&
|
|
240
|
+
!adapted(context, property.value, name, options.operationAdapters ?? []))
|
|
241
|
+
context.report({
|
|
242
|
+
node: property,
|
|
243
|
+
messageId: "missingInstrumentation",
|
|
244
|
+
data: { operation: name },
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
});
|
|
231
248
|
});
|
|
232
|
-
}
|
|
249
|
+
};
|
|
250
|
+
check(argument.value, owner.name, fields);
|
|
233
251
|
},
|
|
234
252
|
});
|
|
235
253
|
},
|