imMamdouhaboammar/anti-slop-engineering / skills/install-anti-slop
install-anti-slop
VerifiedInstall, configure, update, or upgrade vendored anti-slop Oxlint plugins. Use when adding anti-slop, picking up upstream rules or fixes, or migrating an existing installation while preserving local customizations.
assets/anti-slop/rules/react-forward-ref-evidence.ts
View on GitHubimport { defineRule } from "@oxlint/plugins";
import { resolveVariable } from "../shared/scope.ts";
import type { ESTree, SourceCode } from "@oxlint/plugins";
function matchesReactImport(
sourceCode: SourceCode,
identifier: ESTree.Expression,
memberAccess: boolean,
): boolean {
if (identifier.type !== "Identifier") return false;
const binding = resolveVariable(sourceCode, identifier);
if (binding?.defs.length !== 1) return false;
const definition = binding.defs[0];
if (definition.type !== "ImportBinding" || definition.parent.type !== "ImportDeclaration" ||
definition.parent.source.value !== "react" || definition.parent.importKind === "type") return false;
const specifier = definition.node;
if (specifier.type === "ImportSpecifier") {
if (specifier.importKind === "type") return false;
const imported = specifier.imported;
const name = imported.type === "Identifier" ? imported.name : imported.value;
return name === (memberAccess ? "default" : "forwardRef");
}
return memberAccess && (specifier.type === "ImportDefaultSpecifier" || specifier.type === "ImportNamespaceSpecifier");
}
export const reactForwardRefEvidenceRule = defineRule({
meta: {
type: "suggestion",
docs: { description: "Locate calls to the React forwardRef import around inline function components." },
messages: {
reactWrapper: "React forwardRef wraps an inline function component. Verify the locked React release and the supported versions before proposing a ref-prop migration.",
},
},
createOnce(context) {
return {
CallExpression(node) {
const component = node.arguments[0];
if (node.optional || node.arguments.length !== 1 ||
(component?.type !== "FunctionExpression" && component?.type !== "ArrowFunctionExpression")) return;
const callee = node.callee;
if (callee.type === "Identifier" && matchesReactImport(context.sourceCode, callee, false)) {
context.report({ node, messageId: "reactWrapper" });
} else if (callee.type === "MemberExpression" && !callee.optional &&
(callee.computed ? callee.property.type === "Literal" && callee.property.value === "forwardRef"
: callee.property.type === "Identifier" && callee.property.name === "forwardRef") &&
matchesReactImport(context.sourceCode, callee.object, true)) {
context.report({ node, messageId: "reactWrapper" });
}
},
};
},
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |