Vendor the anti-slop Oxlint plugin at tools/oxlint/anti-slop and register it in oxlint.config.ts, with Oxlint's own rule categories disabled so ESLint stays the general-purpose linter. Add scripts/anti-slop.mjs (bun run deslop) mirroring the React Doctor batch interface: next-batch, check-batch, active, release, top, file. Batch handoff directories now double as file claims shared across clones via ~/.openchamber/maintenance-claims, so concurrent maintenance batches from either pipeline never select the same file. Harden both scheduled maintenance flows: stop on a dirty worktree, stop on NO BATCH AVAILABLE, validate per package instead of workspace-wide, and pin react-doctor to 0.9.12. The anti-slop task command documents concrete good and bad fixes and forbids laundering types to satisfy a rule.
29 lines
926 B
TypeScript
29 lines
926 B
TypeScript
import { defineRule } from "@oxlint/plugins";
|
|
|
|
import { isGlobalReflectMethodCall } from "../shared/reflect-method.ts";
|
|
|
|
/** Ban Reflect.apply, which bypasses ordinary typed function calls. */
|
|
export const noReflectApplyRule = defineRule({
|
|
meta: {
|
|
type: "problem",
|
|
docs: {
|
|
description:
|
|
"Disallow Reflect.apply; call typed functions directly or model dynamic dispatch behind an interface.",
|
|
},
|
|
messages: {
|
|
reflectApply:
|
|
"Replace `Reflect.apply` with a typed function call. Model dynamic dispatch behind a named interface.",
|
|
},
|
|
},
|
|
createOnce(context) {
|
|
return {
|
|
CallExpression(node) {
|
|
if (node.callee.type === "Super" || node.callee.type === "V8IntrinsicExpression") return;
|
|
if (isGlobalReflectMethodCall(context.sourceCode, node.callee, "apply")) {
|
|
context.report({ node, messageId: "reflectApply" });
|
|
}
|
|
},
|
|
};
|
|
},
|
|
});
|